aUCBLogo Demos and Tests / knots
to knots ; Knots by Andreas Micheler
setsc 0
perspective
setpc 4
cs
ht
pu
fd 100
left 90
rightRoll 90
fd 200
right 90
leftRoll 90
pu
repeat 1000
[ phi=repcount/1000
fd 2
down (2.19+cos (3*360*phi))*360/1000
rightRoll 1.35*(sin (3*360*phi))*360/1000
; down 3*360/1000
; rightRoll 2*(sin (3*360*phi))*360/1000
setpc hsb 360*phi 1 1
square
]
erN "square_pos
rotateScene
end
to square
ifelse not name? "square_pos
[ square_width=40
square_pos=posXYZ
right 90
forward square_width
square_edge=posXYZ
back square_width
left 90
][
local [new_pos new_edge]
new_pos=posXYZ
pd
PolyStart
setPosXYZ PosXYZ
setPosXYZ square_pos
setPosXYZ square_edge
PolyEnd
pu setPosXYZ new_pos pd
PolyStart
setPosXYZ PosXYZ
setPosXYZ square_edge
pu setPosXYZ new_pos
right 90
pd
forward square_width
PolyEnd
pu
square_edge=posXYZ
back square_width
left 90
square_pos=new_pos
]
end