Draw a sphere: Difference between revisions

m
m (→‎{{header|Batch File}}: make the code slightly clearer)
Line 1,141:
 
=={{header|Batch File}}==
{{trans|C}}<br/>
Since Batch Files do not support floating point, the input parameters for drawing the sphere are limited to integers only. The ''k'' parameter has been hardcoded to 2. The <code>ambient</code> variable for this code is scaled up 10 times of its value in C implementation. For example, <code>ambient = 0.1</code> in C code corresponds to <code>ambient = 1</code> here.
Lastly, the variables used in calculations are scaled up 100 times of the actual values in C implementation, and then scaled down 100 times back for determination of shades.
Line 1,211:
set /a "R=%1", "negR=-R", "twiceR=R*2", "twiceNegR=negR*2"
set /a "sqrdR=R*R*100*100" %== R*R is mult. by 100*100 ==%
set "k=2" %== k is hardcoded to 2 ==%
set "ambient=%3"
rem start draw line-by-line
535

edits