aUCBLogo Demos and Tests / polyfilltest
to polyfilltest
aa 6 20 300
end
to aa :n :size :radius
; :n number of sides of polygon
; :size side length of polygon
; :radius radius of circle
white=rgb 1 1 1
cs pu ht setpc 0
local[theta phi p_radius]
disls
setps [2 2]
make "theta 360/:n
make "phi (90-:theta/2)
make "p_radius :size/(2*cos :phi)
pd circle radius pu
rt 180-:phi fd :p_radius lt 180-:phi
tile 1
ifelse Key?
[ ignore readChar print [Stopped.]
]
[ print [Finished.]
]
end
to poly :dir_
local "p
pd
(repeat :n
[fd :size lt :dir_*:theta])
pu
setfc ifelse :dir_<0[2][4] ;problem with color value; replace with rgb values?
make "p list pos heading
lt :dir_*:phi fd :p_radius (fill FILL_SMALL)
; updateGraph
setpos first :p seth last :p
end
to probe? :dir_
local [p c]
make "p list pos heading
lt :dir_*:phi fd :p_radius
make "c (and pixel==white :radius>norm pos) ;problem with color value
setpos first :p seth last :p
op :c
end
to tile :dir_
ifelse probe? :dir_ [poly :dir_][stop]
repeat :n
[ tile -1*:dir_
fd :size lt :dir_*:theta
if Key? [stop]
]
end