-
- Point[] points = new Point[] {
- ltf,
- mtf,
- rtf,
- lbf,
- mbf,
- rbf,
-
- ltc,
- mtc,
- rtc,
- lbc,
- mbc,
- rbc,
-
- ltn,
- mtn,
- rtn,
- lbn,
- mbn,
- rbn
- };
- /*
-
- // top
- tile.newT(ltf, mtf, mtc, null, 1);
- tile.newT(mtc, ltc, ltf, null, 1);
- tile.newT(mtf, rtf, rtc, null, 1);
- tile.newT(rtc, mtc, mtf, null, 1);
-
- tile.newT(ltc, mtc, mtn, null, 1);
- tile.newT(mtn, ltn, ltc, null, 1);
- tile.newT(mtc, rtc, rtn, null, 1);
- tile.newT(rtn, mtn, mtc, null, 1);
-
- // bottom (swap normals)
- tile.newT(mbf, lbf, mbc, null, 2);
- tile.newT(lbc, mbc, lbf, null, 2);
- tile.newT(rbf, mbf, rbc, null, 2);
- tile.newT(mbc, rbc, mbf, null, 2);
-
- tile.newT(mbc, lbc, mbn, null, 2);
- tile.newT(lbn, mbn, lbc, null, 2);
-
- tile.newT(rbc, mbc, rbn, null, 2);
- tile.newT(mbn, rbn, mbc, null, 2);
-
-
- // left
- tile.newT(ltf, ltc, lbc, null, 3);
- tile.newT(lbc, lbf, ltf, null, 3);
- tile.newT(ltc, ltn, lbn, null, 3);
- tile.newT(lbn, lbc, ltc, null, 3);
-
- // right (swap normals)
- tile.newT(rtc, rtf, rbc, null, 4);
- tile.newT(rbf, rbc, rtf, null, 4);
- tile.newT(rtn, rtc, rbn, null, 4);
- tile.newT(rbc, rbn, rtc, null, 4);
-
- // front
- tile.newT(ltn, mtn, mbn, null, 5);
- tile.newT(ltn, mbn, lbn, null, 5);
- tile.newT(mtn, rtn, rbn, null, 5);
- tile.newT(mtn, rbn, mbn, null, 5);
-
- // back
- 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);
- }
-
- if ((t1.v1().p.times(m).distance(t2.v1().p) < MATCHING_EPSILON) &&
- (t1.v2().p.times(m).distance(t2.v2().p) < MATCHING_EPSILON) &&
- (t1.v3().p.times(m).distance(t2.v3().p) < MATCHING_EPSILON)) {
- t2.e1().bindEdge(t1.e1().pair, m);
- t2.e2().bindEdge(t1.e2().pair, m);
- t2.e3().bindEdge(t1.e3().pair, m);
- }
- if ((t1.v2().p.times(m).distance(t2.v1().p) < MATCHING_EPSILON) &&
- (t1.v3().p.times(m).distance(t2.v2().p) < MATCHING_EPSILON) &&
- (t1.v1().p.times(m).distance(t2.v3().p) < MATCHING_EPSILON)) {
- t2.e2().bindEdge(t1.e1().pair, m);
- t2.e3().bindEdge(t1.e2().pair, m);
- t2.e1().bindEdge(t1.e3().pair, m);
- }
- if ((t1.v3().p.times(m).distance(t2.v1().p) < MATCHING_EPSILON) &&
- (t1.v1().p.times(m).distance(t2.v2().p) < MATCHING_EPSILON) &&
- (t1.v2().p.times(m).distance(t2.v3().p) < MATCHING_EPSILON)) {
- t2.e3().bindEdge(t1.e1().pair, m);
- t2.e1().bindEdge(t1.e2().pair, m);
- t2.e2().bindEdge(t1.e3().pair, m);