1 package JSci.maths.chaos; 2 3 import JSci.maths.Complex; 4 5 10 public final class MandelbrotSet extends Object { 11 private final MandelbrotMap mbrot=new MandelbrotMap(Complex.ZERO); 12 15 public MandelbrotSet() {} 16 20 public int isMember(final Complex z,final int maxIter) { 21 mbrot.setConstant(z); 22 Complex w=Complex.ZERO; 23 for(int i=0;i<maxIter;i++) { 24 w=mbrot.map(w); 25 if(w.mod()>MandelbrotMap.CONVERGENT_BOUND) 26 return i+1; 27 } 28 return 0; 29 } 30 public int isMember(final double zRe,final double zIm,final int maxIter) { 31 double re=0.0,im=0.0; 32 double tmp; 33 for(int i=0;i<maxIter;i++) { 34 tmp=2.0*re*im+zIm; 35 re=re*re-im*im+zRe; 36 im=tmp; 37 if(re*re+im*im>MandelbrotMap.CONVERGENT_BOUND*MandelbrotMap.CONVERGENT_BOUND) 38 return i+1; 39 } 40 return 0; 41 } 42 } 43 44 | Popular Tags |