Here's another "mathematical" approach to drawing a circular spiral. It utilizes polar coordinates.
The polar presentation of the so called Archimedes Spiral is:
rho = a * theta
a being some constant, rho is the radius-vector.
Here's my program:
to main ; Archimedes Spiral
cs ht pu
polar 0 .03 5
end
to polar :theta :a :loops
if :theta>:loops*360[stop]
setheading :theta
fd RadiusVector setpixel 4
home
polar :theta+.5 :a :loops
end
to RadiusVector
op :a*:theta
end
Please note, that the whole program is done with PENUP. It is in MSWLogo.
For other Logos, replace setpixel 4 by pd fd 0 pu or what you have
for drawing a single dot.
I thank George for encouraging me to post this polar solution.
Regards...
[[Yehuda]]
_/
_/ _/ _/_/_/_/_/ _/_/_/_/
_/
_/ _/_/ _/
_/
_/_/_/
_/ _/ _/ _/
_/ _/
_/_/_/_/ _/ _/
_/
_/_/ _/ _/ _/_/_/_/
http://www.geocities.com/CollegePark/lab/2276/
e-mail: yehuka@beitberl.ac.il
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