From 4b736bc17c9596c4cc1e7f80b750e1f58af60f2d Mon Sep 17 00:00:00 2001 From: adam Date: Tue, 4 Dec 2007 21:34:03 -0800 Subject: [PATCH] checkpoint darcs-hash:20071205053403-5007d-ce2ab070a573fcde853cf0a776933fde9c4a81b7.gz --- src/edu/berkeley/qfat/Mesh.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/edu/berkeley/qfat/Mesh.java b/src/edu/berkeley/qfat/Mesh.java index e530ad7..993f5e1 100644 --- a/src/edu/berkeley/qfat/Mesh.java +++ b/src/edu/berkeley/qfat/Mesh.java @@ -78,6 +78,7 @@ public class Mesh implements Iterable { done.add(p); p.rescore(); } + /* for(T t : this) for(Vert p : new Vert[] { t.v1(), t.v2(), t.v3() }) p.kdremove(); @@ -85,6 +86,7 @@ public class Mesh implements Iterable { for(T t : this) for(Vert p : new Vert[] { t.v1(), t.v2(), t.v3() }) p.kdinsert(); + */ return (float)(dist/num); } @@ -172,6 +174,11 @@ public class Mesh implements Iterable { this.p = p; if (verts.get(p) != null) throw new Error(); verts.put(this.p, this); + pointset.add(this); + } + public void reinsert() { + pointset.remove(this); + pointset.add(this); } public void kdremove() { if (!inserted) return; @@ -213,7 +220,7 @@ public class Mesh implements Iterable { watch = score_against.nearest(po.p); // don't attract to vertices that face the other way - if (watch.norm().dot(norm()) < 0) { + if (watch.e == null || watch.norm().dot(norm()) < 0) { watch = null; } else { watch.watch_x += po.p.x; @@ -239,11 +246,13 @@ public class Mesh implements Iterable { try { if (verts.get(this.p)==null) throw new Error(); verts.remove(this.p); + pointset.remove(this); 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? + pointset.add(this); verts.put(this.p,(Vert)this); } catch (Exception e) { throw new RuntimeException(e); -- 1.7.10.4