private static void TestColor3ToHSI( float c1, float c2, float c3, float expectedHue, float expectedSaturation, float expectedIntensity) { float hue; float saturation; float intensity; HSxUtils.Color3ToHSI(c1, c2, c3, out hue, out saturation, out intensity); Assert.That(hue, Is.EqualTo(expectedHue).Within(Epsilon)); Assert.That(saturation, Is.EqualTo(expectedSaturation).Within(Epsilon)); Assert.That(intensity, Is.EqualTo(expectedIntensity).Within(Epsilon)); }
public void HSIToColor3_is_inverse_of_Color3ToHSI() { 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, intensity; HSxUtils.Color3ToHSI(r, g, b, out hue, out saturation, out intensity); TestHSIToColor3(hue, saturation, intensity, r, g, b); } } } }