private static void TestLxyToLCh(float l, float x, float y, float expectedC, float expectedH) { float lch_l, lch_c, lch_h; LChUtils.LxyToLCh(l, x, y, out lch_l, out lch_c, out lch_h); Assert.That(lch_l, Is.EqualTo(l).Within(Epsilon)); Assert.That(lch_c, Is.EqualTo(expectedC).Within(Epsilon)); Assert.That(lch_h, Is.EqualTo(expectedH).Within(Epsilon)); }
public void LChToLxy_is_inverse_LxyToLCh() { for (float l = 0; l <= 1; l += Step) { for (float x = -1; x <= 1; x += Step) { for (float y = -1; y <= 1; y += Step) { float lch_l, lch_c, lch_h; LChUtils.LxyToLCh(l, x, y, out lch_l, out lch_c, out lch_h); TestLChToLxy(lch_l, lch_c, lch_h, x, y); } } } }