Anonymous user
Bitmap/Midpoint circle algorithm: Difference between revisions
Bitmap/Midpoint circle algorithm (view source)
Revision as of 23:37, 19 September 2014
, 9 years ago→{{header|zkl}}: update
(Opps) |
(→{{header|zkl}}: update) |
||
Line 1,550:
=={{header|zkl}}==
Image cribbed from the BBC BASIC entry. Algorithm from Wikipedia article.<br/>
Uses the PPM class from http://rosettacode.org/wiki/Bitmap/Bresenham%27s_line_algorithm#zkl
[[Image:circle_bbc.gif|right]]
This is the code from the PPM class:
<lang zkl> fcn
x:=r; y:=0; radiusError:=1-x;
while(x >= y){
Line 1,584 ⟶ 1,569:
else{ x-=1; radiusError+=2*(y - x + 1); }
}
}</lang>
<lang zkl>ppm:=PPM(200,200,0xFF|FF|FF);
ppm.circle(100,100,40,00); // black circle
|