/** * calculate the angle in radians of the point (cieX, cieY) in the CIE chromaticity diagram with * respect to an origin of (0.35, 0.35). Note that one should check for white before using this as * the resulting angle will not be a significant answer if it is. The angles are * * <pre> 90(=pi/2) * | * | * 180 ----------- 0 * (=pi) | * | * 270(=3pi/2) * </pre> * * @param cieX * @param cieY * @return the angle in radians of the point (cieX, cieY) with respect to an origin of (0.35, * 0.35). The invoker should check the original r,g,b for black and white to avoid use here. A * value of -1 is returned for white. */ public double calculateXYTheta(float cieX, float cieY) { if (cieX == 0.35) { if (cieY > (0.35 + deltaWhite)) { return Math.PI / 2.; } else if (cieY < (0.35 - deltaWhite)) { return 1.5 * Math.PI; } else { // this should have been found as white to avoid use here return -1; } } double theta = MiscMath.calculatePolarTheta(cieX - 0.35f, cieY - 0.35f); return theta; }