From: adam Date: Sun, 16 Dec 2007 02:22:54 +0000 (-0800) Subject: checkpoint X-Git-Url: http://git.megacz.com/?p=anneal.git;a=commitdiff_plain;h=713d66c4b8f6b1f3e0b20d57d004529f383d555d;hp=c7f3e926b90ddd42d194b110836df73928482fea checkpoint darcs-hash:20071216022254-5007d-27586e99399f577b8c67a5e3be2fdf09fad9b67e.gz --- diff --git a/src/edu/berkeley/qfat/Mesh.java b/src/edu/berkeley/qfat/Mesh.java index 3c80182..be699dd 100644 --- a/src/edu/berkeley/qfat/Mesh.java +++ b/src/edu/berkeley/qfat/Mesh.java @@ -226,7 +226,6 @@ public class Mesh implements Iterable { if (ang > minangle) oldscore += (ang - minangle); } - score += oldscore; } @@ -300,23 +299,16 @@ public class Mesh implements Iterable { E ret = getFreeIncident(e, e); if (ret != null) return ret; ret = getFreeIncident(e.pair.next, e.pair.next); - if (ret == null) { - E ex = e; - do { - System.out.println(ex + " " + ex.t); - ex = ex.pair.next; - } while (ex != e); - throw new Error("unable to find free incident to " + this); - } - return ret; + if (ret != null) return ret; + for(E e = this.e; e!=null; e=e.pair.next==this.e?null:e.pair.next) + System.out.println(e + " " + e.t); + throw new Error("unable to find free incident to " + this); } public E getFreeIncident(E start, E before) { - E e = start; - do { - if (e.pair.p2 == this && e.pair.t == null && e.pair.next.t == null) return e.pair; - e = e.pair.next; - } while(e != before); + for(E e = start; e!=null; e=e.pair.next==before?null:e.pair.next) + if (e.pair.p2 == this && e.pair.t == null && e.pair.next.t == null) + return e.pair; return null; } @@ -326,22 +318,16 @@ public class Mesh implements Iterable { return getE(v); } public E getE(Vertex p2) { - E e = this.e; - do { - if (e==null) return null; + for(E e = this.e; e!=null; e=e.pair.next==this.e?null:e.pair.next) if (e.p1 == this && e.p2 == p2) return e; - e = e.pair.next; - } while (e!=this.e); return null; } public Vec norm() { Vec norm = new Vec(0, 0, 0); - E e = this.e; - do { - if (e.t != null) norm = norm.plus(e.t.norm().times((float)e.prev.angle())); - e = e.pair.next; - } while(e != this.e); + for(E e = this.e; e!=null; e=e.pair.next==this.e?null:e.pair.next) + if (e.t != null) + norm = norm.plus(e.t.norm().times((float)e.prev.angle())); return norm.norm(); }