Anmeldung



- search -
Edit...

JSPWiki v2.2.28
 
Flood Mandelbrot Mandelbrot Calculator

Der Unterschied zwischen current version und current version:

[{Java2HtmlPlugin

public class MandelbrotCalculator {

public int width;
public int height;
public int[] fractalPixels;
public double[] zr;
public double[] zi;
public int[] iterationPixels;
public int iteration;
public Complex o = new Complex();
public Complex d = new Complex();

public synchronized void initFractalParameters() {
o=new Complex(2,2);
d=new Complex(4,4);
}

public synchronized void calculateOneIteration() {
double cr;
double ci;
double ab;
double z1r;
double z1i;
double zr2;
double zi2;
double boundary = 1e4;
iteration++;
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
int i = x+y*width;
cr=x*d.r/width-o.r;
ci=o.i-y*d.i/height;
zr2=zr[i]*zr[i];
zi2=zi[i]*zi[i];
ab=zr2+zi2;
if (ab<boundary) {
z1r=zr2-zi2+cr;
z1i=2*zr[i]*zi[i]+ci;
zr[i]=z1r;
zi[i]=z1i;
} else {
if (iterationPixels[i]==0) {
iterationPixels[i]=iteration;
}
}
}
}
Polar po = new Polar();
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
int i = x+y*width;
if (iterationPixels[i]==0) {
po.setComplex(zr[i],zi[i]);
fractalPixels[i]=Hsi2Rgb(po.w,1,(Math.PI+0.7F)*po.r);
} else {
double f = ((double)iterationPixels[i])/((double)iteration);
fractalPixels[i]=Color.HSBtoRGB(0F,1F,(float)f);
}
}
}
}

public void setDimensions(int pWidth, int pHeight) {
width = pWidth;
height = pHeight;
int size = width * height;
fractalPixels = new int[size];
zr = new double[size];
zi = new double[size];
iterationPixels = new int[size];
}

public static int rgbToInt(int r, int g, int b) {
return ((255 & 0xFF) << 24) | ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | ((b & 0xFF) << 0);
}

public synchronized void zoom(Complex center, double zoomFactor) {
d=new Complex(d.r/zoomFactor,d.i/zoomFactor);
o=new Complex(-center.r+d.r/2,center.i+d.i/2);
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
int i = x+y*width;
zr[i]=x*d.r/width-o.r;
zi[i]=o.i-y*d.i/height;
iterationPixels[i]=0;
}
}
iteration=0;
}

public void zoom(Point point, double zoomFactor) {
zoom(toGraphCoord(point),zoomFactor);
}

private Complex toGraphCoord(Point point) {
return new Complex(point.x*d.r/width-o.r,o.i-point.y*d.i/height);
}

public int Hsi2Rgb(double H, double S, double I) {
return Color.HSBtoRGB((float)H, (float)S, Math.abs((float)Math.sin(1/I)));
}

}
}]

Zurück zu Flood Mandelbrot Mandelbrot Calculator, or zur History der Seite.



Earthdawn (R) ist ein eingetragenes Warenzeichen der FASA Corporation. Barsaive (TM) ist ein Warenzeichen der FASA Corporation. Copyright (c) 2015 by FASA Corporation. Copyright der deutschen Ausgabe (c) 2015 by Ulisses Spiele GmbH, Waldems. www.ulisses-spiele.de. Diese Webseite unterliegt keiner Abnahme oder Genehmigung durch Ulisses Spiele oder FASA.