13 December 2010

Peter de Joung attractor 01//////////////////////////////////


From this old post on Peter de joung attractor in Rhinoscript I started to work on a code in Processing, in order to create a simulation of this matemathical attractor with a huge amount of particles.

Different effects changing variables.

Here the script:


//code by Davide del giudice
//http://madeincalifornia.blogspot.com/
//Peter de joung attractor_101015

float x,y,xn,yn;
float a,b,c,d;
color bla;
float i=0;

void setup()
{
size (1000,1000);
//smooth();
frameRate(60);
bla= color(0,150,255);
//background(0);
x=0;
y=10;
a=1.4;
b=1.56;
c=1.4;
d=-6.56;

}
void draw()
{

background(0);
//stroke(0,90);
fill(175,40);
//c=3*cos(i);
//d=3*sin(i);
//a=3*cos(i);

for(float i=0;i<10000;i++)
{ xn=x; yn=y;
x=(d*sin(a*xn)-sin(b*yn));
y=(c*cos(a*xn)+cos(b*yn));
fill(0,150,255);
//ellipse(width/2+200*x,height*0.7+200*y,5,5);
set(int(width/2+200*x*mouseX/1000),int(height/1.5+200*y),bla);
i++;
}
}

0 commenti: