Ejemplo n.º 1
0
        private static void TestHSIToColor3(
            float hue, float saturation, float intensity,
            float expectedC1, float expectedC2, float expectedC3)
        {
            float c1;
            float c2;
            float c3;

            HSxUtils.HSIToColor3(hue, saturation, intensity, out c1, out c2, out c3);

            Assert.That(c1, Is.EqualTo(expectedC1).Within(Epsilon));
            Assert.That(c2, Is.EqualTo(expectedC2).Within(Epsilon));
            Assert.That(c3, Is.EqualTo(expectedC3).Within(Epsilon));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        private static void TestColor3ToHSV(
            float c1, float c2, float c3,
            float expectedHue, float expectedSaturation, float expectedValue)
        {
            float hue;
            float saturation;
            float value;

            HSxUtils.Color3ToHSV(c1, c2, c3, out hue, out saturation, out value);

            Assert.That(hue, Is.EqualTo(expectedHue).Within(Epsilon));
            Assert.That(saturation, Is.EqualTo(expectedSaturation).Within(Epsilon));
            Assert.That(value, Is.EqualTo(expectedValue).Within(Epsilon));
        }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
        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);
                    }
                }
            }
        }
Ejemplo n.º 6
0
        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);
                    }
                }
            }
        }
Ejemplo n.º 7
0
        public void HSVToColor3_is_inverse_of_Color3ToHSV()
        {
            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, value;
                        HSxUtils.Color3ToHSV(r, g, b, out hue, out saturation, out value);

                        TestHSVToColor3(hue, saturation, value, r, g, b);
                    }
                }
            }
        }