;Hello Everybody !
;Here is a code to draw 8 surfaces of rotation,which are best suited
;to the use of cylindrical coordinates (library proc. cylpos).
;it is only 1 kb thanks to MswLogo.
;Best regards.
;Mhelhefny
;------------------
to cylpos :r :fi :y
;lib proc for cylindrical coordinates
setxyz :r*cos :fi :y :r*sin :fi
end
to go
cs ht setsc 0
perspective
setpc [0 0 128]
for [i 1 8][cs grid 70 :i shade 150 30 10 wait 90]
end
to grid :a :i
for [fi 0 360 9][for [r -:a :a 10][
polystart pd
cylpos :r :fi run word "y :i
make "r :r+ 10 cylpos :r :fi run word "y :i
make "fi :fi+ 10 cylpos :r :fi run word "y :i
make "r :r- 10 cylpos :r :fi run word "y :i
make "fi :fi- 10 cylpos :r :fi run word "y :i
polyend
pd]pu]
end
to shade :f :g :h
ask -3[setxyz :f :g :h]
polyview
End
to y1
op :r* :r/40
end
to y2
op ifelse :r >0 [15*sqrt(:r)][-15*sqrt(-:r)]
end
to y3
op ifelse :r >0 [sqrt (:a* :a)+(:r* :r)][-sqrt (:a* :a)+(:r* :r)]
end
to y4
op :r*2
end
to y5
op (:r+ :a/4)*cos :r*3
end
to y6
op 40+ (:fi *cos(:r + :a*2))/3
end
to y7
op (5e2*sin 15* :r)/(:r+ 3e-3)
end
to y8
op (5e4*sin 17* :r)/(:r* :r + 2e-5)
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