xxxxxxxxxx
// Gumowski-Mira Strange Attractor
int iterations;
double a;
double b;
double m;
double step = 0.0001;
void setup() {
size(768, 576, P2D);
colorMode(RGB);
smooth();
frameRate(5);
iterations = 50000;
a = 0.000001;
b = 0.05;
m = -0.080;
strokeWeight(1);
}
void draw() {
double xn, yn;
double x0, y0;
x0 = 5.0;
y0 = 5.0;
m+=step;
background(255, 255, 255);
stroke(color(0, 0, 0, 50));
// fill(color(0,0,0, 50));
for (int i = 0; i < iterations; i++) {
xn = y0 + (a * (1.0 - (b * y0 * y0)) * y0) + mira(x0);
yn = -x0 + mira(xn);
if (isNaN(xn) || isNaN(yn)) {
print("x:" + xn + ", " + "y:" + yn);
break;
}
// print("x:" + xn + ", " + "y:" + yn);
ellipse((float)(20 * xn + 384) , (float)(20 * yn + 288) , 1, 1);
x0 = xn;
y0 = yn;
}
// noLoop();
}
double mira(double x) {
double xx = x * x;
return (m * x) + ((2.0 * (1.0 - m) * xx) / (1.0 + xx));
}