Jump to content

Bitmap/Midpoint circle algorithm: Difference between revisions

m
→‎{{header|REXX}}: changed a program comment, added/changed comments in the REXX section header.
(→‎{{header|REXX}}: added/changed whitespace and comments, simplified the subroutines.)
m (→‎{{header|REXX}}: changed a program comment, added/changed comments in the REXX section header.)
Line 1,474:
<br>vertical direction because characters are "taller" than they're "wide", so this REXX version attempts to maintain
<br>a good aspect ratio.
 
The program automatically shows all of the plot's points by finding the minimum and maximum X,Y coördinates.
<lang rexx>/*REXX program plots three circles using midpoint/Bresenham's circle algorithm*/
@. = '·' /*fill the array with middle─dots char.*/
Line 1,497 ⟶ 1,499:
/*────────────────────────────────────────────────────────────────────────────*/
drawCircle: procedure expose @. minX maxX minY maxY /* [↓] Y is defined as R*/
parse arg xx,yy,r 1 y,plotChar; f=1-r; fx=1; fy=-2*r /*get the X,Y coordinatescoördinates*/
 
do x=0 while x<y /*▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒*/
Line 1,518 ⟶ 1,520:
return</lang>
{{out}}
<pre>
<pre style="height:70ex">
·······················│·······················
·······················│·······················
Cookies help us deliver our services. By using our services, you agree to our use of cookies.