import java.util.ArrayList; public class Triskit{ int scale; int h,w; //height and width in terms of grip holes ArrayList boxArray; ArrayList edge; public Triskit(int nW, int nH, int nScale){ boxArray= new ArrayList(); edge= new ArrayList(); w=nW; h=nH; scale=nScale; makeBoxArray(); } public void makeBoxArray(){ for(int y=1;y<=h;y++){ for(int x=1;x<=w;x++){ boxArray.add( new Tbox(2*x*scale, 2*y*scale, scale)); } } } public void makeEdge(){}; public void addTopTooth(int nX, int nY){ edge.add(new Line(nX, nY, nX, nY-scale)); edge.add(new Line(nX, nY-scale, nX+scale, nY-scale)); edge.add(new Line(nX+scale, nY-scale, nX+scale, nY )); } public void addRightTooth(int nX, int nY){ edge.add(new Line(nX, nY, nX+scale, nY )); edge.add(new Line(nX+scale, nY, nX+scale, nY+scale)); edge.add(new Line(nX+scale, nY+scale, nX , nY+scale)); } public void addBottomTooth(int nX, int nY){ edge.add(new Line(nX, nY, nX , nY+scale)); edge.add(new Line(nX, nY+scale, nX+scale, nY+scale)); edge.add(new Line(nX+scale, nY+scale, nX+scale, nY )); } public void addLeftTooth(int nX, int nY){ edge.add(new Line(nX, nY, nX-scale, nY )); edge.add(new Line(nX-scale, nY, nX-scale, nY+scale)); edge.add(new Line(nX-scale, nY+scale, nX, nY+scale)); } public String toString(){ String val=""; Tbox myBox; Line myLine; val+="IN;\nSP1;\nLT;\n"; for(int i=0; i< boxArray.size(); i++){ myBox=(Tbox)boxArray.get(i); val+=(myBox.toString()); } for(int i=0; i< edge.size(); i++){ myLine=(Line)edge.get(i); val+=(myLine.toString()); } return val; } public ArrayList getBoxArray(){ return boxArray; } public Tbox getBox(int i){ return (Tbox)boxArray.get(i); } public ArrayList getEdge(){ return edge; } }