- 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();
+ boolean shattered = false;
+ public P shatter() { return shatter(midpoint(), null, null); }
+ public P shatter(P mid, BindingGroup bg1, BindingGroup bg2) {
+ if (shattered) return mid;
+ shattered = true;
+
+ P r = next.p2;
+ E next = this.next;
+ E prev = this.prev;
+
+ if (bg1==null) bg1 = new BindingGroup();
+ if (bg2==null) bg2 = new BindingGroup();
+ for(E e : bg.es) e.shatter(e.midpoint(), bg1, bg2);