From 113b9ec23d89a15c3d57532909e85580df4c4580 Mon Sep 17 00:00:00 2001 From: adam Date: Sat, 1 Dec 2007 17:40:10 -0800 Subject: [PATCH] got edge bindings right darcs-hash:20071202014010-5007d-939304fc570e44391f15ddcc6df7aa50f43041a4.gz --- src/Geom.java | 10 ++++++---- src/Main.java | 22 +++++++++++++++------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/Geom.java b/src/Geom.java index a9f9bc2..080690e 100644 --- a/src/Geom.java +++ b/src/Geom.java @@ -196,6 +196,12 @@ public class Geom implements Iterable { E next; // next half-edge E pair; // partner half-edge + public void bind(E e) { bind(e, new M()); } + public void bind(E e, M m) { + p1.bind(e.p2); + p2.bind(e.p1); + } + private void sync() { this.prev.next = this; this.next.prev = this; @@ -282,10 +288,6 @@ public class Geom implements Iterable { public final E e1; public final int color; - public void bind(T t2, int rot) { - // FIXME - } - T(E e1) { this.e1 = e1; E e2 = e1.next; diff --git a/src/Main.java b/src/Main.java index 8a6cde6..d8e2658 100644 --- a/src/Main.java +++ b/src/Main.java @@ -18,7 +18,6 @@ public class Main implements GLEventListener { public Main(StlFile stlf) { - Geom.P ltf = geom.newP(-0.2, 0.1, 0.1); Geom.P mtf = geom.newP( 0.0, 0.1, 0.1); Geom.P rtf = geom.newP( 0.2, 0.1, 0.1); @@ -97,16 +96,25 @@ 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.bind(t2, 0); + (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()); + } 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.bind(t2, 1); + (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()); + } 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.bind(t2, 2); + (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()); + } } } } -- 1.7.10.4