+ T t; // triangle to our "left"
+ E prev; // previous half-edge
+ E next; // next half-edge
+ E pair; // partner half-edge
+
+
+ public BindingGroup bg = null;
+
+ public void bind(E e) { bind(e, new M()); }
+ public void bind(E e, M m) {
+ if (e.bg != null) e.bg.merge(this);
+ else if (bg != null) bg.merge(e);
+ else {
+ bg = new BindingGroup();
+ bg.merge(this);
+ bg.merge(e);
+ }
+ }
+
+ public void dobind() {
+ if (bg==null) return;
+ for(E ex : bg.es) {
+ if (ex==this) continue;
+ p1.bind(ex.p1);
+ p2.bind(ex.p2);
+ }
+ }
+
+ public boolean destroyed = false;
+ public void shatter() {
+ if (destroyed) return;
+ /*
+ HashSet<E> eh = new HashSet<E>();
+ eh.add(this);
+ for(E ex = bound_to; ex != this; ex = ex.bound_to) eh.add(ex);
+ E[] es = (E[])eh.toArray(new E[0]);
+ */
+ destroy();
+ pair.shatter();
+ for(E ex = bound_to; ex != this; ex = ex.bound_to) ex.shatter();
+ }
+ public void destroy() {
+ this.destroyed = true;
+ }