aUCBLogo Demos and Tests / clovertest2
be clovertest2 [singleshot false][FrameNr 0]
; for aUCBLogo-4.7
if singleshot [(reRandom 0)]
hideTurtle
WindowMode
perspective
setPenColor HSB 120 1 0.7
setPenSize [5 5]
enableCylinderLines
cs
GraphicStart
PenDown
fd 100
down 80
left 135
rightRoll 180
repeat 3
[ petal 2 4 2
right 180
]
clover=GraphicEnd
;stop
cs
drawPlane
setPenColor "forestGreen
repeat 100
[ PenUp
setY 0
setX (rnd-0.5)*800
setZ (rnd-0.5)*800
setRoll random 180
setPitch 0
setHeading 0
down (random 20)-10
setPenColor HSB 120 1 0.4+rnd*0.3
(drawGraphic clover rnd)
]
ifelse singleshot
[ (rotatescene2 1 true FrameNr*10)
][ rotatescene2
]
end
be drawPlane
p=PosXYZ
o=Orientation
down 90
horizon=10000
PenUp
fd horizon rt 90 fd horizon rt 90
setPenColor HSB 70 0.4 0.8
PenDown
PolyStart
repeat 4 [fd horizon*2 rt 90]
PolyEnd
PenUp
setPosXYZ p
setOrientation o
end
be halfpetal1 l f ex
for [a 0 90]
[ fd l
right f*(sin a)^ex
]
end
be halfpetal2 l f ex
for [a 90 0]
[ right f*(sin a)^ex
fd l
]
end
be petal2D l f ex
p0=Pos
PenDown
TessStart
halfpetal1 l f ex
hm=towards p0
right 180-2*(Heading-hm)
halfpetal2 l f ex
TessEnd
end
be petal l f ex
p0=PosXYZ
PenDown
TessStart
halfpetal1 l f ex
PenUp
p1=PosXYZ
v1=p1-p0
v1=v1/Norm v1
p2=PosXYZ
fd 1
p3=PosXYZ
back 1
v2=p3-p2
v2=v2/Norm v2
hm=arcCos 0+v1*v2
right 180-2*hm
PenDown
halfpetal2 l f ex
TessEnd
end