LOGO-L> 3d code for a cone and a sphere in UCBLogo 
Author Message
 LOGO-L> 3d code for a cone and a sphere in UCBLogo

;Hello Brian Harvey
;Here is the code for a Cone and a SPHERE written in UCBLogo
;to show 3-d isometric view. I used cylinderical coordinates
;for the cone and spherical coordinates for the sphere.
;In both codes the same library procedure setxyz is used.
;Best Regards
;Mhelhefny

;-----------------------------------------

;the CONE in cylinderical coordinates

to cylinder1 :xyz :a :b
for [fi 0 360 20][for [y 0 :a 20][cyly :xyz :y/ 2 :fi 200- :y pd]pu]
end

to cylinder2 :xyz :a :b
for [y 0 :a 20][for [fi 0 360 20][cyly :xyz :y/ 2 :fi 200- :y pd]pu]
end

to cyly :xyz :r :fi :y
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
;library procedure
setxy (:a- :c)*cos 30 :b- (:a+ :c)*sin 30
end

;------------------------------------------------

;the SPHERE in spherical coordinates.

to go
cs ht pu
sphere1 150 sphere2 150
end

to setxyz :a :b :c
;library procedure
setxy (:a- :c)*cos 30 :b- (:a+ :c)*sin 30
end

to sphere1 :a
for [theta 0 180 10][for [fi 0 360 10][sppos :a :fi :theta pd]pu]
end

to sphere2 :a
for [fi 0 360 10][for [theta 0 180 10][sppos :a :fi :theta pd]pu]
end

to sppos :r :fi :theta
;this could be a library procedure for sphirical co-ordinates
setxyz :r*(sin :theta)*cos :fi :r*cos :theta :r*(sin :theta)*sin :fi  
end
;-------------------------------------------------
---------------------------------------------------------------





Tue, 25 Apr 2000 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. LOGO-L> UCBLogo code for 3d sphere and cone

2. LOGO-L> 3d isometric code in UCBLogo

3. LOGO-L> 3d extensions to UCBLogo

4. LOGO-L> 4methods to draw a Sphere

5. LOGO-L> sphere or Christmas bulb

6. LOGO-L> Sphere or bulb

7. LOGO-L> 3D - Logo For Beginners

8. LOGO-L> 3d-logo -cosinudid

9. LOGO-L> GUI for UCBLogo

10. LOGO-L> About UCBlogo

11. LOGO-L> pure glass shapes in UCBLogo

12. LOGO-L> About UCBlogo

 

 
Powered by phpBB® Forum Software