コード例 #1
0
        private static void TestCieXYZToLCh(LxyModel model, float x, float y, float z, float expectedL, float expectedC, float expectedH)
        {
            float l, c, h;

            LChUtils.CieXYZToLCh(x, y, z, out l, out c, out h, model);

            Assert.That(l, Is.EqualTo(expectedL).Within(Epsilon));
            Assert.That(c, Is.EqualTo(expectedC).Within(Epsilon));
            Assert.That(h, Is.EqualTo(expectedH).Within(Epsilon));
        }
コード例 #2
0
        public void LChToCieXYZ_is_inverse_LChToCieXYZ()
        {
            for (int m = 0; m < 2; m++)
            {
                for (float x = Step; x <= 1; x += Step)
                {
                    for (float y = Step; y <= 1; y += Step)
                    {
                        for (float z = Step; z <= 1; z += Step)
                        {
                            var model = m == 0 ? LxyModel.Lab : LxyModel.Luv;

                            float l, c, h;
                            LChUtils.CieXYZToLCh(x, y, z, out l, out c, out h, model);

                            TestLChToCieXYZ(model, l, c, h, x, y, z);
                        }
                    }
                }
            }
        }