import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.applet.*; import java.awt.geom.*; import java.math.*; /**This class does the math for the outer billiards map*/ public class BilliardsMap { public BilliardsMap() {} /**This routine tests whether the point z is contained in the kth sector determined by a polygon**/ public static int testSector(PolyWedge P,Complex z,int k) { int k1=(k+0)%P.count; int k2=(k+1)%P.count; int k3=(k+2)%P.count; Complex z1=P.z[k1]; Complex z2=P.z[k2]; Complex z3=P.z[k3]; z3=new Complex(2*z2.x-z3.x,2*z2.y-z3.y); int test1=Complex.notNegativelyOriented(z,z1,z2); int test2=Complex.notNegativelyOriented(z,z2,z3); if((test1==0)&&(test2==0)) return(1); if((test1==0)&&(test2==1)) return(-1); if((test1==1)&&(test2==0)) return(-2); return(0); } /**This routine determines which sector a point lies in**/ public static int testSector(PolyWedge P,Complex z) { int test=-1; for(int i=0;i