java.lang.Object
dev.lukebemish.dynamicassetgenerator.api.colors.clustering.Cluster

public class Cluster extends Object
A custer of colors, to be used with a Clusterer.
  • Constructor Details

    • Cluster

      public Cluster(int color)
      Create a cluster containing only the provided color.
    • Cluster

      public Cluster(Collection<Integer> colors)
      Create a cluster containing the provided colors
      Parameters:
      colors - the colors to add to the cluster. Must be non-empty
      Throws:
      IllegalArgumentException - if no colors are provided
  • Method Details

    • dist

      public double dist(Cluster other, ColorTypes.ConversionCache32 rgb2labCache)
      Calculate the distance between this cluster and another cluster.
      Parameters:
      other - the other cluster to compare to
      rgb2labCache - a cache to use for converting colors to CIELAB, linked to the lifespan of the parent clusterer
      Returns:
      the distance between the two clusters in CIELAB32 space
    • merge

      public void merge(Cluster other)
      Merges the provided cluster into this cluster.
    • getColors

      public it.unimi.dsi.fastutil.ints.IntList getColors()
      Returns:
      an unmodifiable view of the colors in this cluster