aUCBLogo Demos and Tests / drawcoil
to drawcoil
hideTurtle
WindowMode
N=20
Nstart=6
Nend=N
drawcoil1
Nend=N-1/4
drawcoil2
end
to drawcoil1
clearScreen
PenUp
imax=10000
istart=imax*Nstart/N
iend=imax*Nend/N
Ra=300
setPenSize 300/2/N
i=istart
goto_point
setX xCor-3
fillCircle 4
goto_point
PenDown
for [i istart iend]
[ goto_point
]
setXY Ra Ra-10
fillCircle 6
updateGraph
setSaveSize [400 300]
saveScreen "C:/temp/drawcoil1.png
end
to goto_point
R=Ra*i/imax
phi=360*N*i/imax
setXY R*cos phi R*sin phi
end
to drawcoil2
clearScreen
PenUp
imax=10000
istart=imax*Nstart/N
iend=imax*Nend/N
Ra=300
setPenSize 300/2/N
i=istart
goto_point2
setX xCor+3
fillCircle 4
goto_point2
PenDown
for [i istart iend]
[ goto_point2
]
setXY -Ra+30 Ra-10
fillCircle 6
updateGraph
saveScreen "C:/temp/drawcoil2.png
end
to goto_point2
R=Ra*i/imax
phi=360*N*i/imax
setXY -R*cos phi -R*sin phi
end