add optimized iteration algorithm
This commit is contained in:
parent
c79412bdab
commit
a2d5e86188
@ -67,15 +67,15 @@ uint32_t Mandelbrotc::mandelbrot(const Vec2mp &n)
|
|||||||
// y.setValue(0.0);
|
// y.setValue(0.0);
|
||||||
|
|
||||||
mpreal x = mpreal(0.0);
|
mpreal x = mpreal(0.0);
|
||||||
mpreal xtemp = mpreal(0.0);
|
|
||||||
mpreal y = mpreal(0.0);
|
mpreal y = mpreal(0.0);
|
||||||
mpreal x2 = mpreal(0.0);
|
mpreal x2 = mpreal(0.0);
|
||||||
mpreal y2 = mpreal(0.0);
|
mpreal y2 = mpreal(0.0);
|
||||||
|
|
||||||
while (x*x + y*y <= 4 && iter < max_iter) {
|
while (x2 + y2 <= 4 && iter < max_iter) {
|
||||||
xtemp = x*x - y*y + n.x;
|
y = 2.0 * x * y + n.y;
|
||||||
y = 2*x*y+n.y;
|
x = x2 - y2 + n.x;
|
||||||
x = xtemp;
|
x2 = x * x;
|
||||||
|
y2 = y * y;
|
||||||
|
|
||||||
iter++;
|
iter++;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user