bool DeltaHSV::contains(const CColor &c1, const CColor &c2) const { double hdiff; double h1=c1.getHue(); double h2=c2.getHue(); // hdiff is the smallest difference between h1 and h2. if (h1<h2) hdiff=h2-h1; else hdiff=h1-h2; if (hdiff>180.0) hdiff=360.0-hdiff; double sdiff = fabs(c1.getSaturation()-c2.getSaturation()); double vdiff = fabs(c1.getValue()-c2.getValue()); if (hdiff <= delta_hue && sdiff <= delta_saturation && vdiff <= delta_value) return true; return false; }