LOGO-L> 3 d extensions to UCBLogo

Quote:

> ;------------------------------------------------------

> to cylinder1 :xyz :a :b

> for [fi 0 360 20][for [y 0 :a 20][cyly :xyz :b :fi :y pd]pu]

> end

> to cylinder2 :xyz :a :b

> for [y 0 :a 20][for [fi 0 360 20][cyly :xyz :b :fi :y pd]pu]

> end

> to cyly :xyz :r :fi :y

> ;a revised procedure for cylindrical coordinates.

> make "x1 item 1 :xyz make "y1 item 2 :xyz make "z1 item 3 :xyz

> setxyz :x1+ :r*cos :fi :y1+ :y :z1+ :r*sin :fi

> end

> to go

> cs ht pu

> cylinder1 [0 0 0] 200 100

> cylinder2 [0 0 0] 200 100

> end

> to setxyz :a :b :c

> ;this is the proposed library procedure.

> setxy (:a- :c)*cos 30 :b- (:a+ :c)*sin 30

> end

If we remove redundant commands from the above program, and arrange it a

little bit, we have:

========================================

to main ; cylinder

cs ht

cylinder1 100 50

cylinder2 100 50

end

to cylinder1 :a :b

for[fi 0 360 10][

for[y 0 :a 20][

cyli 0 :y 0 :b :fi pd]pu]

end

to cylinder2 :a :b

for[y 0 :a 10][

for[fi 0 360 20][

cyli 0 :y 0 :b :fi pd]pu]

end

to cyli :x :y :z :r :fi

; procedure for cylindrical coordinates

setxyz :x+:r*cos :fi :y+:y :z+:r*sin :fi

end

to setxyz :a :b :c ; library procedure

setxy(:a-:c)*cos 30 :b-(:a+:c)*sin 30

end

========================================

Regards...

[[Yehuda]]

---------------------------------------------------------------