use of org.apache.commons.math3.exception.InsufficientDataException in project chordatlas by twak.
the class Concarnie method removeOverlaps.
private void removeOverlaps(List<Problem> current) {
Closer<Problem> closer = new Closer();
for (Problem a : current) {
try {
Region<Euclidean2D> ar = a.chull.createRegion();
b: for (Problem b : current) if (a != b)
for (Vector2D v : b.chull.getVertices()) {
Location vInA = ar.checkPoint(v);
if (vInA == Location.BOUNDARY || vInA == Location.INSIDE) {
closer.add(a, b);
continue b;
}
}
} catch (InsufficientDataException th) {
} catch (MathIllegalArgumentException th) {
}
}
for (Set<Problem> close : closer.close()) {
List<Problem> intersecting = new ArrayList<Problem>(close);
Collections.sort(intersecting, (a, b) -> -Double.compare(a.area(), b.area()));
for (int i = 1; i < intersecting.size(); i++) {
Problem togo = intersecting.get(i);
togo.addPortal();
current.remove(togo);
}
}
}
Aggregations