[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LOGO-L> shells in spherical coordinates



;Hello Yehuda
;Here is the code you asked for, to fit in 180*180 pixels.
;Thanks for choosing it in your gallery.
;Best regards.
;Mhelhefny
;----------------
to go
cs ht pu setsc 0 
setpc [0 0 128]
perspective
sphere2 45 sphere1 70
shade 80 160 30
end

to shade :c :d :e
ask -3 [setxyz :c :d :e]
polyview
end

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

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

to sppos :r :fi :theta
setxyz :r*(sin :theta)*cos :fi :r*cos :theta :r*(sin :theta)*sin :fi 
end
;-----------------
---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org.  Mail
questions about the list administration to logofdn@gsn.org.  To
unsubscribe send    unsubscribe logo-l    to majordomo@gsn.org.



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home