public void quantize(){
final double h_scale = 0.0555 ;//1/18
final double s_scale = 0.333 ;//1/3
final double v_scale = 0.333; //1/3
System.out.println("h_scale"+h_scale+"s_scale"+s_scale+"v_scale"+v_scale);
if (saturation == 0) {
color = (162 + (int)(value/0.25));//color = 162 + Int(v/(1/4))
if (color == 166) {
color = color - 1;
}
}
else {
if ((value / v_scale) >= 1) {
color = color + 54 * ((int)(value/v_scale));
if (color % 3 * 18 * 3 == 0) {
color = color - 3 * 18;
}
}//end if v/v_scale
if ((saturation / s_scale) >= 1) {
color = color + (18 * ((int)(saturation /s_scale)));//color=color+(Int(s/s_scale))
if (color % 3 * 18 == 0) {
color = color - 18;
}
}//end if s/s_scale
if ((hue / h_scale) >= 1 ) {
color = color+((int)(hue/h_scale));//color=color+(Int(h/h_scale))
if (color % 18 == 0) {
color = color - 1;
}
}//end if h/h_scale
}//end else
System.out.println("Color quantified is : "+color);
}//end quantize || quantification at 166 colors