checkpoint
[anneal.git] / src / edu / berkeley / qfat / Mesh.java
index 8592d8a..1579551 100644 (file)
@@ -16,7 +16,6 @@ public class Mesh implements Iterable<Mesh.T> {
 
     private PointSet<Vert> pointset = new PointSet<Vert>();
     public Vert nearest(Point p) { return pointset.nearest(p); }
-    private HashMap<Point,Vert> verts = new HashMap<Point,Vert>();
 
     public Iterable<E> edges() {
         return
@@ -132,14 +131,13 @@ public class Mesh implements Iterable<Mesh.T> {
         }
     }
 
-    public Vert register(Point p) { Vert v = verts.get(p); return v==null ? new Vert(p) : v; }
+    public Vert register(Point p) { Vert v = pointset.get(p); return v==null ? new Vert(p) : v; }
     public final class Vert extends HasPoint {
         public Point p;
         public Point getPoint() { return p; }
         private Vert(Point p) {
             this.p = p;
-            if (verts.get(p) != null) throw new Error();
-            verts.put(this.p, this);
+            if (pointset.get(p) != null) throw new Error();
             pointset.add(this);
         }
         public void reinsert() {
@@ -210,8 +208,7 @@ public class Mesh implements Iterable<Mesh.T> {
             // FIXME: screws up hashmap
             unscore();
             try {
-                if (verts.get(this.p)==null) throw new Error();
-                verts.remove(this.p);
+                if (pointset.get(this.p)==null) throw new Error();
                 pointset.remove(this);
                 float newx = m.a*p.x + m.b*p.y + m.c*p.z + m.d;
                 float newy = m.e*p.x + m.f*p.y + m.g*p.z + m.h;
@@ -219,7 +216,6 @@ public class Mesh implements Iterable<Mesh.T> {
                 this.p = new Point(newx, newy, newz);
                 // FIXME: what if we move onto exactly where another point is?
                 pointset.add(this);
-                verts.put(this.p,(Vert)this);
             } catch (Exception e) {
                 throw new RuntimeException(e);
             }