Hilbert Curve
#1
Code:
SCREEN _NEWIMAGE(1366, 768, 8)
LINE (0, 0)-(0, 0)
Hilbert 8, 3, 2
SUB Hilbert (depth AS INTEGER, dx AS SINGLE, dy AS SINGLE)
_DELAY .001
IF depth > 1 THEN Hilbert depth - 1, dy, dx
LINE -STEP(dx, dy), _RGB(255, 127, depth * 9)
IF depth > 1 THEN Hilbert depth - 1, dx, dy
LINE -STEP(dy, dx), _RGB(255, depth * depth, depth * 10)
IF depth > 1 THEN Hilbert depth - 1, dx, dy
LINE -STEP(-dx, -dy), _RGB(255, 127, depth * 11)
IF depth >= 0 THEN Hilbert depth - 1, -dy, -dx
END SUB
Reply
#2
Tarnation varmint. That thar reminds me of our Loony Tunes theme song...

Hilbert Curve, code it right
This is it, the night of nights
No more re-coding and cursing our art
We know every line by heart
Hilbert Curve, code it right
This is it, we'll hit the heights
And oh what heights we'll hit
Codeguy is so full of **it. Shocked

- Sam Big Grin
Reply
#3
Hi codeguy, 

Interesting curve! I've played with it a couple of times trying to fill a rectangle instead of rhombus, no luck yet.
B += x
Reply