checkpoint
[anneal.git] / src / edu / berkeley / qfat / Main.java
index 0246692..d8896c2 100644 (file)
@@ -162,7 +162,7 @@ public class Main extends MeshViewer {
         //tx.e3.shatter();
 
 
-        tile.bind();
+        tile.rebindPoints();
 
         //mid.move(new Vec((float)0,0,(float)-0.05));
         //ltn.move(new Vec((float)0,0,(float)-0.05));
@@ -178,23 +178,22 @@ public class Main extends MeshViewer {
     }
 
     public synchronized void breakit() {
-        if (verts > 200) return;
+        if (verts > 300) return;
         PriorityQueue<Mesh.E> es = new PriorityQueue<Mesh.E>();
         for(Mesh.E e : tile.edges()) es.add(e);
         for(int i=0; i<10; i++) {
             Mesh.E e = es.poll();
             verts++;
-            System.out.println("shatter " + e);
+            //System.out.println("shatter " + e);
             e.shatter();
-            tile.unbind();
-            tile.bind();
+            tile.rebindPoints();
         }
     }
 
     public synchronized void rand(double temperature, Mesh.Vert p) {
         double tile_score = tile.score();
         double goal_score = goal.score();
-        p.rescore();
+        p.reComputeError();
 
         Vec v = new Vec((random.nextFloat() - (float)0.5) / 1000,
                         (random.nextFloat() - (float)0.5) / 1000,
@@ -226,20 +225,20 @@ public class Main extends MeshViewer {
     public void anneal() throws Exception {
         int verts = 0;
         while(true) {
-            for(int i=0; i<1; i++) {
+            HashSet<Mesh.Vert> hs = new HashSet<Mesh.Vert>();
+            for(Mesh.Vert p : tile.vertices()) hs.add(p);
+            for(int i=0; i<10; i++) {
                 repaint();
-                for(Mesh.T t : tile)
-                    for(Mesh.Vert p : new Mesh.Vert[] { t.v1(), t.v2(), t.v3() }) {
-                        rand(10,p);
-                    }
-                goal.unscore();
-                tile.unscore();
-                goal.fundamental();
-                tile.fundamental();
-                goal.rescore();
-                tile.rescore();
+                for(Mesh.Vert v : hs) rand(10,v);
             }
+            tile.rebuildPointSet();
             breakit();
+            repaint();
+            goal.unApplyQuadricToNeighborAll();
+            repaint();
+            tile.recomputeAllFundamentalQuadrics();
+            repaint();
+            goal.applyQuadricToNeighborAll();
        }
     }