From: adam Date: Sun, 16 Dec 2007 03:49:36 +0000 (-0800) Subject: checkpoint X-Git-Url: http://git.megacz.com/?p=anneal.git;a=commitdiff_plain;h=eec7af191bd889dba87d94ace15dd93b050c2f6c checkpoint darcs-hash:20071216034936-5007d-11ee3af4585027f345e2947bf49d68ad5a6a49e3.gz --- diff --git a/src/edu/berkeley/qfat/Mesh.java b/src/edu/berkeley/qfat/Mesh.java index c2d2988..87209a7 100644 --- a/src/edu/berkeley/qfat/Mesh.java +++ b/src/edu/berkeley/qfat/Mesh.java @@ -50,7 +50,7 @@ public class Mesh implements Iterable { public void transform(Matrix m) { ArrayList set = new ArrayList(); for(Vertex v : vertices) set.add(v); - for(Vertex v : set) v.transform(m); + for(Vertex v : set) v.transform(m.times(v.p)); } public void rebuild() { /*vertices.rebuild();*/ } @@ -129,7 +129,7 @@ public class Mesh implements Iterable { } /** does NOT update bound pairs! */ - public boolean transform(Matrix m) { + public boolean transform(Point newp) { if (immutableVertices) throw new Error(); unApplyQuadricToNeighbor(); @@ -139,7 +139,7 @@ public class Mesh implements Iterable { vertices.remove(this); for(E e = this.e; e!=null; e=e.pair.next==this.e?null:e.pair.next) if (e.t != null) e.t.removeFromRTree(); - this.p = m.times(this.p); + this.p = newp; for(E e = this.e; e!=null; e=e.pair.next==this.e?null:e.pair.next) if (e.t != null) e.t.addToRTree(); vertices.add(this); @@ -187,16 +187,19 @@ public class Mesh implements Iterable { } } + Point oldp; public boolean move(Vec v) { Matrix m = Matrix.translate(v); boolean good = true; - for(Vertex p = this; p != null; p = (p.bound_to==this)?null:p.bound_to) - good &= p.transform(m); + for(Vertex p = this; p != null; p = (p.bound_to==this)?null:p.bound_to) { + p.oldp = p.p; + good &= p.transform(m.times(p.p)); + } for(Vertex p = this; p != null; p = (p.bound_to==this)?null:p.bound_to) if (good) p.reComputeErrorAround(); else - p.transform(Matrix.translate(v.times(-1))); + p.transform(p.oldp); return good; }