Gosper curve
From Wikipedia, the free encyclopedia
The Gosper curve, named after Bill Gosper, is a space-filling curve. It is a fractal object similar in its construction to the dragon curve and the Hilbert curve.
| Image:Gosper curve 3.png | Image:Gosper curve 1.png |
| A fourth-stage Gosper curve | The line from the red to the green point shows a single step of the Gosper curve construction. |
A Logo program to draw the Gosper curve:
to rg :st :ln make "st :st - 1 make "ln :ln / 2.6457 if :st > 0 [rg :st :ln rt 60 gl :st :ln rt 120 gl :st :ln lt 60 rg :st :ln lt 120 rg :st :ln rg :st :ln lt 60 gl :st :ln rt 60] if :st = 0 [fd :ln rt 60 fd :ln rt 120 fd :ln lt 60 fd :ln lt 120 fd :ln fd :ln lt 60 fd :ln rt 60] end to gl :st :ln make "st :st - 1 make "ln :ln / 2.6457 if :st > 0 [lt 60 rg :st :ln rt 60 gl :st :ln gl :st :ln rt 120 gl :st :ln rt 60 rg :st :ln lt 120 rg :st :ln lt 60 gl :st :ln] if :st = 0 [lt 60 fd :ln rt 60 fd :ln fd :ln rt 120 fd :ln rt 60 fd :ln lt 120 fd :ln lt 60 fd :ln] end
The program can be invoked, for example, with rg 4 300, or alternatively gl 4 300.

