+ tile.newT(mtf, ltf, mbf, null, 6);
+ tile.newT(mbf, ltf, lbf, null, 6);
+ tile.newT(rtf, mtf, rbf, null, 6);
+ tile.newT(rbf, mtf, mbf, null, 6);
+*/
+ /*
+ HashSet<Mesh.E> es = new HashSet<Mesh.E>();
+ for(Mesh.T t : tile) {
+ es.add(t.e1());
+ es.add(t.e2());
+ es.add(t.e3());
+ }
+ for(Mesh.E e : es) {
+ if (e.p1.p.x == e.p2.p.x && e.p1.p.y == e.p2.p.y) continue;
+ if (e.p1.p.z == e.p2.p.z && e.p1.p.y == e.p2.p.y) continue;
+ if (e.p1.p.x == e.p2.p.x && e.p1.p.z == e.p2.p.z) continue;
+ e.shatter();
+ }
+ */
+
+
+ height = 4;
+ width = 4;
+ depth = 1;
+
+ Matrix mm = Matrix.scale(0.1f);
+ // top
+ quad(tile, mm,
+ new Point( 2, 2, 0),
+ new Point( 1, 1, -1),
+ new Point(-1, 1, -1),
+ new Point(-2, 2, 0));
+ quad(tile, mm,
+ new Point(-2, 2, 0),
+ new Point(-1, 1, 1),
+ new Point( 1, 1, 1),
+ new Point( 2, 2, 0));
+ quad(tile, mm,
+ new Point( 1, 1, -1),
+ new Point( 1, 1, 1),
+ new Point(-1, 1, 1),
+ new Point(-1, 1, -1));
+
+ // bottom
+ quad(tile, mm,
+ new Point(-2, -2, 0),
+ new Point(-1, -1, -1),
+ new Point( 1, -1, -1),
+ new Point( 2, -2, 0));
+ quad(tile, mm,
+ new Point( 2, -2, 0),
+ new Point( 1, -1, 1),
+ new Point(-1, -1, 1),
+ new Point(-2, -2, 0));
+ quad(tile, mm,
+ new Point(-1, -1, -1),
+ new Point(-1, -1, 1),
+ new Point( 1, -1, 1),
+ new Point( 1, -1, -1));
+
+ // left
+ quad(tile, mm,
+ new Point( 2, -2, 0),
+ new Point( 1, -1, -1),
+ new Point( 1, 1, -1),
+ new Point( 2, 2, 0));
+ quad(tile, mm,
+ new Point( 2, 2, 0),
+ new Point( 1, 1, 1),
+ new Point( 1, -1, 1),
+ new Point( 2, -2, 0));
+ quad(tile, mm,
+ new Point( 1, -1, -1),
+ new Point( 1, -1, 1),
+ new Point( 1, 1, 1),
+ new Point( 1, 1, -1));
+
+ // bottom
+ quad(tile, mm,
+ new Point(-2, 2, 0),
+ new Point(-1, 1, -1),
+ new Point(-1, -1, -1),
+ new Point(-2, -2, 0));
+ quad(tile, mm,
+ new Point(-2, -2, 0),
+ new Point(-1, -1, 1),
+ new Point(-1, 1, 1),
+ new Point(-2, 2, 0));
+ quad(tile, mm,
+ new Point(-1, 1, -1),
+ new Point(-1, 1, 1),
+ new Point(-1, -1, 1),
+ new Point(-1, -1, -1));
+
+
+
+ translations = new Matrix[] {
+
+ Matrix.translate(new Vec(0, 0.2f,0))
+ .times(Matrix.rotate(new Vec(0,1,0), (float)(1*Math.PI/2))),
+
+ Matrix.translate(new Vec(0,-0.2f,0))
+ .times(Matrix.rotate(new Vec(0,1,0), (float)(1*Math.PI/2))),
+
+ Matrix.translate(new Vec( 0.2f,0,0))
+ .times(Matrix.rotate(new Vec(1,0,0), (float)(-1*Math.PI/2))),
+
+ Matrix.translate(new Vec(-0.2f,0,0))
+ .times(Matrix.rotate(new Vec(1,0,0), (float)(-1*Math.PI/2))),
+
+ Matrix.rotate(new Vec(0,0,1), (float)(2*Math.PI/2)),
+ /*
+ Matrix.rotate(new Vec(0,0,1), (float)(1*Math.PI/2)),
+
+ Matrix.rotate(new Vec(0,0,1), (float)(3*Math.PI/2)),
+
+ Matrix.rotate(new Vec(1,0,0), (float)(2*Math.PI/2)),
+ */
+ //Matrix.rotate(new Vec(0,0,1), (float)(2*Math.PI/2)),
+ //Matrix.scale(1,-1,1),
+
+ //Matrix.translate(new Vec( 0.2f, 0,0))
+ //.times(Matrix.rotate(new Vec(0,0,1), (float)( 1*Math.PI/2)))
+ //.times(Matrix.rotate(new Vec(0,1,0), (float)( 3*Math.PI/2))),
+
+ //Matrix.translate(new Vec(-0.2f, 0,0))
+ //.times(Matrix.rotate(new Vec(0,0,1), (float)( 3*Math.PI/2)))
+ //.times(Matrix.rotate(new Vec(0,1,0), (float)( 3*Math.PI/2))),
+
+ //Matrix.rotate(new Vec(0,0,1), (float)( 0*Math.PI/2))
+ //.times(Matrix.translate(new Vec(0, -0.2f, 0)))
+ //.times(Matrix.rotate(new Vec(0,1,0), (float)( 1*Math.PI/2))),
+ //Matrix.rotate(new Vec(0,0,1), (float)( 1*Math.PI/2))
+ //.times(Matrix.translate(new Vec(0, -0.2f, 0)))
+ //.times(Matrix.rotate(new Vec(0,1,0), (float)( 1*Math.PI/2))),
+
+ //Matrix.rotate(new Vec(0,0,1), (float)( 0*Math.PI/2))
+ //.times(Matrix.translate(new Vec(0, -0.2f, 0)))
+ //.times(Matrix.rotate(new Vec(0,1,0), (float)( 1*Math.PI/2))),
+ //Matrix.rotate(new Vec(0,0,1), (float)( 0*Math.PI/2))
+ //.times(Matrix.translate(new Vec(0, -0.2f, 0)))
+ //.times(Matrix.rotate(new Vec(0,1,0), (float)( 1*Math.PI/2))),
+
+ Matrix.ONE,
+ };
+
+
+
+ for(Matrix m1 : translations) {
+ for(Matrix m2 : translations) {
+ for(Mesh.T t1 : tile) {
+ for(Mesh.T t2 : tile) {
+
+ Matrix m = m1.inverse().times(m2);
+ if ((t1.v1().p.times(m).distance(t2.v1().p) < MATCHING_EPSILON) &&
+ (t1.v2().p.times(m).distance(t2.v3().p) < MATCHING_EPSILON) &&
+ (t1.v3().p.times(m).distance(t2.v2().p) < MATCHING_EPSILON)) {
+ t2.e3().bindEdge(t1.e1(), m);
+ t2.e2().bindEdge(t1.e2(), m);
+ t2.e1().bindEdge(t1.e3(), m);
+ }
+ if ((t1.v2().p.times(m).distance(t2.v1().p) < MATCHING_EPSILON) &&
+ (t1.v3().p.times(m).distance(t2.v3().p) < MATCHING_EPSILON) &&
+ (t1.v1().p.times(m).distance(t2.v2().p) < MATCHING_EPSILON)) {
+ t2.e3().bindEdge(t1.e2(), m);
+ t2.e2().bindEdge(t1.e3(), m);
+ t2.e1().bindEdge(t1.e1(), m);
+ }
+ if ((t1.v3().p.times(m).distance(t2.v1().p) < MATCHING_EPSILON) &&
+ (t1.v1().p.times(m).distance(t2.v3().p) < MATCHING_EPSILON) &&
+ (t1.v2().p.times(m).distance(t2.v2().p) < MATCHING_EPSILON)) {
+ t2.e3().bindEdge(t1.e3(), m);
+ t2.e2().bindEdge(t1.e1(), m);
+ t2.e1().bindEdge(t1.e2(), m);