here is something to play with, a first attempd at a curved hilbert curve. i had to rewrite arc2 to be able to do it. arc.fd.rt :angle :pos does what it names suggests for arc and angle positive it is just arc 2 for :angle negative it does an arc curved left and for negative size i just does the same thing it woul do forward in backward direction. 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 and here is the hilbert thing to hilbert.arc :size :level :par if :level = 0 [stop] arc.rt.fd -90 * :par :size hilbert.arc :size :level - 1 :par * -1 arc.rt.fd 90 * :par :size hilbert.arc :size :level - 1 :par hilbert.arc :size :level - 1 :par arc.rt.fd 90 * :par :size hilbert.arc :size :level - 1 :par * -1 arc.rt.fd -90 * :par :size end i am not yet sure if it is space filling but it is possible. but we can do a space filling smooth hilbert curve: we need 2 more procedures to wiggle :size :par rt 45 * :par arc.rt.fd -90 * :par :size / 2 arc.rt.fd 90 * :par :size / 2 lt 45 * :par end to bow :size :par rt 45 * :par arc.rt.fd -90 * :par :size rt 45 * :par end and NOW: the definitely square filling smooth hilbert curve to hilb.smooth :size :level :par if :level = 1 [ ~ rt 90 * :par wiggle :size -1 * :par ~ lt 90 * :par ~ bow :size :par ~ lt 90 * :par ~ wiggle :size :par ~ rt 90 * :par ~ stop ] rt 90 * :par hilb.smooth :size :level - 1 (-1 * :par) bow :size :par lt 90 * :par hilb.smooth :size :level - 1 :par bow :size -1 * :par hilb.smooth :size :level - 1 :par lt 90 * :par bow :size :par hilb.smooth :size :level - 1 (-1 * :par) rt 90 * :par end the problem is that arc2 90 4 already is a straight line and not a real arc. therefore wiggle 9 1 is the smallest wiggle we can draw. i smaller sizes, we will not get smooth curves. -- 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