How do I calculate the difference between two variables that wrap around? To be Specific: How do I take a Hue of Color X, and the Hue of Color Y, then compare their values (via subtraction) to see how far apart they are. Out of the box the solution would be to simply subtract them within an absf() however Hue 0.1 visually isn’t far from Hue 1.0, but is numerically vast.
But I think the first version is fine for just hue’s. (You may want to add a verification that the two values are less than 1, otherwise it can return a -ve number in some cases.)
Hope that helps, not sure it is the best way but it seems to work when I tested it.
I had a suspicion it could be as simple as basing the comparison off of 1, but I wasn’t entirely sure and began mentally spiraling through solutions that convert the values into Degrees so I may utilize the @GlobalScope.angle_difference function.