I am not a programer myselft, but I got in to a question:how to calculate the complement color of a color in rgb space? thanks in advance.
complement color how?
there’s a link to the full source code … dunno if that really helps … at least it’s quite useful and funny imho
I may be completely wrong, but it might be easier finding this by converting to hue, saturation, value space (HSV) and adding 180 degrees onto the hue.
Simon
It’s a relatively simple series of matrix transforms performed on the colors in 3D space. Rotate 180 degrees on all axes. It’s explained here:
http://www.sgi.com/grafica/matrix/index.html
under “Simple Hue Rotation” in Paul Haeberli’s “Matrix Operations for Image Processing”, Nov. 1993. Have fun.
that helps, but can’t digest that, not a programer myself. simply tell me If i know a hue of a color as a value between 0-255.how to rotate it 180degree? thanks
Well, usually you don’t have values between 0-255 for most cg or color theory applications. It’s usually 0-359 degrees, as in a circle, that’s why you can rotate HSV. So to rotate to get a compliment you’d add 180 degrees (1/2 of 360). If the sum is larger than 359, simply subtract it from 360. If for some odd reason it’s 0-255, then again add 1/2 of 256 (128) and if the sum is larger than 255, subtract it from 256 to wrap it.
If you’re just numerically trying to figure this out, this is fine, but to compute this procedurally you’ll have to program.
…or it would really be better to have it as a floating point [0,1], or [0,2*PI] Otherwise if you’re doing a series of successive transformations your colours will be “off” pretty quickly.
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.