Closed Indy2222 closed 2 years ago
For completeness, my code looks like this:
let mut triangulation = ConstrainedDelaunayTriangulation::<Point2<_>>::new();
// ...
// For corner points are added like this:
triangulation.insert(Point2::new(...)).unwrap();
// ...
// Then in a for loop:
triangulation
.add_constraint_edge(edge.a_point2(), edge.b_point2())
.unwrap();
// And then I get the triangles with:
triangulation
.inner_faces()
.filter_map(|f| {
let vertices = f.vertices().map(|v| {
let v = v.as_ref();
Point::new(v.x, v.y)
});
let triangle = Triangle::new(vertices[0], vertices[1], vertices[2]);
if polygon_ids.is_excluded(&triangle) {
None
} else {
Some(triangle)
}
})
.collect()
Never mind, I opened the issue in wrong repository. :blush:
The following picture illustrates the issue:
All points except 4 in the corners were added as constraint edges (visualized with red color). The triangulation contains triangles (visualized with blue color) with vertices which do not correspond to any input point.
This is fully zoomed out image (scaled to 0-1):
Note that I have removed some triangles from the zoomed-out image above (the white areas were correctly covered).
Input points:
Input edges (list of edges, each is list of a-b points):