1 package JSci.maths.chaos; 2 3 import JSci.maths.Complex; 4 5 10 public final class JuliaSet extends Object { 11 public final static Complex RABBIT=new Complex(-0.123,0.745); 12 public final static Complex SAN_MARCO=new Complex(-0.75,0.0); 13 public final static Complex SIEGEL_DISK=new Complex(-0.391,-0.587); 14 private final MandelbrotMap mbrot; 15 18 public JuliaSet(Complex c) { 19 mbrot=new MandelbrotMap(c); 20 } 21 25 public int isMember(Complex z,final int maxIter) { 26 for(int i=0;i<maxIter;i++) { 27 z=mbrot.map(z); 28 if(z.mod()>MandelbrotMap.CONVERGENT_BOUND) 29 return i+1; 30 } 31 return 0; 32 } 33 public int isMember(double zRe,double zIm,final int maxIter) { 34 final double cRe=mbrot.getConstant().real(); 35 final double cIm=mbrot.getConstant().imag(); 36 double tmp; 37 for(int i=0;i<maxIter;i++) { 38 tmp=2.0*zRe*zIm+cIm; 39 zRe=zRe*zRe-zIm*zIm+cRe; 40 zIm=tmp; 41 if(zRe*zRe+zIm*zIm>MandelbrotMap.CONVERGENT_BOUND*MandelbrotMap.CONVERGENT_BOUND) 42 return i+1; 43 } 44 return 0; 45 } 46 } 47 48 | Popular Tags |