X-Git-Url: http://git.megacz.com/?p=anneal.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fqfat%2FMesh.java;h=5c913c4abef66a8a7221eadbe642675786001743;hp=6fd53d3e68d6002dde7ed63cb0a637f73893ec9e;hb=9a1ec8473473464f51caeb04bd22179b977cad13;hpb=ba475c8edc2d38444381eeed6545ae36e47b093e diff --git a/src/edu/berkeley/qfat/Mesh.java b/src/edu/berkeley/qfat/Mesh.java index 6fd53d3..5c913c4 100644 --- a/src/edu/berkeley/qfat/Mesh.java +++ b/src/edu/berkeley/qfat/Mesh.java @@ -129,7 +129,7 @@ public class Mesh implements Iterable { } /** does NOT update bound pairs! */ - public boolean transform(Point newp, boolean ignoreProblems) { + private boolean transform(Point newp, boolean ignoreProblems) { this.oldp = this.p; if (immutableVertices) throw new Error(); @@ -169,31 +169,25 @@ public class Mesh implements Iterable { } public boolean visit(Object o) { - if (o instanceof T) { - T t = (T)o; - if (!good) return false; - for(E e = Vertex.this.e; e!=null; e=e.pair.next==Vertex.this.e?null:e.pair.next) { - if (!t.has(e.p1) && !t.has(e.p2) && e.intersects(t)) { good = false; } - if (e.t != null) { - if (!e.t.has(t.e1().p1) && !e.t.has(t.e1().p2) && t.e1().intersects(e.t)) { good = false; } - if (!e.t.has(t.e2().p1) && !e.t.has(t.e2().p2) && t.e2().intersects(e.t)) { good = false; } - if (!e.t.has(t.e3().p1) && !e.t.has(t.e3().p2) && t.e3().intersects(e.t)) { good = false; } - } + if (o instanceof Vertex) + return ((Vertex)o).e != null && ((Vertex)o).norm().dot(Vertex.this.norm()) >= 0; + T t = (T)o; + if (!good) return false; + for(E e = Vertex.this.e; e!=null; e=e.pair.next==Vertex.this.e?null:e.pair.next) { + if (!t.has(e.p1) && !t.has(e.p2) && e.intersects(t)) { good = false; } + if (e.t != null) { + if (!e.t.has(t.e1().p1) && !e.t.has(t.e1().p2) && t.e1().intersects(e.t)) { good = false; } + if (!e.t.has(t.e2().p1) && !e.t.has(t.e2().p2) && t.e2().intersects(e.t)) { good = false; } + if (!e.t.has(t.e3().p1) && !e.t.has(t.e3().p2) && t.e3().intersects(e.t)) { good = false; } } - return good; - } else { - Vertex v = (Vertex)o; - if (v.e==null || v.norm().dot(Vertex.this.norm()) < 0) - return false; - return true; } + return good; } - public boolean move(Vec v) { - Matrix m = Matrix.translate(v); + public boolean move(Matrix m, boolean ignoreProblems) { boolean good = true; for(Vertex p = this; p != null; p = (p.bound_to==this)?null:p.bound_to) - good &= p.transform(m.times(p.p), false); + good &= p.transform(m.times(p.p), ignoreProblems); 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);