X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fqfat%2FMesh.java;h=8a46c730fa131179ee8ac5689db3ae604f0039eb;hb=485efa58c987b9a4b5155b36ae7c64eff4251142;hp=6db50dc8344b85afbd4d38d434079566da7d01e2;hpb=1e2214af081840f74ebef09a7f9973cac3107d13;p=anneal.git diff --git a/src/edu/berkeley/qfat/Mesh.java b/src/edu/berkeley/qfat/Mesh.java index 6db50dc..8a46c73 100644 --- a/src/edu/berkeley/qfat/Mesh.java +++ b/src/edu/berkeley/qfat/Mesh.java @@ -74,33 +74,19 @@ public class Mesh implements Iterable { // Vertexices ////////////////////////////////////////////////////////////////////////////// /** a vertex in the mesh */ - public final class Vertex extends HasPoint implements Visitor { + public final class Vertex extends HasQuadric implements Visitor { public String toString() { return p.toString(); } public Point p; E e; // some edge *leaving* this point - /** the nearest vertex in the "score_against" mesh */ - Vertex nearest_in_other_mesh; - /** the number of vertices in the other mesh for which this is the nearest_in_other_mesh */ - int quadric_count; - /** the total error quadric (contributions from all vertices in other mesh for which this is nearest) */ - Matrix quadric = Matrix.ZERO; - Matrix binding = Matrix.ONE; Vertex bound_to = this; - float oldscore = 0; - boolean quadricStale = false; + public float oldscore = 0; + - public Matrix errorQuadric() { return quadric; } public Point getPoint() { return p; } public float score() { return oldscore; } - private Matrix fundamentalQuadric = null; - public Matrix fundamentalQuadric() { - if (fundamentalQuadric == null) recomputeFundamentalQuadric(); - return fundamentalQuadric; - } - private Vertex(Point p) { this.p = p; if (vertices.get(p) != null) throw new Error(); @@ -112,10 +98,6 @@ public class Mesh implements Iterable { gl.glNormal3f(norm.x, norm.y, norm.z); } - public void recomputeFundamentalQuadricIfNeighborChanged() { - if (score_against.nearest(p) == nearest_in_other_mesh) return; - recomputeFundamentalQuadric(); - } public void recomputeFundamentalQuadric() { unApplyQuadricToNeighbor(); if (quadricStale || fundamentalQuadric==null) { @@ -156,7 +138,7 @@ public class Mesh implements Iterable { nearest_in_other_mesh = new_nearest; // don't attract to vertices that face the other way - if (nearest_in_other_mesh.e == null || nearest_in_other_mesh.norm().dot(norm()) < 0) { + 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(); @@ -181,6 +163,7 @@ public class Mesh implements Iterable { score -= oldscore; oldscore = 0; } + public HasQuadric nearest() { return score_against.nearest(p); } public void computeError() { oldscore = quadric_count != 0