checkpoint
[anneal.git] / src / edu / berkeley / qfat / Mesh.java
index 774efa3..55052b9 100644 (file)
@@ -65,13 +65,13 @@ public class Mesh implements Iterable<Mesh.T> {
         }
     }
 
-    public void unscoreAll() {
+    public void unApplyQuadricToNeighborAll() {
         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();
+                p.unApplyQuadricToNeighbor();
             }
     }
     public void recomputeAllFundamentalQuadrics() {
@@ -83,7 +83,7 @@ public class Mesh implements Iterable<Mesh.T> {
                 p.recomputeFundamentalQuadric();
             }
     }
-    public float rescoreAll() {
+    public float applyQuadricToNeighborAll() {
         int num = 0;
         double dist = 0;
         HashSet<Vert> done = new HashSet<Vert>();
@@ -91,7 +91,7 @@ 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.applyQuadricToNeighbor();
                 
             }
         return (float)(dist/num);
@@ -171,7 +171,7 @@ public class Mesh implements Iterable<Mesh.T> {
         }
 
         public void recomputeFundamentalQuadric() {
-            unscore();
+            unApplyQuadricToNeighbor();
             Matrix m = Matrix.ZERO;
             E e = this.e;
             do {
@@ -180,10 +180,10 @@ public class Mesh implements Iterable<Mesh.T> {
                 e = e.pair.next;
             } while(e != this.e);
             fundamentalQuadric = m;
-            rescore();
+            applyQuadricToNeighbor();
         }
 
-        public void unscore() {
+        public void unApplyQuadricToNeighbor() {
             if (nearest_in_other_mesh == null) return;
             if (fundamentalQuadric == null) return;
             nearest_in_other_mesh.unsc();
@@ -199,12 +199,10 @@ public class Mesh implements Iterable<Mesh.T> {
             score -= oldscore;
             oldscore = 0;
         }
-        public void rescore() {
+        public void applyQuadricToNeighbor() {
             if (score_against == null) return;
 
-            unsc();
-
-            if (nearest_in_other_mesh != null) unscore();
+            if (nearest_in_other_mesh != null) unApplyQuadricToNeighbor();
             if (nearest_in_other_mesh == null) {
                 nearest_in_other_mesh = score_against.nearest(p);
 
@@ -218,7 +216,7 @@ public class Mesh implements Iterable<Mesh.T> {
                     nearest_in_other_mesh.resc();
                 }
             }
-
+            unsc();
             resc();
         }
         public void resc() {
@@ -228,7 +226,7 @@ public class Mesh implements Iterable<Mesh.T> {
 
         /** does NOT update bound pairs! */
         public boolean transform(Matrix m) {
-            unscore();
+            unApplyQuadricToNeighbor();
             try {
                 if (pointset.get(this.p)==null) throw new Error();
                 pointset.remove(this);
@@ -240,7 +238,7 @@ public class Mesh implements Iterable<Mesh.T> {
             } catch (Exception e) {
                 throw new RuntimeException(e);
             }
-            rescore();
+            applyQuadricToNeighbor();
 
             // should recompute fundamental quadrics of all vertices sharing a face, but we defer...
             // FIXME: intersection test needed?