import java.applet.Applet; import java.awt.event.*; import java.awt.*; import java.awt.geom.*; import java.util.Arrays; /**This class defines and manipulates the strips associated to a polygon**/ public class StripMap { public StripMap() {} /**Computes the position of a point relative to the strip.**/ public static double relStrip(PolyWedge P,int n,Complex u) { Complex[] X=Strips.stripData(P,n); Complex z1=X[0]; Complex z2=X[1]; Complex w1=X[2]; Complex w2=X[3]; double a1=Complex.area(z1,z2,u); double a2=Complex.area(z1,z2,w1); double a3=a1/a2; return(a3); } /**always a non-negative integer*/ public static int relStripIntegerAbs(PolyWedge P,int n,Complex u) { double a=relStrip(P,n,u); a=Math.abs(Math.floor(a)); int b=(int)(a); return(b); } /**same as previous, but signed integer**/ public static int relStripInteger(PolyWedge P,int n,Complex u) { double a=relStrip(P,n,u); a=Math.floor(a); int b=(int)(a); return(b); } /**This is the basic strip map. P is the polygon. n is the strip. u is the starting point **/ public static Complex map(PolyWedge P,int n,Complex u) { Complex[] X=Strips.stripData(P,n); Complex v=Complex.minus(X[3],X[1]); double a=relStrip(P,n,u); a=Math.floor(a); v=new Complex(a*v.x,a*v.y); Complex w=Complex.minus(u,v); return(w); } /**This is the N-fold composition of the strip map**/ public static Complex stripMap(PolyWedge P,Complex u,int start) { Complex z=new Complex(u); int N=2*P.count; for(int i=start+1;i<=N+start;++i) { z=map(P,P.slopes[i%N],z); } return(z); } /**This routine is used with the arithmetic graph computer**/ public static int[] arithmeticGraph(PolyWedge P,Complex u) { int N=2*P.count; int tor; int[] fin=new int[P.count]; Complex z=new Complex(u); for(int i=1;i<=N;++i) { tor=relStripInteger(P,P.slopes[i%N],z); int[] vec=Strips.stripVector(P,P.slopes[i%N]); for(int j=0;j