From: adam Date: Sun, 2 Dec 2007 01:57:33 +0000 (-0800) Subject: checkpoint X-Git-Url: http://git.megacz.com/?p=anneal.git;a=commitdiff_plain;h=1a864cc577c2b31049cd46f4fd9ed703802d7d17 checkpoint darcs-hash:20071202015733-5007d-717af769324239d57a65a82e274f7525d7cd7761.gz --- diff --git a/src/Geom.java b/src/Geom.java index 080690e..42abd82 100644 --- a/src/Geom.java +++ b/src/Geom.java @@ -196,10 +196,28 @@ public class Geom implements Iterable { E next; // next half-edge E pair; // partner half-edge + + public E bound_to = this; + public M bound_m = new M(); + public void bind(E e) { bind(e, new M()); } - public void bind(E e, M m) { - p1.bind(e.p2); - p2.bind(e.p1); + public void bind(E e2, M m) { + E e1 = this; + while(e1.bound_to != e1) e1 = e1.bound_to; + while(e2.bound_to != e2) e2 = e2.bound_to; + e1.bound_to = e2; + } + + public void dobind() { + if (bound_to == this) return; + E ex = this; + M m = new M(); + while(ex.bound_to != ex) { m = m.times(ex.bound_m); ex = ex.bound_to; } + p1.bind(ex.bound_to.p1); + p2.bind(ex.bound_to.p2); + } + + public void shatter() { } private void sync() { diff --git a/src/Main.java b/src/Main.java index d8e2658..4e4dc86 100644 --- a/src/Main.java +++ b/src/Main.java @@ -97,23 +97,23 @@ public class Main implements GLEventListener { if ((t1.p1().plus(v).minus(t2.p1()).mag() < Geom.EPSILON) && (t1.p2().plus(v).minus(t2.p3()).mag() < Geom.EPSILON) && (t1.p3().plus(v).minus(t2.p2()).mag() < Geom.EPSILON)) { - t1.e1().bind(t2.e3()); - t1.e2().bind(t2.e2()); - t1.e3().bind(t2.e1()); + t1.e1().bind(t2.e3().pair); + t1.e2().bind(t2.e2().pair); + t1.e3().bind(t2.e1().pair); } if ((t1.p2().plus(v).minus(t2.p1()).mag() < Geom.EPSILON) && (t1.p3().plus(v).minus(t2.p3()).mag() < Geom.EPSILON) && (t1.p1().plus(v).minus(t2.p2()).mag() < Geom.EPSILON)) { - t1.e2().bind(t2.e3()); - t1.e3().bind(t2.e2()); - t1.e1().bind(t2.e1()); + t1.e2().bind(t2.e3().pair); + t1.e3().bind(t2.e2().pair); + t1.e1().bind(t2.e1().pair); } if ((t1.p3().plus(v).minus(t2.p1()).mag() < Geom.EPSILON) && (t1.p1().plus(v).minus(t2.p3()).mag() < Geom.EPSILON) && (t1.p2().plus(v).minus(t2.p2()).mag() < Geom.EPSILON)) { - t1.e3().bind(t2.e3()); - t1.e1().bind(t2.e2()); - t1.e2().bind(t2.e1()); + t1.e3().bind(t2.e3().pair); + t1.e1().bind(t2.e2().pair); + t1.e2().bind(t2.e1().pair); } } } @@ -127,6 +127,14 @@ public class Main implements GLEventListener { //mid.move(geom.new V((float)-0.05,0,0)); //mtf.move(geom.new V(0, (float)-0.05, (float)0.05)); + + + for(Geom.T t : geom) { + t.e1().dobind(); + t.e2().dobind(); + t.e3().dobind(); + } + mtf.move(geom.new V(0, (float)-0.05, (float)0.00));