checkpoint
[anneal.git] / src / edu / berkeley / qfat / Mesh.java
index 7f806f8..fd73795 100644 (file)
@@ -110,6 +110,22 @@ public class Mesh implements Iterable<Mesh.T> {
             error += olderror;
         }
 
+        /*
+        public Vertex hack(GL gl, Point mouse) {
+            double dist = Double.MAX_VALUE;
+            Vertex cur = null;
+            for(E e = this.e; e!=null; e=e.pair.next==this.e?null:e.pair.next) {
+                Vertex v = e.getOther(this);
+                double dist2 = v.getPoint().glProject(gl).distance(mouse);
+                if ((cur==null || dist2 < dist) && v.visible) {
+                    dist = dist2;
+                    cur = v;
+                }
+            }
+            return cur;
+        }
+        */
+
         public float averageTriangleArea() {
             int count = 0;
             float ret = 0;
@@ -308,6 +324,7 @@ public class Mesh implements Iterable<Mesh.T> {
             return !illegal;
         }
 
+        public E getEdge() { return e; }
         public E getFreeIncident() {
             E ret = getFreeIncident(e, e);
             if (ret != null) return ret;
@@ -362,6 +379,8 @@ public class Mesh implements Iterable<Mesh.T> {
 
         public boolean intersects(T t) { return t.intersects(p1.p, p2.p); }
 
+        public Segment getSegment() { return new Segment(p1.getPoint(), p2.getPoint()); }
+
         public void bindingGroupChanged(edu.berkeley.qfat.geom.BindingGroup newBindingGroup_) {
 
             edu.berkeley.qfat.geom.BindingGroup<E> newBindingGroup =
@@ -554,6 +573,12 @@ public class Mesh implements Iterable<Mesh.T> {
             return Math.acos(v1.norm().dot(v2.norm()));
         }
 
+        public Vertex getOther(Vertex v) {
+            if (this.p1 == v) return p2;
+            if (this.p2 == v) return p1;
+            throw new Error();
+        }
+
         public void makeAdjacent(E e) {
             if (this.next == e) return;
             if (p2 != e.p1) throw new Error("cannot make adjacent -- no shared vertex");