Draw a sphere: Difference between revisions

m
→‎{{header|REXX}}: used a better idiomatic form for concatenation, added whitespace.
m (→‎{{header|REXX}}: added whitespace and changed comments.)
m (→‎{{header|REXX}}: used a better idiomatic form for concatenation, added whitespace.)
Line 4,182:
if 8=='f8'x then shading= ".:!*oe&#%@" /* EBCDIC dithering chars. */
else shading= "·:!°oe@░▒▓" /* ASCII " " */
parse value norm(lightSource) with s1 s2 s3 s3 /*normalize light source. */
shadeLen= length(shading) - 1; rr= r**2; r2= r+r /*handy─dandy variables. */
 
do i=floor(-r ) to ceil(r ); x= i + .5; xx= x**2; $=
Line 4,193:
if b<=0 then brite= shadeLen
else brite= max(0, (1-b) * shadeLen) % 1
$= ($) || substr(shading, brite + 1, 1)
end /* [↑] build display line.*/
else $= $' ' /*append a blank to line. */