checkpoint
authoradam <adam@megacz.com>
Wed, 5 Dec 2007 08:06:22 +0000 (00:06 -0800)
committeradam <adam@megacz.com>
Wed, 5 Dec 2007 08:06:22 +0000 (00:06 -0800)
darcs-hash:20071205080622-5007d-5df9b5b5aab92f6ed8ef5a01b6fca62e68528035.gz

src/edu/berkeley/qfat/Main.java
src/edu/berkeley/qfat/Mesh.java

index f067158..55eefd9 100644 (file)
@@ -193,7 +193,7 @@ public class Main extends MeshViewer {
     public synchronized void rand(double temperature, Mesh.Vert p) {
         double tile_score = tile.score();
         double goal_score = goal.score();
-        p.rescore();
+        p.applyQuadricToNeighbor();
 
         Vec v = new Vec((random.nextFloat() - (float)0.5) / 1000,
                         (random.nextFloat() - (float)0.5) / 1000,
@@ -233,11 +233,11 @@ public class Main extends MeshViewer {
             }
             breakit();
             repaint();
-            goal.unscoreAll();
+            goal.unApplyQuadricToNeighborAll();
             repaint();
             tile.recomputeAllFundamentalQuadrics();
             repaint();
-            goal.rescoreAll();
+            goal.applyQuadricToNeighborAll();
        }
     }
 
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?