From: adam Date: Sun, 16 Dec 2007 03:52:02 +0000 (-0800) Subject: checkpoint X-Git-Url: http://git.megacz.com/?p=anneal.git;a=commitdiff_plain;h=ba475c8edc2d38444381eeed6545ae36e47b093e checkpoint darcs-hash:20071216035202-5007d-7f60939312e661822c19010158c8651c46dd724d.gz --- diff --git a/src/edu/berkeley/qfat/Mesh.java b/src/edu/berkeley/qfat/Mesh.java index 87209a7..6fd53d3 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.times(v.p)); + for(Vertex v : set) v.transform(m.times(v.p), true); } public void rebuild() { /*vertices.rebuild();*/ } @@ -76,7 +76,7 @@ public class Mesh implements Iterable { /** a vertex in the mesh */ public final class Vertex extends HasQuadric implements Visitor { - public Point p; + public Point p, oldp; E e; // some edge *leaving* this point Matrix binding = Matrix.ONE; @@ -129,11 +129,11 @@ public class Mesh implements Iterable { } /** does NOT update bound pairs! */ - public boolean transform(Point newp) { + public boolean transform(Point newp, boolean ignoreProblems) { + this.oldp = this.p; if (immutableVertices) throw new Error(); unApplyQuadricToNeighbor(); - Point oldp = this.p; if (vertices.get(this.p)==null) throw new Error(); vertices.remove(this); @@ -148,13 +148,15 @@ public class Mesh implements Iterable { good = true; - for(E e = this.e; e!=null; e=e.pair.next==this.e?null:e.pair.next) { - if (Math.abs(e.crossAngle()) > (Math.PI * 0.9) || Math.abs(e.next.crossAngle()) > (Math.PI * 0.9)) good = false; - if (e.t.aspect() < 0.1) good = false; - e.p2.quadricStale = true; - } + if (!ignoreProblems) + for(E e = this.e; e!=null; e=e.pair.next==this.e?null:e.pair.next) { + if (Math.abs(e.crossAngle()) > (Math.PI * 0.9) || Math.abs(e.next.crossAngle()) > (Math.PI * 0.9)) good = false; + if (e.t.aspect() < 0.1) good = false; + e.p2.quadricStale = true; + } - if (!ignorecollision && good) triangles.range(oldp, this.p, (Visitor)this); + if (!ignorecollision && !ignoreProblems && good) + triangles.range(oldp, this.p, (Visitor)this); return good; } @@ -187,19 +189,14 @@ 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) { - 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(p.oldp); + good &= p.transform(m.times(p.p), false); + for(Vertex p = this; p != null; p = (p.bound_to==this)?null:p.bound_to) + if (good) p.reComputeErrorAround(); + else p.transform(p.oldp, true); return good; }