checkpoint
authoradam <adam@megacz.com>
Sun, 16 Dec 2007 03:11:09 +0000 (19:11 -0800)
committeradam <adam@megacz.com>
Sun, 16 Dec 2007 03:11:09 +0000 (19:11 -0800)
darcs-hash:20071216031109-5007d-87f50a48bf0769e0dca0b3e08491356f29969c95.gz

src/edu/berkeley/qfat/Mesh.java
src/edu/berkeley/qfat/geom/HasQuadric.java

index 1a210cd..3a4cba5 100644 (file)
@@ -96,20 +96,16 @@ public class Mesh implements Iterable<Mesh.T> {
             gl.glNormal3f(norm.x, norm.y, norm.z);
         }
 
-        public void recomputeFundamentalQuadric() {
-            unApplyQuadricToNeighbor();
-            if (quadricStale || fundamentalQuadric==null) {
-                Matrix m = Matrix.ZERO;
-                int count = 0;
-                for(E e = this.e; e!=null; e=e.pair.next==this.e?null:e.pair.next) {
-                    T t = e.t;
-                    m = m.plus(t.norm().fundamentalQuadric(t.centroid()));
-                    count++;
-                }
-                quadricStale = false;
-                fundamentalQuadric = m.times(1/(float)count);
+        public void _recomputeFundamentalQuadric() {
+            Matrix m = Matrix.ZERO;
+            int count = 0;
+            for(E e = this.e; e!=null; e=e.pair.next==this.e?null:e.pair.next) {
+                T t = e.t;
+                m = m.plus(t.norm().fundamentalQuadric(t.centroid()));
+                count++;
             }
-            applyQuadricToNeighbor();
+            quadricStale = false;
+            fundamentalQuadric = m.times(1/(float)count);
         }
 
         public void applyQuadricToNeighbor() {
@@ -124,14 +120,18 @@ public class Mesh implements Iterable<Mesh.T> {
             nearest_in_other_mesh = new_nearest;
                 
             // don't attract to vertices that face the other way
+
             if (((Vertex)nearest_in_other_mesh).e == null || ((Vertex)nearest_in_other_mesh).norm().dot(norm()) < 0) {
                 nearest_in_other_mesh = null;
             } else {
+
                 nearest_in_other_mesh.unComputeError();
                 nearest_in_other_mesh.quadric = nearest_in_other_mesh.quadric.plus(fundamentalQuadric());
                 nearest_in_other_mesh.quadric_count++;
                 nearest_in_other_mesh.computeError();
+
             }
+
             reComputeError();
         }
 
index dda3930..889eaee 100644 (file)
@@ -31,7 +31,12 @@ public abstract class HasQuadric extends HasPoint {
             if (quadricStale || fundamentalQuadric==null) 
                 recomputeFundamentalQuadric();
         }
-    public abstract void recomputeFundamentalQuadric();
+        public void recomputeFundamentalQuadric() {
+            unApplyQuadricToNeighbor();
+            if (quadricStale || fundamentalQuadric==null) _recomputeFundamentalQuadric();
+            applyQuadricToNeighbor();
+        }
+    public abstract void _recomputeFundamentalQuadric();
     public abstract void applyQuadricToNeighbor();
     public abstract void reComputeErrorAround();
     public abstract void reComputeError();