Draw a sphere: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: added/changed comments, changed 1 dithering character, simplified NORM and SQRT subroutines.)
m (→‎{{header|REXX}}: added notes about show output when executing on an ASCII machine.)
Line 2,986: Line 2,986:
<br>The REXX language doesn't have a &nbsp; '''SQRT''' &nbsp; function, so a version is included here.
<br>The REXX language doesn't have a &nbsp; '''SQRT''' &nbsp; function, so a version is included here.
<br>Same with the &nbsp; '''CEIL'''ing &nbsp; and &nbsp; '''FLOOR''' &nbsp; functions.
<br>Same with the &nbsp; '''CEIL'''ing &nbsp; and &nbsp; '''FLOOR''' &nbsp; functions.
<br><br>Programming note: &nbsp; the output will appear slightly different when executed on an EBCDIC machine.
<lang rexx>/*REXX program expresses a lighted sphere with simple chars for shading.*/
<lang rexx>/*REXX program expresses a lighted sphere with simple chars for shading.*/
call drawSphere 19, 4, 2/10 /*draw a sphere with radius 19. */
call drawSphere 19, 4, 2/10 /*draw a sphere with radius 19. */
Line 3,024: Line 3,025:
do k=j+5 to 0 by -1; if m.k>11 then numeric digits m.k; g=.5*(g+x/g); end
do k=j+5 to 0 by -1; if m.k>11 then numeric digits m.k; g=.5*(g+x/g); end
numeric digits d; return g/1</lang>
numeric digits d; return g/1</lang>
'''output'''
'''output''' &nbsp; when executed on an ASCII machine:
<pre style="height:105ex">
<pre style="height:105ex">
eeeeeeeeee@@@@@@@
eeeeeeeeee@@@@@@@