Hi to all the math whizzes 
In one of Hillegass's methods ( p 333) he takes 2 rgb colors ( in the same ColorSpace) and tries to find a closest match. ( Well...what is really happening, is that one of the colors is passed into the method as an argument, converted to the correct colorSpace, and the other color is from an "Apple" NSColorList). Each color is "decomposed" into it's basic components, with one set of colors represented as "r","g","b", and the other color as "red", "green", "blue" in the code below.
The line of code that has me a little curious is this.( not what "pow" means, but why the construct a = x(squared) + y(squared) + z(squared) is used)
Is this just an extension of the simple "square on the hypotenuse" but applied in 3 axes?
Anyway, thanks for taking a look.
In one of Hillegass's methods ( p 333) he takes 2 rgb colors ( in the same ColorSpace) and tries to find a closest match. ( Well...what is really happening, is that one of the colors is passed into the method as an argument, converted to the correct colorSpace, and the other color is from an "Apple" NSColorList). Each color is "decomposed" into it's basic components, with one set of colors represented as "r","g","b", and the other color as "red", "green", "blue" in the code below.
The line of code that has me a little curious is this.( not what "pow" means, but why the construct a = x(squared) + y(squared) + z(squared) is used)
Code:
float dist = pow(red-r,2) + pow(green -g,2) + pow( blue -b, 2)
Is this just an extension of the simple "square on the hypotenuse" but applied in 3 axes?
Anyway, thanks for taking a look.