
February 1st, 2013, 05:15 PM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 1
Time spent in forums: 7 m 29 sec
Reputation Power: 0
|
|
|
How does we do the twindragon fractal ?
Hi all  !
I'm coding for the twindragon fractal but I don't succeed in it. That's why I'm searching for ur help. Can you help me please ?
This is what I did :
Code:
var n = 8; var l = 5; var angle = 120 * Math.PI / 180; c.translate(300, 200); dragon(n); function dragon(n) { if (n <= 1) { drawLine(l); } else { dragon(n-1); c.rotate(angle); dragon(n-1); c.rotate(-angle); dragon(n-1); } } function drawLine(l) { c.beginPath(); c.moveTo(0, 0); c.lineTo(l, 0); c.stroke(); c.translate(l, 0); }
But it seems to be like the terdragon, not the twindragon  !
|