Anonymous user
Color wheel: Difference between revisions
→{{header|zkl}}: re-invent the wheel
m (used better phrasing in the "recommendation" sentence.) |
(→{{header|zkl}}: re-invent the wheel) |
||
Line 76:
=={{header|zkl}}==
Each point in the square is converted to polar coordinates, the angle is hue and the radius is saturation (which is scaled by the distance from the pole). If the radius/saturation is in the circle, render it.▼
▲Each point in the square is converted to polar coordinates, the angle is hue and the radius is saturation (which is scaled by the distance from the pole).
Uses the PPM class from http://rosettacode.org/wiki/Bitmap/Bresenham%27s_line_algorithm#zkl
Line 85 ⟶ 84:
fcn colorWheel(ppm){
foreach x,y in (w,h){
v,hue:=(x -
if(
if((hue = hue.toDeg())<0) hue+=360; // (-pi..pi] to [0..2pi)
}
}
}
|