This is a formula I found initially through a program for the iPad called Frax...
They use a Line Average coloring algorithm... I googled it and found this.
I have no clue how to program it into UF, so I was hoping to find someone here that did know how...
float xmin = -2.5;
float ymin = -2.0;
float wh = 4;
float stripes = 5.0;
int maxIterations = 1000;
void setup() {
size(800, 800, P2D);
}
void draw() {
loadPixels();
float xmax = xmin+wh;
float ymax = ymin+wh;
float dx = (xmax-xmin)/width;
float dy = (ymax-ymin)/height;
float x = xmin;
for (int i = 0; i < width; i++) {
float y = ymin;
for (int j = 0; j < height; j++) {
float zr = x;
float zi = y;
float lastzr = x;
float lastzi = y;
float orbitCount = 0;
int n = 0;
while (n < maxIterations) {
float zrr = zr*zr;
float zii = zi*zi;
float twori = 2*zr*zi;
zr = zrr-zii+x;
zi = twori+y;
if (zrr+zii > 10000) break;
orbitCount += 0.5+0.5*sin(stripes*atan2(zi, zr));
lastzr = zr;
lastzi = zi;
n++;
}
if (n == maxIterations) pixels[i+j*width] = 0;
else {
float lastOrbit = 0.5+0.5*sin(stripes*atan2(lastzi, lastzr));
float smallCount = orbitCount-lastOrbit;
orbitCount /= n;
smallCount /= n-1;
float frac = -1+log(2.0*log(10000))/log(2)-log(0.5*log(lastzr*lastzr+lastzi*lastzi))/log(2);
float mix = frac*orbitCount+(1-frac)*smallCount;
float orbitColor = mix*255;
pixels[i+j*width] = color(orbitColor);
}
y += dy;
}
x += dx;
}
updatePixels();
noLoop();
}
This is a formula I found initially through a program for the iPad called Frax...
They use a Line Average coloring algorithm... I googled it and found this.
I have no clue how to program it into UF, so I was hoping to find someone here that did know how...
````
float xmin = -2.5;
float ymin = -2.0;
float wh = 4;
float stripes = 5.0;
int maxIterations = 1000;
void setup() {
size(800, 800, P2D);
}
void draw() {
loadPixels();
float xmax = xmin+wh;
float ymax = ymin+wh;
float dx = (xmax-xmin)/width;
float dy = (ymax-ymin)/height;
float x = xmin;
for (int i = 0; i < width; i++) {
float y = ymin;
for (int j = 0; j < height; j++) {
float zr = x;
float zi = y;
float lastzr = x;
float lastzi = y;
float orbitCount = 0;
int n = 0;
while (n < maxIterations) {
float zrr = zr*zr;
float zii = zi*zi;
float twori = 2*zr*zi;
zr = zrr-zii+x;
zi = twori+y;
if (zrr+zii > 10000) break;
orbitCount += 0.5+0.5*sin(stripes*atan2(zi, zr));
lastzr = zr;
lastzi = zi;
n++;
}
if (n == maxIterations) pixels[i+j*width] = 0;
else {
float lastOrbit = 0.5+0.5*sin(stripes*atan2(lastzi, lastzr));
float smallCount = orbitCount-lastOrbit;
orbitCount /= n;
smallCount /= n-1;
float frac = -1+log(2.0*log(10000))/log(2)-log(0.5*log(lastzr*lastzr+lastzi*lastzi))/log(2);
float mix = frac*orbitCount+(1-frac)*smallCount;
float orbitColor = mix*255;
pixels[i+j*width] = color(orbitColor);
}
y += dy;
}
x += dx;
}
updatePixels();
noLoop();
}
````