i want color k clusters of points in 2d grid. right using naive approach.
i'm using rgb set color, g component fix, r counted down gradually, b counted gradually. first cluster has r set 255 , last 0, vice versa b.
int r = 255, g = 80, b = 0; // stuff int step = 255 / k; // loop on data int cluster = getcurrentcluster(); int currentr = r - (cluster * step); int currentg = g; int currentb = b + (cluster * step); the current solution working , effektive. it's possible differentiate clusters colors

but don't it, , prefer rainbow colors or @ least richer spectrum.
how can achieve that? how can map integer in interval [0, k) color meets requirements?
another approach came mind map integer wave length in given interval, e.g. 400 nm 800 nm (should rainbow spectrum, if recall correctly) , convert wavelength rgb.
if want map linear range rainbow spectrum better off starting color space hsv , convert rgb.
here find details of conversion
Comments
Post a Comment