-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestFractal.java
47 lines (39 loc) · 973 Bytes
/
TestFractal.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* Test fractal for experimenting with different formulas.
*
* @author Samuel Lieberman
*
*/
public class TestFractal implements RecursiveFractal {
private static final Complex START_POS = new Complex(0, 0);
private static final double DIVERGE_RADIUS = 2;
@Override
public Complex start(Complex initial) {
return ImMath.ZERO;
}
@Override
public Complex step(Complex c, Complex initial) {
//return ImMath.add(ImMath.mult(c, c), initial);
return ImMath.add(ImMath.pow(c, 2.1), initial);
}
@Override
public boolean diverges(Complex c, int iterations) {
return c.r() > DIVERGE_RADIUS;
}
@Override
public String getName() {
return "test fractal";
}
@Override
public String getFormula() {
return "Z_n+1 = (Z_n)^2.1 + C";
}
@Override
public Complex getInitialScreenCenter() {
return START_POS;
}
@Override
public double getInitialScreenDiameter() {
return DIVERGE_RADIUS*2;
}
}