From: adam Date: Sun, 16 Dec 2007 02:46:43 +0000 (-0800) Subject: checkpoint X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;ds=inline;h=6fe08d5c50c341f47ded8ce9acd670aad9362614;hp=8c80f2040b30013ac1d6a319d65d1d73681c0a0d;p=anneal.git checkpoint darcs-hash:20071216024643-5007d-10f7c1cae6f2a329c0ca35115817d9a107019b68.gz --- diff --git a/src/edu/berkeley/qfat/Main.java b/src/edu/berkeley/qfat/Main.java index 0f4743b..2fbd726 100644 --- a/src/edu/berkeley/qfat/Main.java +++ b/src/edu/berkeley/qfat/Main.java @@ -394,7 +394,6 @@ public class Main extends MeshViewer { } Thread.yield(); repaint(); - for(Mesh.Vertex p : goal.vertices()) p.recomputeFundamentalQuadric(); } System.out.println("temp="+temp + " ratio="+(Math.ceil(ratio*100)) + " " + "points_per_second=" + diff --git a/src/edu/berkeley/qfat/Mesh.java b/src/edu/berkeley/qfat/Mesh.java index 51b9249..fb99488 100644 --- a/src/edu/berkeley/qfat/Mesh.java +++ b/src/edu/berkeley/qfat/Mesh.java @@ -113,17 +113,18 @@ public class Mesh implements Iterable { } public void recomputeFundamentalQuadric() { - if (!quadricStale && fundamentalQuadric != null) return; - quadricStale = false; unApplyQuadricToNeighbor(); - 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++; + 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); } - fundamentalQuadric = m.times(1/(float)count); applyQuadricToNeighbor(); }