e.p2.bind(ebound.p1);
}
}
- public void shatter(BindingGroup bg1, BindingGroup bg2) {
+ public void shatter(BindingGroup bg1, BindingGroup bg2, boolean triangles) {
for(E e : set) {
- e.shatter(e.midpoint(), bg1, bg2);
+ e.shatter(e.midpoint(), bg1, bg2, triangles);
}
}
}
public void bindEdge(E e) { bind_to.add(e); }
public void dobind() { bind_to.dobind(this); }
- public Point shatter() { return shatter(midpoint(), null, null); }
- public Point shatter(Point mid, BindingGroup bg1, BindingGroup bg2) {
+ public Point shatter() { return shatter(true); }
+ public Point shatter(boolean triangles) { return shatter(midpoint(), null, null, triangles); }
+ public Point shatter(Point mid, BindingGroup bg1, BindingGroup bg2, boolean triangles) {
+ return shatter(mid, bg1, bg2, triangles, false);
+ }
+ public Point shatter(Point mid, BindingGroup bg1, BindingGroup bg2, boolean triangles, boolean leader) {
if (shattered || destroyed) return mid;
shattered = true;
if (bg1==null) bg1 = new BindingGroup();
if (bg2==null) bg2 = new BindingGroup();
BindingGroup old_bind_to = bind_to;
- bind_peers.shatter(bg1, bg2);
- old_bind_to.shatter(bg2.other(), bg1.other());
+ bind_peers.shatter(bg1, bg2, triangles);
+ old_bind_to.shatter(bg2.other(), bg1.other(), triangles);
+ if (!triangles) {
+ next.shatter(false);
+ prev.shatter(false);
+ }
pair.shatter();
destroy();
- newT(r.p, p1.p, mid, null, old_colorclass);
- newT(r.p, mid, p2.p, null, old_colorclass);
- bg1.add(p1.getE(mid));
- bg2.add(p2.getE(mid).pair);
+ if (triangles) {
+ newT(r.p, p1.p, mid, null, old_colorclass);
+ newT(r.p, mid, p2.p, null, old_colorclass);
+ bg1.add(p1.getE(mid));
+ bg2.add(p2.getE(mid).pair);
+ if (leader) p1.getE(mid).shatter();
+ }
return mid;
}