Draw a sphere: Difference between revisions
m
→{{header|Batch File}}
Simple9371 (talk | contribs) m (→{{header|Batch File}}: make the code slightly clearer) |
Simple9371 (talk | contribs) |
||
Line 1,141:
=={{header|Batch File}}==
{{trans|C}}
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"
set "ambient=%3"
rem start draw line-by-line
|