Draw a sphere: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: elided one comment, added/changed whitespace and comments, optimized sqrt function.)
m (→‎{{header|REXX}}: used a more idiomatic expression for getting the minimum.)
Line 4,191: Line 4,191:
parse value norm(x y sqrt(rr-xx-yy) ) with v1 v2 v3
parse value norm(x y sqrt(rr-xx-yy) ) with v1 v2 v3
dot= s1*v1 + s2*v2 + s3*v3 /*the dot product of the Vs*/
dot= s1*v1 + s2*v2 + s3*v3 /*the dot product of the Vs*/
if dot>0 then dot= 0 /*if positive, make it zero*/
dot= min(0, dot) /*if positive, make it zero*/
b= -dot**k + ambient /*calculate the brightness.*/
b= -dot**k + ambient /*calculate the brightness.*/
if b<=0 then brite= shadeLen
if b<=0 then brite= shadeLen