aUCBLogo Demos and Tests / clovertest2sh
be clovertest2sh
; for aUCBLogo-4.7
singleshot=Name? "framenr
if singleshot [(reRandom 0)]
hideTurtle
WindowMode
perspective
setPenColor HSB 120 1 0.7
setPenSize [5 5]
enableCylinderLines
comment [
cs
GraphicStart
PenDown
fd 100
down 80
left 135
rightRoll 180
repeat 3
[ petal 2 4 2
right 180
]
clover=GraphicEnd
]
;stop
cs
enableShadows
clearShadows
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 10)-5
setPenColor HSB 120 1 0.4+rnd*0.3
; (drawGraphic clover rnd)
PenDown
fd 100
down 80
left 135
rightRoll 180
l=rnd+1
repeat 3
[ petal l 4 2
right 180
]
PenUp
Home
]
castShadows
rotatescene2
clearShadows
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 5]
[ fd 5*l
right 5*f*(sin a)^ex
]
end
be halfpetal2 l f ex
for [a 90 0 -5]
[ right 5*f*(sin a)^ex
fd 5*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