checkpoint
[anneal.git] / src / edu / berkeley / qfat / Mesh.java
index c057f33..32d1aea 100644 (file)
@@ -17,18 +17,19 @@ public class Mesh implements Iterable<Mesh.T> {
     private RTree<T> tris = new RTree<T>();
     private PointSet<Vertex> vertices = new PointSet<Vertex>();
 
-    public boolean tilemesh = false;
+    public boolean immutableVertices;
     public boolean ignorecollision = false;
     public Mesh score_against = null;
     public double score = 0;
+
+    public Mesh(boolean immutableVertices) { this.immutableVertices = immutableVertices; }
+
+    public void makeVerticesImmutable() { this.immutableVertices = true; }
     public float score() { return (float)score; }
 
     public int size() { return vertices.size(); }
     public Iterable<Vertex> vertices() { return vertices; }
-
-    public Iterator<T> iterator() {
-        return tris.iterator();
-    }
+    public Iterator<T> iterator() { return tris.iterator(); }
 
     public void rebindPoints() {
         // unbind all points
@@ -213,7 +214,7 @@ public class Mesh implements Iterable<Mesh.T> {
         }
         public void computeError() {
             if (quadric_count == 0) {
-                if (!tilemesh) {
+                if (immutableVertices) {
                 } else if (nearest_in_other_mesh == null) {
                     if (score_against != null) {
                         Vertex ne = score_against.nearest(p);
@@ -274,6 +275,7 @@ public class Mesh implements Iterable<Mesh.T> {
 
         /** does NOT update bound pairs! */
         public boolean transform(Matrix m) {
+            if (immutableVertices) throw new Error();
             unApplyQuadricToNeighbor();
             Point oldp = this.p;
             try {