LOGO-L> 3 d extensions to UCBLogo
Author Message
LOGO-L> 3 d extensions to UCBLogo

;Hello Turtlers
;It was Exciting that George Mills has added 3-d exetensions to MSWLogo
;People tried to portray the visual world on a flat screen long befor
;the creation of computers.Generally there are several methods of
;representing 3-d objects on paper,the most famous are the following
;1: Oblique drawing
;2: Isometric drawing
;3: Perspective drawing
;Both oblique & isometric drawings portray an object by fixing the axis
;with respect to the horizontal.
;In oblique drawing the z axis has a consistent angle of 30 degrees to
;the x axis, both the x and y axis are the same at 90 degrees from each
;other.
;In isometric drawings the y axis remains vertical while both the x axis
;and the z axis are spaced 120 degrees from the vertical.
;While isometric drawing is superior to oblique;Only the perspective
;is the only truly accurate method of illustrating a real object.
;Two florentine architects Filippo Brunelleschi and Leon Batista Alberti
;developed the perspictive ideas in the fif{*filter*}th century.
;Now I had developped a single library procedure to add isometric
;capability to UCBLogo and to all similar 2-d Logos.
;Of course this is just a simple and trivial solution to the lack of
;real 3-d exetensions. However this simple approch clearly shows the
;real Beuty of the LOGO languge.
;I take the freedom to suggest the addition of this library procedure
;to Brian Harvey The creator of the wonderfull UCBLogo. to the regular
;library of UCBLogo.
;You will be astonished to know that all the code which I have posted
;during the past two monthes in MSWLogo and which George Mills was so
;kind to generate and attach there gif attachments, was run under UCBLogo
;using this lib. procedure.
;Here is the code to generate an isometric viewof a cylinder in cylindrical
;coordinates.
;In the following days I shall post the code for many many shapes in
;UCBLogo.
;Best Regards.
;Mhelhefni
;------------------------------------------------------
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
;---------------------------------------------------
---------------------------------------------------------------

Mon, 24 Apr 2000 03:00:00 GMT
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]]

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

Tue, 25 Apr 2000 03:00:00 GMT

 Page 1 of 1 [ 2 post ]

Relevant Pages

Powered by phpBB® Forum Software