X-Git-Url: http://git.megacz.com/?p=anneal.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fqfat%2FMain.java;h=2788f02619f4fd07a922475ccddd059725f89000;hp=7f99039fe3cb5933a82e3b247d18e47ad3b44515;hb=a1c8b8ce6c3b7840a29a04a6d9ec970a01937534;hpb=161d356850a765c2f6b83b42275095b777d7b2aa diff --git a/src/edu/berkeley/qfat/Main.java b/src/edu/berkeley/qfat/Main.java index 7f99039..2788f02 100644 --- a/src/edu/berkeley/qfat/Main.java +++ b/src/edu/berkeley/qfat/Main.java @@ -148,59 +148,59 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener // top - tile.newT(ltf, mtf, mtn); - tile.newT(mtn, ltn, ltf); - tile.newT(mtf, rtf, rtn); - tile.newT(rtn, mtn, mtf); + tile.newT(ltf, mtf, mtn, null); + tile.newT(mtn, ltn, ltf, null); + tile.newT(mtf, rtf, rtn, null); + tile.newT(rtn, mtn, mtf, null); // bottom (swap normals) - tile.newT(mbf, lbf, mbn); - tile.newT(lbn, mbn, lbf); - tile.newT(rbf, mbf, rbn); - tile.newT(mbn, rbn, mbf); + tile.newT(mbf, lbf, mbn, null); + tile.newT(lbn, mbn, lbf, null); + tile.newT(rbf, mbf, rbn, null); + tile.newT(mbn, rbn, mbf, null); // left - tile.newT(ltf, ltn, lbn); - tile.newT(lbn, lbf, ltf); + tile.newT(ltf, ltn, lbn, null); + tile.newT(lbn, lbf, ltf, null); // right (swap normals) - tile.newT(rtn, rtf, rbn); - tile.newT(rbf, rbn, rtf); + tile.newT(rtn, rtf, rbn, null); + tile.newT(rbf, rbn, rtf, null); // front - tile.newT(ltn, mtn, mbn); - tile.newT(ltn, mbn, lbn); - tile.newT(mtn, rtn, rbn); - tile.newT(mtn, rbn, mbn); + tile.newT(ltn, mtn, mbn, null); + tile.newT(ltn, mbn, lbn, null); + tile.newT(mtn, rtn, rbn, null); + tile.newT(mtn, rbn, mbn, null); // back - tile.newT(mtf, ltf, mbf); - tile.newT(mbf, ltf, lbf); - tile.newT(rtf, mtf, rbf); - tile.newT(rbf, mtf, mbf); + tile.newT(mtf, ltf, mbf, null); + tile.newT(mbf, ltf, lbf, null); + tile.newT(rtf, mtf, rbf, null); + tile.newT(rbf, mtf, mbf, null); for(Matrix m : translations) { for(Mesh.T t1 : tile) { for(Mesh.T t2 : tile) { if (t1==t2) continue; - if ((t1.p1().p.times(m).minus(t2.p1().p).mag() < Mesh.EPSILON) && - (t1.p2().p.times(m).minus(t2.p3().p).mag() < Mesh.EPSILON) && - (t1.p3().p.times(m).minus(t2.p2().p).mag() < Mesh.EPSILON)) { + if ((t1.v1().p.times(m).minus(t2.v1().p).mag() < Mesh.EPSILON) && + (t1.v2().p.times(m).minus(t2.v3().p).mag() < Mesh.EPSILON) && + (t1.v3().p.times(m).minus(t2.v2().p).mag() < Mesh.EPSILON)) { t1.e1().bind(t2.e3().pair); t1.e2().bind(t2.e2().pair); t1.e3().bind(t2.e1().pair); } - if ((t1.p2().p.times(m).minus(t2.p1().p).mag() < Mesh.EPSILON) && - (t1.p3().p.times(m).minus(t2.p3().p).mag() < Mesh.EPSILON) && - (t1.p1().p.times(m).minus(t2.p2().p).mag() < Mesh.EPSILON)) { + if ((t1.v2().p.times(m).minus(t2.v1().p).mag() < Mesh.EPSILON) && + (t1.v3().p.times(m).minus(t2.v3().p).mag() < Mesh.EPSILON) && + (t1.v1().p.times(m).minus(t2.v2().p).mag() < Mesh.EPSILON)) { t1.e2().bind(t2.e3().pair); t1.e3().bind(t2.e2().pair); t1.e1().bind(t2.e1().pair); } - if ((t1.p3().p.times(m).minus(t2.p1().p).mag() < Mesh.EPSILON) && - (t1.p1().p.times(m).minus(t2.p3().p).mag() < Mesh.EPSILON) && - (t1.p2().p.times(m).minus(t2.p2().p).mag() < Mesh.EPSILON)) { + if ((t1.v3().p.times(m).minus(t2.v1().p).mag() < Mesh.EPSILON) && + (t1.v1().p.times(m).minus(t2.v3().p).mag() < Mesh.EPSILON) && + (t1.v2().p.times(m).minus(t2.v2().p).mag() < Mesh.EPSILON)) { t1.e3().bind(t2.e3().pair); t1.e1().bind(t2.e2().pair); t1.e2().bind(t2.e1().pair); @@ -243,7 +243,7 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener //double min = (tile.avgedge/tile.numedges)*(1+(4/(double)verts)); //if (verts>0 && tile.es.peek().length() < min) return; PriorityQueue es = new PriorityQueue(); - for(Mesh.E e : tile.es) es.add(e); + for(Mesh.E e : tile.edges()) es.add(e); for(int i=0; i<10; i++) { Mesh.E e = es.poll(); verts++; @@ -408,7 +408,7 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener */ if (mesh==goal) - for(Mesh.Vert p : new Mesh.Vert[] { t.p1(), t.p2(), t.p3() }) { + for(Mesh.Vert p : new Mesh.Vert[] { t.v1(), t.v2(), t.v3() }) { p.p.glVertex(gl); //p.plus(p.norm().times(p.score()*10)).glVertex(gl); p.partner().p.glVertex(gl); @@ -450,7 +450,7 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener glcanvas.repaint(); //tile.ts.get(Math.abs(random.nextInt()) % tile.ts.size()).e1().p1 for(Mesh.T t : tile) - for(Mesh.Vert p : new Mesh.Vert[] { t.p1(), t.p2(), t.p3() }) { + for(Mesh.Vert p : new Mesh.Vert[] { t.v1(), t.v2(), t.v3() }) { rand(10,p); } goal.rescore();