aUCBLogo Demos and Tests / shortcutgraphics
to shortcutgraphics
;cs
WindowMode
size=1
width=30
texy=0
;f 50
;r 180 50
;l 180 50
end
to f len
; PenUp fd len*size setTexXY xCor/10 zCor/10 back len*size PenDown
ht
local [texo]
texo=shortcutgraphics::texy
shortcutgraphics::texy = shortcutgraphics::texy+len*shortcutgraphics::size/10
local [p0 ori]
p0=PosXYZ ori=Orientation
left 90 fd shortcutgraphics::width/2 right 90
PenDown
PolyStart
setTexXY 0 shortcutgraphics::texy fd len*shortcutgraphics::size right 90
setTexXY 1 shortcutgraphics::texy fd shortcutgraphics::width right 90
setTexXY 1 :texo fd len*shortcutgraphics::size right 90
setTexXY 0 :texo fd shortcutgraphics::width right 90
PolyEnd
PenUp
setPosXYZ :p0 setOrientation :ori
fd len*shortcutgraphics::size
st
end
to r angle radius
ht
arc2t angle radius*shortcutgraphics::size
st
end
to l angle radius
ht
arc2t -angle -radius*shortcutgraphics::size
st
end
to arc2t angle radius
local [w p0 p1 p2 p3 p4 ori texo]
w= -shortcutgraphics::width ;*signum radius
PenUp right 90 fd radius left 180
fd radius+:w/2 p1=PosXYZ
back :w p4=PosXYZ
back radius-:w/2
for [phi angle/20 angle angle/20]
[ right angle/20
; fd radius setTexXY xCor/10 zCor/10 back radius
texo=shortcutgraphics::texy
shortcutgraphics::texy=shortcutgraphics::texy+abs (pi/180)*(angle/20)*radius/10
fd radius+:w/2 p2=PosXYZ
back :w p3=PosXYZ
back radius-:w/2
p0=PosXYZ ori=Orientation
SetPosXYZ :p1
PenDown
PolyStart
setTexXY 1 :texo setPosXYZ :p1
setTexXY 1 shortcutgraphics::texy setPosXYZ :p2
setTexXY 0 shortcutgraphics::texy setPosXYZ :p3
setTexXY 0 :texo setPosXYZ :p4
PolyEnd
PenUp
setPosXYZ :p0 setOrientation :ori
p1=:p2
p4=:p3
]
pu fd radius rt 90 pd
end