private static void TestXYZToxyY(float x, float y, float z, float expected_xyY_x, float expected_xyY_y, float expected_xyY_Y) { float xyY_x, xyY_y, xyY_Y; CieXYZUtils.XYZToxyY(x, y, z, out xyY_x, out xyY_y, out xyY_Y); Assert.That(xyY_x, Is.EqualTo(expected_xyY_x).Within(Epsilon)); Assert.That(xyY_y, Is.EqualTo(expected_xyY_y).Within(Epsilon)); Assert.That(xyY_Y, Is.EqualTo(expected_xyY_Y).Within(Epsilon)); }
public void xyYToXYZ_is_inverse_of_XYZToxyY() { for (float x = 0; x <= 1; x += Step) { for (float y = Step; y <= 1; y += Step) { for (float z = 0; z <= 1; z += Step) { if (x == 0 && y == 0 && z == 0) { continue; } float xyY_x, xyY_y, xyY_Y; CieXYZUtils.XYZToxyY(x, y, z, out xyY_x, out xyY_y, out xyY_Y); TestxyYToXYZ(xyY_x, xyY_y, xyY_Y, x, y, z); } } } }