PDA

View Full Version : Fractal Along Tangent



nugget
February 5th, 2006, 02:06 AM
I made a fratal generator a few weeks ago, this is v2. Instead of lines being duplicated, circles are and moved across a tangent line. It is a 25 Line script.

Here you go

createEmptyMovieClip("spiral", 400)._alpha = 20;
MovieClip.prototype.drawCircle = function(x, y, radius) {
var r = radius;
var cr = radius/Math.cos((45*(Math.PI/180))/2);
var angle = 0;
var cangle = -(45*(Math.PI/180))/2;
this.moveTo(x+r, y);
for (var i = 0; i<8; i++) {
angle += (45*(Math.PI/180));
cangle += (45*(Math.PI/180));
this.curveTo(x+(cr*Math.cos(cangle)), y+(cr*Math.sin(cangle)), x+(r*Math.cos(angle)), y+(r*Math.sin(angle)));
}
};
update();
onMouseDown = function() {
update();
};
function update() {
spiral.clear();
spiral.lineStyle(9, 0x000000, 80);
spiral.drawCircle(Math.random()*100-50, Math.random()*100-50, Math.random()*15);
spiral.drawCircle(Math.random()*100-50, Math.random()*100-50, Math.random()*15);
spiral.drawCircle(Math.random()*100-50, Math.random()*100-50, Math.random()*15);
for (var i = 0; i<360; i++) {
duplicateMovieClip("spiral", "s"+i, i);
_root["s"+i]._x = _root["s"+i]._rotation=i;
_root["s"+i]._y = 50*Math.tan(i*(Math.PI/180))+300;
}
}

bigmtnskier
February 5th, 2006, 02:14 AM
Looks nice. :)

But argh... It is not a fractal.

Term coined by Benoit Mandelbrot, refers to identical or similar shapes on ever decreasing scales. Branches of trees are natural fractals as are bays and coves of coastlines. Mathematical fractals are closer to identical.
http://www.google.com/search?hs=EoI&hl=en&lr=&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&q=define%3Afractal&btnG=Search
What is up with people calling everything that is duplicated a fractal now :(
Another example: http://www.kirupa.com/forum/showthread.php?t=207765&page=2&highlight=fractals

nugget
February 5th, 2006, 09:04 AM
I know it isn't calles a fractal, but i have no idea what its real name is. So i just put "fractal" so whats its real name anyway? and ill update my post to say it.

thanks for the feedback too

DarkStreet
February 5th, 2006, 03:06 PM
Very nice. Has anybody redone the Lorenz attractor code for AS? Would be interesting to see as it's in conjuntion with the Butterfly Effect.

DarkStreet
February 5th, 2006, 03:32 PM
Nevermind, did it myself:


this.createEmptyMovieClip("lorenz_mc", 1);
lorenz_mc.lineStyle(1, 0xFF0000, 100);
var count:Number = 0;
var theX:Number = 0;
var theY:Number = 20;
var theZ:Number = 20;
this.onEnterFrame = function() {
count++;
theX = theX+0.01*(-10*theX+10*theY);
theY = theY+0.01*(28*theX-theY-theX*theZ);
theZ = theZ+0.01*(-8*theZ/3+theX*theY);
if (count == 1) {
lorenz_mc.moveTo(theX*10+250, -theZ*10+500);
} else {
lorenz_mc.lineTo(theX*10+250, -theZ*10+500);
}
};

bigmtnskier
February 5th, 2006, 03:48 PM
@DarkStreet: No thread hijacking please.

You can make your own thread for your lorenz attractor :)

DarkStreet
February 5th, 2006, 04:09 PM
I apologise, it was not my intention to hijack the thread, merely to post my code in a thread on a related topic.

I must admit, the overall feel of these forums is very hostile.

bigmtnskier
February 5th, 2006, 04:43 PM
I apologise, it was not my intention to hijack the thread, merely to post my code in a thread on a related topic.

I must admit, the overall feel of these forums is very hostile.

Sorry if I seemed hostile :( I didn't mean to be.. Please forgive me =)

I'm sure you had good intentions and I'm sorry for jumping on you like that. Though, you still could make a thread in "Source and Experiments" so we can all give you positive comments on your lorenz attractor :hugegrin: