What Links Here?
Outbound Links
Hilbert Curve
Perhaps the best known Space Filling Curve is the Hilbert Curve.
to hilbert :count :size :angle if :count > 0 [ rt 90*:angle hilbert (:count - 1) :size (:angle * (0-1) ) fd :size rt 90*:angle * (0-1) hilbert (:count - 1) :size :angle fd :size hilbert (:count - 1) :size :angle rt 90*:angle * (0-1) fd :size hilbert (:count - 1) :size (:angle * (0-1) ) rt 90*:angle ] end hilbert 1 (2*63/1) (1) fd (63/1) hilbert 2 (2*63/3) (1) fd (63/3) hilbert 3 (2*63/7) (1) fd (63/7) setxy 10 150 hilbert 4 (2*63/15) (1) fd (63/15) hilbert 5 (2*63/31) (1) fd (63/31) hilbert 6 (2*63/63) (1)
Let's see how it looks with a bevel on each corner. I'm going to replace all calls to 'rt' (right turn) with a new function, rti, which "cuts" the corner.
to rti :angle :size rt :angle/2 fd :size/(4*sqrt(2)) rt :angle/2 end to hilbert :count :size :angle if :count > 0 [ rti 90*:angle :size hilbert (:count - 1) :size (:angle * (0-1) ) fd :size*(2/4) rti 90*:angle * (0-1) :size hilbert (:count - 1) :size :angle fd :size*(2/4) hilbert (:count - 1) :size :angle rti 90*:angle * (0-1) :size fd :size*(2/4) hilbert (:count - 1) :size (:angle * (0-1) ) rti 90*:angle :size ] end hilbert 1 (2*63/1) (1) fd (63/1) hilbert 2 (2*63/3) (1) fd (63/3) hilbert 3 (2*63/7) (1) setxy 10 150 fd (63/7) hilbert 4 (2*63/15) (1) fd (63/15) hilbert 5 (2*63/31) (1) fd (63/31) hilbert 6 (2*63/63) (1)
External Links
See Also
- Space Filling Curves (includes the Peano curve)
- Flowsnake (the Peano-Gosper curve)
- Dragon curve