MapSuiteGisEditor/GisEditorPluginCore/Shares/UIs/Controls/SolidColorPicker/ColorHelper.cs
/// <summary>
/// Calculate the difference in hue between two <see cref="Color"/>s.
/// </summary>
/// <param name="c1"></param>
/// <param name="c2"></param>
/// <returns></returns>
Calculate the difference in hue between two s.
Calculate the difference in hue between two s .
public static double HueDifference(Color c1, Color c2)
        {
            double[] hsv1 = ColorToHsv(c1);
            double[] hsv2 = ColorToHsv(c2);
            double dh = hsv1[0] - hsv2[0];
            if (dh > 0.5) dh -= 1.0;
            if (dh < -0.5) dh += 1.0;
            double e = dh * dh;
            return Math.Sqrt(e);
        }
public static double HueDifference ( Color c1 , Color c2 ) { double [ ] hsv1 = ColorToHsv ( c1 ) ; double [ ] hsv2 = ColorToHsv ( c2 ) ; double dh = hsv1 [ 0 ] - hsv2 [ 0 ] ; if ( dh > 0.5 ) dh -= 1.0 ; if ( dh < - 0.5 ) dh += 1.0 ; double e = dh * dh ; return Math . Sqrt ( e ) ; }
Calculate the difference in hue between two s.
Calculate the difference in hue between two s .
// clamp to [-0.5,0.5]
None
c1
Color
None
c2
Color
None