Hilbert Curves

The figure below illustrates the recursive rules that are used to construct the Hilbert Curves.

The first rule means:

  1. To draw A(1),
    1. draw D(0) (which is just a point),
    2. draw a line one unit to the left,
    3. draw A(0) (which is just a point),
    4. draw a line one unit down,
    5. draw A(0) (which is just a point),
    6. draw a line one unit to the right,
    7. draw B(0) (which is just a point).
  2. To draw A(2),
    1. draw D(1),
    2. draw a line one unit to the left,
    3. draw A(1),
    4. draw a line one unit down,
    5. draw A(1),
    6. draw a line one unit to the right,
    7. draw B(1).
  3. ...
  4. To draw A(n),
    1. draw D(n-1),
    2. draw a line one unit to the left,
    3. draw A(n-1),
    4. draw a line one unit down,
    5. draw A(n-1),
    6. draw a line one unit to the right,
    7. draw B(n-1).