Anonymous user
Total circles area: Difference between revisions
→optimized: optimized for faster grid calculations.
m (→optimized: changed a comment.) |
(→optimized: optimized for faster grid calculations.) |
||
Line 2,582:
verbose= box<0; box= abs(box); boxen= box+1 /*set a flag if we're in verbose mode. */
numeric digits dig /*have enough decimal digits for points*/
/* ══════x══════ ══════y══════ ═══radius═══ ══════x══════ ══════y══════ ═══radius═══*/
$=' 1.6417233788 1.6121789534 0.0848270516 -1.4944608174 1.2077959613 1.1039549836',
Line 2,602 ⟶ 2,601:
parse var $ minX minY . 1 maxX maxY . /*assign minimum & maximum values.*/
do j=1 for circles; _= j * 3 -
@x.j= word($, _); @y.j=word($, _ + 1)
@r.j=word($, _ + 2) / 1; @rr.j= @r.j **2
Line 2,617 ⟶ 2,616:
dx= (maxX-minX) / box; dy= (maxY-minY) / box /*compute the DX and DY values*/
do z=0 for boxen; rowDY.z= z*dy; colDX.z= z*dx
end /*z*/
w= length(circles) /*W: used for aligning output. */
#in= 0 /*#in ◄───fully contained circles.*/
Line 2,630 ⟶ 2,631:
if #in==0 then #in= 'no' /*use gooder English. (humor). */
if verbose then do; say; say #in " circles are fully contained within other circles.";end
nC=
#=
say /*stick a fork in it, we're done. */
say 'Using ' box " boxes (which have " box**2 ' points) and ' dig " decimal digits,"
say 'the approximate area is: ' # * dx * dy</lang>
{{out|output|text= when using various number of boxes:}}
|