private static void TestColor3ToHSL( float c1, float c2, float c3, float expectedHue, float expectedSaturation, float expectedLightness) { float hue; float saturation; float lightness; HSxUtils.Color3ToHSL(c1, c2, c3, out hue, out saturation, out lightness); Assert.That(hue, Is.EqualTo(expectedHue).Within(Epsilon)); Assert.That(saturation, Is.EqualTo(expectedSaturation).Within(Epsilon)); Assert.That(lightness, Is.EqualTo(expectedLightness).Within(Epsilon)); }
public void HSLToColor3_is_inverse_of_Color3ToHSL() { for (float r = 0; r <= 1; r += Color3Step) { for (float g = 0; g <= 1; g += Color3Step) { for (float b = 0; b <= 1; b += Color3Step) { float hue, saturation, lightness; HSxUtils.Color3ToHSL(r, g, b, out hue, out saturation, out lightness); TestHSLToColor3(hue, saturation, lightness, r, g, b); } } } }