checkpoint
[anneal.git] / src / edu / berkeley / qfat / Mesh.java
index e66c814..b25d1b7 100644 (file)
@@ -66,6 +66,24 @@ public class Mesh implements Iterable<Mesh.T> {
         }
     }
 
+    public void unscore() {
+        HashSet<Vert> done = new HashSet<Vert>();
+        for(T t : this)
+            for(Vert p : new Vert[] { t.v1(), t.v2(), t.v3() }) {
+                if (done.contains(p)) continue;
+                done.add(p);
+                p.unscore();
+            }
+    }
+    public void fundamental() {
+        HashSet<Vert> done = new HashSet<Vert>();
+        for(T t : this)
+            for(Vert p : new Vert[] { t.v1(), t.v2(), t.v3() }) {
+                if (done.contains(p)) continue;
+                done.add(p);
+                p.recomputeFundamentalQuadric();
+            }
+    }
     public float rescore() {
         int num = 0;
         double dist = 0;
@@ -74,8 +92,8 @@ public class Mesh implements Iterable<Mesh.T> {
             for(Vert p : new Vert[] { t.v1(), t.v2(), t.v3() }) {
                 if (done.contains(p)) continue;
                 done.add(p);
-                //p.rescore();
-                p.recomputeFundamentalQuadric();
+                p.rescore();
+                
             }
         return (float)(dist/num);
     }
@@ -204,7 +222,7 @@ public class Mesh implements Iterable<Mesh.T> {
             s2 = quadric==null ? 0 : po.p.distance(quadric.p);
             oldscore = (float)(s1 + s2);
             */
-            oldscore = quadric.preAndPostMultiply(p);
+            oldscore = quadric_count == 0 ? 0 : (quadric.preAndPostMultiply(p) / quadric_count);
 
             score += oldscore;
         }