;Hello everybody
;here is a code to draw a tube whose shape is an 8
;best regards
;Mhelhefny
;-------------
to go
cs ht
make "c 1 make "a .2
perspective
grid
shade 200 50 10
end
to grid
for [t 0 360 10][for [u 0 360 10][
polystart pd
s
make "t :t+10 s
make "u :u+10 s
make "t :t-10 s
polyend]pu]
end
to len
op sqrt (sin :t)*(sin :t) + (cos 2* :t)*(cos 2* :t)
end
to shade :f :g :h
ask -3[setxyz :f :g :h]
polyview
End
to s
setxyz x*150 y*150 z*150
end
to x
op (:c* cos :t)*(sin :t) + ((:a* sin :u)*(sin :t))/ len
end
to y
op :a* :c* cos :u
end
to z
op cos :t + (:a* :c* (sin :u)*cos(2* :t))/ len
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