here is a quite different approach
to the smooth square filling hilbert curve
;to see an example do
; hilb.curve 10 4
to arc.rt.fd :angle :size
if :angle = 0 [fd :size]
if :size = 0 [stop]
if and (:angle > 0) (:size > 0) [arc2 :angle :size stop]
if and (:angle > 0) (:size < 0) [arc2 -1 * :angle -1 * :size]
if and (:angle < 0) (:size > 0) [rt 180 arc2 :angle :size rt
180]
if and (:angle < 0) (:size < 0) [arc2 :angle -1 * :size]
end
to bow :size :par
arc.rt.fd -90 * :par :size
end
to bow.par.list :level
if :level = 1 [output [1]]
output (se map [-1 * ?] bow.par.list :level - 1 ~
1 ~
bow.par.list :level - 1 ~
-1 ~
bow.par.list :level - 1 ~
1 ~
map [-1 * ?] bow.par.list :level - 1)
end
to hilb.curve :size :level
wiggle :size first wiggle.par.list :level
(foreach bow.par.list :level ~
butfirst wiggle.par.list :level ~
[bow :size ?1 wiggle :size ?2])
end
to wiggle :size :par
arc.rt.fd -90 * :par :size / 2
arc.rt.fd 90 * :par :size / 2
end
to wiggle.par.list :level
if :level = 1 [output [-1 1]]
output (se map [-1 * ?] wiggle.par.list :level - 1 ~
wiggle.par.list :level - 1 ~
wiggle.par.list :level - 1 ~
map [-1 * ?] wiggle.par.list :level - 1 )
end
--
Erich Neuwirth <neuwirth@smc.univie.ac.at>
Computer Supported Didactics Working Group, Univ. Vienna
Visit our SunSITE at http://sunsite.univie.ac.at
---------------------------------------------------------------
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