Draw the Hilbert Curve A Hilbert Curve is a type of space-filling curve, and it basically maps a line to a plane. Each point in the line corresponds to just one point in the plane, and each point in the plane corresponds to just one point on the line. Shown are iterations 0 through 4 of the Hilbert Curve:

Iterations 0 up to 4:







The objective of this task: Write code that draws the fourth iteration of the Hilbert Curve, as defined above. Your code should be complete - in other words, if you create a function to draw the Hilbert Curve, your code must call that function. The output can either be displayed directly on the screen, or you can write the output to an image file. The curve may be rotated or flipped, but lines must intersect at right angles and the output cannot be stretched. ASCII art is appreciated but will not be accepted. Shortest code in bytes wins!
MATL, 39 38 bytes
O5:&quot;tZjJ*JQ-wJq+t2+&amp;y2j+_v2/]XG25Y01ZG

This takes the number of iterations as input. If you want to hard-code it, replace i by the number.
The program is a port of the Matlab code by Jonas Lundgren shown here.
The result is shown below. You can also try it at MATL Online! It takes a couple of seconds to produce the output. This compiler is experimental; you may need to refresh the page and press &quot;Run&quot; again if it doesn't initially work.

Explanation
O          % Push 0. This is the initial value of &quot;z&quot; in the original code
5:&quot;        % Do 5 times
  t        %   Duplicate
  Zj       %   Complex conjugate
  J*       %   Multiply by 1j (imaginary unit). This is &quot;w&quot; in the original code
  JQ-      %   Subtract 1+1j
  w        %   Swap: brings copy of &quot;z&quot; to top
  Jq+      %   Add 1-1j
  t        %   Duplicate
  2+       %   Add 2
  &amp;y       %   Duplicate the third element from top
  2j+_     %   Add 2j and negate
  v        %   Concatenate the three matrices vertically
  2/       %   Divide by 2
]          % End
XG         % Plot (in complex plane). The numbers are joined by straight lines
25Y0       % Push string 'square'
1ZG        % Make axis square