Browse Source

Fix bug in hue angle diff calc

Kirk Trombley 3 years ago
parent
commit
4cd7b8afa1
1 changed files with 1 additions and 1 deletions
  1. 1 1
      nearest.js

+ 1 - 1
nearest.js

@@ -65,7 +65,7 @@ const getCalculator = (closeCoeff, includeX, normQY, qRGB, qJAB) => {
         angleRGB: acosDeg(cosAngleRGB), 
         angleJAB: acosDeg(cosAngleJAB), 
         chromaAngle: acosDeg(cosChromaAngle),
-        hueAngle: Math.abs(qHueAngle - d3.hsl(d3.rgb(...yRGB)).h),
+        hueAngle: Math.acos(Math.cos((qHueAngle - d3.hsl(d3.rgb(...yRGB)).h) * Math.PI / 180)),
         stdDevRGB: Math.sqrt(xRGB - 2 * yTermRGB + qRGBNormSq),
         stdDevJAB: Math.sqrt(xJAB - 2 * yTermJAB + qJABNormSq),
       },