!----------------------------------------------
define style graph1 font_style,10/GLOB_SCALE*0.5,1,0
define style graph2 font_style,10/GLOB_SCALE*1,6,1
style graph1
num=numberCircles
R=circleRadius
i=0
dim xy[][]
for k= 1 to num
if k= 1 then
xy[1][1]=rnd(a-2*R)+R
xy[1][2]=rnd(b-2*R)+R
else
antireboot=0
1:
if antireboot=maxantireboot then goto 2000
alpha= rnd(360+i)
xy[k][1]=xy[k-1][1]+2*R*sin(alpha): xy[k][2]=xy[k-1][2]+2*R*cos(alpha)
gosub 1000
if ne_AB> 0 then antireboot=antireboot+1
if ne_AB> 0 then goto 1
gosub 1001
if circInside> 0 then antireboot=antireboot+1
if circInside> 0 then goto 1
endif
next k
___________________________________________________2d-скрипт
call `(m)CoordinateAxes` parameters all
style graph2
for dc= 1 to num
pen 3
circle2 xy[dc][1],xy[dc][2],R
pen 1
if showProcess then text2 xy[dc][1],xy[dc][2],str(dc,8,0)
next dc
end !#1
2000:
call "Resize_A_B_ZZYZX" parameters all
line2 0,0,0,b
line2 a,0,a,b
line2 0,b,a,b
line2 0,0,a,0
style graph2
text2 a/2,b/2,`Проверок:`+str(maxantireboot ,8,0)+`- ошибка в параметрах`
end !#2
!-!___________________________________________________процедуры
1000:
ne_AB=0
if xy[k][1]-R<0 or xy[k][1]+R>a then ne_AB=1
if xy[k][2]-R<0 or xy[k][2]+R>b then ne_AB=1
return
1001:
circInside=0
for check= k-1 to 1 step -1
i=i+1
ab= sqr((xy[k][1]-xy[check][1])^2+(xy[k][2]-xy[check][2])^2)
if ab< 2*R then circInside=circInside+1
if showProcess then text2 xy[k][1]+.02,xy[k][2]-check*0.01,str(k,8,0)+`-`+str(check,8,0)+`-`+str(circInside,8,0)
if circInside> 0 then check= 1
next check
return