X-Git-Url: http://git.megacz.com/?p=anneal.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fqfat%2FMesh.java;h=3a4cba55b21e6cdb313e1029b5190cf41c8ef7ef;hp=1a210cd1dc152dcaa90165d60d52fcb6c37c6226;hb=621152904863f1ade5eed7757bfe05e91f848749;hpb=77be9651f3e4d3b99582ffdf2561608c50b6208c diff --git a/src/edu/berkeley/qfat/Mesh.java b/src/edu/berkeley/qfat/Mesh.java index 1a210cd..3a4cba5 100644 --- a/src/edu/berkeley/qfat/Mesh.java +++ b/src/edu/berkeley/qfat/Mesh.java @@ -96,20 +96,16 @@ public class Mesh implements Iterable { 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 { 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(); }