;Hello Everybody !
;This is the revised code for a spiral which I recommended for Yehuda's Galary.
;The code of my previous post took 25 seconds on my 166 Mhz pentium;now it
;takes only 11 seconds. This is achieved by:
;1- increasing the step from 12 to 15
;2- eliminating the fourth side of the square befor polyend(the polygon
;need not to be a closed one).
;You can do the same in all my previous posts
;Best Regards
;Mhelhefny
;---------------
to go
cs ht setsc 0
perspective
setpc [0 0 128]
grid 12 grid1 12
shade 250 80 20
polyview
end
to grid :step
for [x 0 360 :step][for [z 0 500 :step][
polystart pd
setxyz x y z
make "x :x+ :step setxyz x y z
make "z :z+ :step setxyz x y z
make "x :x- :step setxyz x y z
;make "z :z- :step setxyz x y z
polyend
]pu]
end
to grid1 :step
for [x 0 360 :step][for [z 0 580 :step][
polystart pd
setxyz x1 y z1
make "x :x+ :step setxyz x1 y z1
make "z :z+ :step setxyz x1 y z1
make "x :x- :step setxyz x1 y z1
;make "z :z- :step setxyz x1 y z1
polyend
]pu]
end
to shade :f :g :h
ask -3[setxyz :f :g :h]
polyview
End
to x
op :x*(sin :z)/6
end
to x1
op 130 *(sin :x)/6
end
to y
op -80+ :z/6
end
to z
op :x*(cos :z)/6
end
to z1
op 130*(cos :x)/6
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