Here’s my first program - a Pickover attractor.

//Definition //xn+1 = sin(a yn) + c cos(a xn) //yn+1 = sin(b xn) + d cos(b yn) //where a, b, c, d are variabies that //define each attractor. void setup(){ size(700,600); translate(width/2,height/2); background(0,0,33); noStroke(); }

float x = 0; float y = 0; float a = -1.4; float b = 1.6; float c = 1.0; float d = 0.7; float newx = 0; float newy = 0; void draw(){ for(float z = 1; z < 100; z++){ fill(100,100,100,10); ellipse(170*x+width/2-40,170*y+height/2-20,3 ,3); newx = sin(a*y) + c*cos(a*x); newy = sin(b*x) + d*cos(b*y); x = newx; y = newy; } }

## No comments:

## Post a Comment