comment
[anneal.git] / src / edu / berkeley / qfat / Mesh.java
index 502fa6d..032457b 100644 (file)
@@ -85,6 +85,7 @@ public class Mesh implements Iterable<Mesh.T> {
     public float error() { return (float)error; }
 
     public int size() { return vertices.size(); }
+    public int numTriangles() { return triangles.size(); }
     public Iterable<Vertex> vertices() { return vertices; }
     public Iterator<T> iterator() { return triangles.iterator(); }
 
@@ -713,6 +714,7 @@ public class Mesh implements Iterable<Mesh.T> {
             bindEdge(e, m);
         }
         public void bindEdge(E e, Matrix m) {
+            /*
             for(E e_ : (Iterable<E>)e.getBoundPeers()) {
                 if (e.v1.getPoint().distance((e.getBindingMatrix(e_).times(e_.v1.getPoint()))) > 0.01f)
                     throw new RuntimeException("blah! " + e.v1.getPoint() + " " + e.getBindingMatrix(e_).times(e_.v1.getPoint()));
@@ -723,6 +725,7 @@ public class Mesh implements Iterable<Mesh.T> {
                 if (v2.getPoint().distance(m.times(e.getBindingMatrix(e_).times(e_.v2.getPoint()))) > 0.01f)
                     throw new RuntimeException("blah! " + v2.getPoint() + " " + m.times(e_.v2.getPoint()));
             }
+            */
             this.bindTo(m, e,      EPSILON);
             this.pair.bindTo(m, e.pair, EPSILON);
         }
@@ -896,6 +899,7 @@ public class Mesh implements Iterable<Mesh.T> {
         public E(Point v1, Point v2) {
             if (vertices.get(v1) != null) throw new Error();
             if (vertices.get(v2) != null) throw new Error();
+            if (v1.equals(v2)) throw new Error("attempt to create a zero-length edge!");
             this.v1 = new Vertex(v1);
             this.v2 = new Vertex(v2);
             this.prev = this.next = this.pair = new E(this, this, this);
@@ -965,6 +969,7 @@ public class Mesh implements Iterable<Mesh.T> {
     public T newT(HasPoint v1, HasPoint v2, HasPoint v3) {
         return newT(v1.getPoint(), v2.getPoint(), v3.getPoint(), null, 0);
     }
+    public T newT(Point v1, Point v2, Point v3, Vec norm) { return newT(v1, v2, v3, norm, 1); }
     public T newT(Point v1, Point v2, Point v3, Vec norm, int colorclass) {
         if (coalesce) {