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

LOGO-L> using cylindrical coordinates in 3d



;Hello George Mills
;here is the another way to draw a sphere using cylinderical co-
;ordinates.
;This method uses the procedure cylpos to set position in cylindrical
;co-ordinates ,i.e r fi y.In this case for each value of :r and :f the
;corresponding y is calculated by the simple procedure y since
;r^2+y^2 =a^2 where a is the radius of the sphere.
;---------------------------------------------------
to cylpos :r :fi :y
;this is a library procedure for cylinderical co-ordinates
setxyz :r*cos :fi :y :r*sin :fi
end

to go
turnon3d 
sphere 200
end

to sphere :a
for [r -:a :a 10][for[fi 0 360 10][cylpos :r :fi y pd]pu]
end

to turnon3d
; This is a library procedure for 3-d
perspective
setturtle -1  
setxyz 1000 1000 1000
setturtle 0 cs ht
end

to y
ifelse :r >0 [op sqrt (:a* :a - :r* :r)][op -sqrt(:a* :a - :r* :r)]
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