LOGO-L> curved hilbert curve 
Author Message
 LOGO-L> curved hilbert curve

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.

--

Computer Supported Didactics Working Group, Univ. Vienna
Visit our SunSITE at http://www.*-*-*.com/

---------------------------------------------------------------





Wed, 25 Oct 2000 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. LOGO-L> variations of Hilbert curve

2. LOGO-L> variations of hilbert curve

3. LOGO-L> Curve Stitching with Logo

4. 3D Hilbert or Peano curves ?

5. Hilbert Curve

6. Hilbert Curves Drawing Proc

7. Fractals,spline curves,bezier curves

8. LOGO-L>curve plot

9. LOGO-L> Curve Stitching

10. LOGO-L> Re: Recursive curve mania

11. LOGO-L> Recursive curve mania

12. LOGO-L> Re: pursuit curve tiling

 

 
Powered by phpBB® Forum Software