checkpoint
authoradam <adam@megacz.com>
Sun, 16 Dec 2007 01:46:53 +0000 (17:46 -0800)
committeradam <adam@megacz.com>
Sun, 16 Dec 2007 01:46:53 +0000 (17:46 -0800)
darcs-hash:20071216014653-5007d-6a180ffcb4604ee2a28555d088b6119ba3612826.gz

src/edu/berkeley/qfat/Main.java
src/edu/berkeley/qfat/Mesh.java
src/edu/berkeley/qfat/geom/Triangle.java

index 5896167..f32258d 100644 (file)
@@ -409,7 +409,7 @@ public class Main extends MeshViewer {
             goal.applyQuadricToNeighborAll();
 
             safeTriangles.clear();
-            for(Mesh.T t : tile) safeTriangles.add(t);
+            for(Mesh.T t : tile) if (t.shouldBeDrawn()) safeTriangles.add(t);
             }
        }
     }
index c85de26..b518b14 100644 (file)
@@ -17,6 +17,8 @@ public class Mesh implements Iterable<Mesh.T> {
     private RTree<T> tris = new RTree<T>();
     private PointSet<Vert> vertices = new PointSet<Vert>();
 
+    public boolean tilemesh = false;
+    public boolean ignorecollision = false;
     public Mesh score_against = null;
     public double score = 0;
     public float score() { return (float)score; }
@@ -709,27 +711,6 @@ public class Mesh implements Iterable<Mesh.T> {
     }
 
 
-    public class FaceIterator implements Iterator<T> {
-        private HashSet<T> visited = new HashSet<T>();
-        private LinkedList<T> next = new LinkedList<T>();
-        public FaceIterator() { }
-        public FaceIterator(Vert v) { next.addFirst(v.e.t); }
-        public boolean hasNext() { return next.peek()!=null; }
-        public void remove() { throw new Error(); }
-        public T next() {
-            T ret = next.removeFirst();
-            if (ret == null) return null;
-            visited.add(ret);
-            T t1 = ret.e1().pair.t;
-            T t2 = ret.e2().pair.t;
-            T t3 = ret.e3().pair.t;
-            if (t1 != null && !visited.contains(t1)) next.addFirst(t1);
-            if (t2 != null && !visited.contains(t2)) next.addFirst(t2);
-            if (t3 != null && !visited.contains(t3)) next.addFirst(t3);
-            return ret;
-        }
-    }
-
     /** [UNIQUE] a triangle (face) */
     public final class T extends Triangle {
         public final E e1;
@@ -778,20 +759,12 @@ public class Mesh implements Iterable<Mesh.T> {
         public boolean hasE(E e) { return e1==e || e1.next==e || e1.prev==e; }
         public boolean has(Vert v) { return v1()==v || v2()==v || v3()==v; }
 
-        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);
-            p2().glVertex(gl);
-            p3().glVertex(gl);
+        public boolean shouldBeDrawn() {
+            if (e1().bind_to.set.size() == 0) return false;
+            if (e2().bind_to.set.size() == 0) return false;
+            if (e3().bind_to.set.size() == 0) return false;
+            return true;
         }
+
     }
-    public boolean tilemesh = false;
-    public boolean ignorecollision = false;
 }
index 3620f71..7c54357 100644 (file)
@@ -24,6 +24,7 @@ public abstract class Triangle implements HasBoundingBox {
 
     /** issue gl.glVertex() for each of the triangle's points */
     public void glVertices(GL gl) {
+        norm().glNormal(gl);
         p1().glVertex(gl);
         p2().glVertex(gl);
         p3().glVertex(gl);