case 3:
// Generate minimal mesh to start from
final Vector[] v = vertices.toArray(new Vector[vertices.size()]);
triangles.add((new Triangle(v[0], v[1], v[2])));
triangles.add((new Triangle(v[0], v[2], v[1])));
return true;
}
// Look for triangles that face the vertex and remove them
final Set<Edge> borderEdges = new LinkedHashSet<Edge>();
for (Iterator<Triangle> it = triangles.iterator(); it.hasNext(); ) {
final Triangle triangle = it.next();
// If the triangle can't be seen, it's not relevant
if (!triangle.above(vertex)) {
continue;
}
// Remove the triangle from the mesh
it.remove();
// ...and remember its edges
for (int i = 0; i < 3; ++i) {
final Edge edge = triangle.getEdge(i);
if (borderEdges.remove(edge)) {
continue;
}
borderEdges.add(edge);