What Links Here?
Outbound Links
Dragon Curve
The Dragon Curve or Dragon Fractal is a nifty little shape!
Here are the first 12 iterations. You see the dragon shape begin to emerge. I've put a red dot before each one, so you can see how it doesn't always go forward right away.
;export dragon to dragon :count :length :angle ifelse :count = 0 [ fw :length ] [ ifelse (:angle = 1) [ rt (45 * :angle) dragon (:count -1) :length / sqrt(2) :angle lt 90 * :angle dragon (:count -1) :length / sqrt(2) (:angle * (0-1)) rt (45 * :angle) ] [ rt (45 * :angle) dragon (:count -1) :length / sqrt(2) (:angle * (0-1)) lt 90 * :angle dragon (:count -1) :length / sqrt(2) (:angle) rt (45 * :angle) ] ] end
;import dragon to dot color [250 0 0] circle 1 color [0 0 0] end setxy 40 40 dot dragon 0 70 1 setxy 150 40 dot dragon 1 70 1 setxy 260 40 dot dragon 2 70 1 setxy 40 140 dot dragon 3 70 1 setxy 150 140 dot dragon 4 70 1 setxy 260 140 dot dragon 5 70 1 setxy 40 240 dot dragon 6 70 1 setxy 150 240 dot dragon 7 70 1 setxy 260 240 dot dragon 8 70 1 setxy 40 340 dot dragon 9 70 1 setxy 150 340 dot dragon 10 70 1 setxy 260 340 dot dragon 11 70 1
The "TwinDragon" is achievable by drawing two dragons, one after the other, with a 180 degree turn in the middle. They fit snugly together, or as Mathematicians says, they 'tile the plane'.
;import dragon to twin_dragon :count :length :color1 :color2 color :color1 ;(000 000 200) dragon :count :length 1 rt 180 color :color2 ;(200 000 200) dragon :count :length 1 rt 180 pu dragon 1 :length 1 pd end repeat 5 [ twin_dragon 10 70 (000 000 200) (200 000 200) twin_dragon 10 70 (000 200 000) (200 000 000) ]