So, I made a program that creates this cool fractal. Basically, this is how it works:
1). Start with 'XY'
2). Replace every X with X+YF+, and every Y with -FX-Y (so 'XY' becomes 'X+YF+-FX-Y' after one generation)
3). After a desired number of generations, remove all the X's and Y's from the resulting word and you should be left with F's, +'s and -'s.
4). Then start at a point and follow the directions like this: 'F' means move forward by one unit, '+' means rotate by 90 degrees clockwise, and '-' means rotate 90 degrees counterclockwise.
After following all the F's, +'s and -'s that remain, you get a cool image called the Heighway Dragon Curve:
Now, this above image draws a line one unite forward for every 'F'. If I instead draw an oval of a small radius, I get a smoother image that could be used as a topological map of sorts for games, etc...:
Subscribe to:
Post Comments (Atom)


Yea, I made a small mistake in the description. You actually start with 'X', not 'XY' when generating the curve. And obviously I recurse through the steps as opposed to generating a string of commands, as the language I used cannot support strings of length greater than 256 >_>....yea...
ReplyDelete