import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.applet.*; import java.awt.geom.*; import java.math.*; /**This class generates the arithmetic graph.**/ public class ArithmeticGraph { Manager M; public ArithmeticGraph() {} public ArithmeticGraph(Manager MM) { this.M=MM; } /**Here is the final routine**/ public GeneralPath orbit(int i,int j) { Complex Z0=new Complex(3.5,2); int choice=i; int power=M.C.INIT.val; int type=-1; int lim=(int)(Math.pow(3,10)); return(orbit(Z0,choice,power,lim)); } public GeneralPath orbit(Complex Z0,int choice,int power,int lim) { Complex Z1=new Complex(Z0); for(int i=0;i0) return(0); return(1); } /**The dynamical map**/ public Complex nextPoint1(Complex z) { int n=PolyData.getNumber(z); Complex w=PolyData.getGraph(1,n); w=Complex.plus(w,z); return(w); } /**chooses either G2 or G3**/ public Complex nextPoint(int choice,Complex z,Complex p1,int parity,double ss) { if(choice==2) return(nextPoint2(z,p1,parity,ss)); return(nextPoint3(z,p1,parity,ss)); } /**The map for G2*/ public static Complex nextPoint2(Complex z,Complex p1,int parity,double ss) { int n=PolyData.getNumber(z); Complex w=PolyData.getGraph(2,n); w=new Complex(ss*w.x,ss*w.y); Complex p2=Complex.plus(p1,w); if(parity==1) p2=Complex.minus(p1,w); return(p2); } /**The map for G3*/ public static Complex nextPoint3(Complex z,Complex p1,int parity,double ss) { double x=Math.sqrt(2); Complex CENTER=new Complex(3.0/2+3*x/2,3.0/2); Complex zz=Complex.plus(CENTER,Complex.minus(CENTER,z)); int n=PolyData.getNumber(z); if(parity==1) n=PolyData.getNumber(zz); Complex w=PolyData.getGraph(3,n); w=new Complex(ss*w.x,ss*w.y); Complex p2=Complex.plus(p1,w); if(parity==1) p2=Complex.minus(p1,w); return(p2); } }