From: adam Date: Wed, 5 Dec 2007 05:08:27 +0000 (-0800) Subject: checkpoint X-Git-Url: http://git.megacz.com/?p=anneal.git;a=commitdiff_plain;h=0ec883275010391cb96bb7bc1db3a6a3333f8dd9 checkpoint darcs-hash:20071205050827-5007d-b9d2da1a08a02358a261e435b94ec0558f09f0e7.gz --- diff --git a/src/edu/berkeley/qfat/Mesh.java b/src/edu/berkeley/qfat/Mesh.java index c570ede..f7ecb4d 100644 --- a/src/edu/berkeley/qfat/Mesh.java +++ b/src/edu/berkeley/qfat/Mesh.java @@ -16,8 +16,7 @@ public class Mesh implements Iterable { public static float EPSILON = (float)0.0001; public static Random random = new Random(); - private HashMap ps = new HashMap(); - //public HashSet es = new HashSet(); + private HashMap verts = new HashMap(); public Iterable edges() { return @@ -38,9 +37,9 @@ public class Mesh implements Iterable { } public Iterator iterator() { - for(Vert v : ps.values()) { - if (v.e != null && v.e.t != null) return new FaceIterator(v); - } + for(Vert v : verts.values()) + if (v.e != null && v.e.t != null) + return new FaceIterator(v); return new FaceIterator(); } @@ -91,7 +90,7 @@ public class Mesh implements Iterable { public void transform(Matrix m) { ArrayList set = new ArrayList(); - set.addAll(ps.values()); + set.addAll(verts.values()); for(Vert v : set) v.transform(m); } @@ -102,7 +101,7 @@ public class Mesh implements Iterable { float max_x = Float.MIN_VALUE; float max_y = Float.MIN_VALUE; float max_z = Float.MIN_VALUE; - for(Point p : ps.keySet()) { + for(Point p : verts.keySet()) { if (p.x < min_x) min_x = p.x; if (p.y < min_y) min_y = p.y; if (p.z < min_z) min_z = p.z; @@ -120,7 +119,7 @@ public class Mesh implements Iterable { float max_x = Float.MIN_VALUE; float max_y = Float.MIN_VALUE; float max_z = Float.MIN_VALUE; - for(Point p : ps.keySet()) { + for(Point p : verts.keySet()) { if (p.x < min_x) min_x = p.x; if (p.y < min_y) min_y = p.y; if (p.z < min_z) min_z = p.z; @@ -170,13 +169,13 @@ public class Mesh implements Iterable { } } - public Vert register(Point p) { Vert v = ps.get(p); return v==null ? new Vert(p) : v; } + public Vert register(Point p) { Vert v = verts.get(p); return v==null ? new Vert(p) : v; } public final class Vert { public Point p; private Vert(Point p) { this.p = p; - if (ps.get(p) != null) throw new Error(); - ps.put(this.p, this); + if (verts.get(p) != null) throw new Error(); + verts.put(this.p, this); } public void kdremove() { if (!inserted) return; @@ -242,14 +241,14 @@ public class Mesh implements Iterable { // FIXME: screws up hashmap unscore(); try { - if (ps.get(this.p)==null) throw new Error(); - ps.remove(this.p); + if (verts.get(this.p)==null) throw new Error(); + verts.remove(this.p); 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; float newz = m.i*p.x + m.j*p.y + m.k*p.z + m.l; this.p = new Point(newx, newy, newz); // FIXME: what if we move onto exactly where another point is? - ps.put(this.p,(Vert)this); + verts.put(this.p,(Vert)this); } catch (Exception e) { throw new RuntimeException(e); } @@ -598,7 +597,7 @@ public class Mesh implements Iterable { if (norm != null) { Vec norm2 = p3.p.minus(p1.p).cross(p2.p.minus(p1.p)); float dot = norm.dot(norm2); - //if (Math.abs(dot) < EPointSILON) throw new Error("dot products within epsilon of each other: "+norm+" "+norm2); + //if (Math.abs(dot) < EPointSILON) throw new Error("dot products within evertsilon of each other: "+norm+" "+norm2); if (dot < 0) { Vert p = p1; p1=p2; p2 = p; } } E e12 = p1.makeE(p2);