X-Git-Url: http://git.megacz.com/?p=anneal.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fqfat%2FMesh.java;h=55052b9e86654b945b222a6b4c7418e635879d8e;hp=774efa3e56b7fb4eadb82743ed2e79f4d513ee2d;hb=96343836d53ebbd1ada9d7daafdbdb1326fc0349;hpb=db6e4abf611268c147509a955e1111706a45eea2 diff --git a/src/edu/berkeley/qfat/Mesh.java b/src/edu/berkeley/qfat/Mesh.java index 774efa3..55052b9 100644 --- a/src/edu/berkeley/qfat/Mesh.java +++ b/src/edu/berkeley/qfat/Mesh.java @@ -65,13 +65,13 @@ public class Mesh implements Iterable { } } - public void unscoreAll() { + public void unApplyQuadricToNeighborAll() { HashSet done = new HashSet(); 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 { p.recomputeFundamentalQuadric(); } } - public float rescoreAll() { + public float applyQuadricToNeighborAll() { int num = 0; double dist = 0; HashSet done = new HashSet(); @@ -91,7 +91,7 @@ public class Mesh implements Iterable { 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 { } public void recomputeFundamentalQuadric() { - unscore(); + unApplyQuadricToNeighbor(); Matrix m = Matrix.ZERO; E e = this.e; do { @@ -180,10 +180,10 @@ public class Mesh implements Iterable { 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 { 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 { nearest_in_other_mesh.resc(); } } - + unsc(); resc(); } public void resc() { @@ -228,7 +226,7 @@ public class Mesh implements Iterable { /** 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 { } 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?