checkpoint
[anneal.git] / src / edu / berkeley / qfat / Mesh.java
index a935357..c50e34c 100644 (file)
@@ -14,49 +14,22 @@ public class Mesh implements Iterable<Mesh.T> {
     public static final float EPSILON = (float)0.0001;
     public static final Random random = new Random();
 
+    private RTree<T> tris = new RTree<T>();
     private PointSet<Vert> vertices = new PointSet<Vert>();
 
-    public int size() { return vertices.size(); }
-    public Iterable<Vert> vertices() { return vertices; }
-
-    public Iterable<E> edges() {
-        return
-            new Iterable<E>() {
-            public Iterator<E> iterator() {
-                // HACK
-                HashSet<E> hse = new HashSet<E>();
-                for(T t : Mesh.this) {
-                    hse.add(t.e1());
-                    hse.add(t.e2());
-                    hse.add(t.e3());
-                    hse.add(t.e1().pair);
-                    hse.add(t.e2().pair);
-                    hse.add(t.e3().pair);
-                }
-                return hse.iterator();
-            } };
-    }
-
-    public Iterator<T> iterator() {
-        /*
-        for(Vert v : vertices)
-            if (v.e != null && v.e.t != null)
-                return new FaceIterator(v);
-        return new FaceIterator();
-        */
-        return ts.iterator();
-    }
-
-    public HashSet<T> ts = new HashSet<T>();
-    public RTree<T> tris = new RTree<T>();
-
     public Mesh score_against = null;
     public double score = 0;
     public float score() { return (float)score; }
-
     public int numedges = 0;
     public float avgedge = 0;
 
+    public int size() { return vertices.size(); }
+    public Iterable<Vert> vertices() { return vertices; }
+
+    public Iterator<T> iterator() {
+        return tris.iterator();
+    }
+
     public void rebindPoints() {
         // unbind all points
         for(Mesh.T t : this) {
@@ -834,10 +807,7 @@ public class Mesh implements Iterable<Mesh.T> {
         public void removeFromRTree() { tris.remove(this); }
         public void addToRTree() { tris.insert(this); }
 
-        public void destroy() {
-            tris.remove(this);
-            ts.remove(this);
-        }
+        public void destroy() { tris.remove(this); }
 
         T(E e1, int colorclass) {
             this.e1 = e1;
@@ -862,7 +832,6 @@ public class Mesh implements Iterable<Mesh.T> {
             }
             this.color = color;
             this.colorclass = colorclass;
-            ts.add(this);
             tris.add(this);
         }
         public E e1() { return e1; }
@@ -879,9 +848,11 @@ public class Mesh implements Iterable<Mesh.T> {
 
         public void glVertices(GL gl) {
 
+            /*
             if (e1().bind_to.set.size() == 0) return;
             if (e2().bind_to.set.size() == 0) return;
             if (e3().bind_to.set.size() == 0) return;
+            */
 
             norm().glNormal(gl);
             p1().glVertex(gl);