Vector2D current = loop[loop.length - 1];
for (int i = 0; i < loop.length; ++i) {
final Vector2D previous = current;
current = loop[i];
final Line line = new Line(previous, current, tolerance);
final IntervalsSet region =
new IntervalsSet(line.toSubSpace((Point<Euclidean2D>) previous).getX(),
line.toSubSpace((Point<Euclidean2D>) current).getX(),
tolerance);
edges.add(new SubLine(line, region));
}
polygon = new PolygonsSet(edges, tolerance);