0

I am working with CGAL to manipulate 2D alpha shapes in C++, and my objective is to simplify an alpha shape by removing certain vertices based on specific criteria. However, I encountered a challenge when attempting to remove vertices using alphaShape::remove, as it is declared as private.

Here's a simplified version of the code I tried:

AlphaShape alpha_shape;
// Construct the alpha shape and add points...

for (AlphaShape::Finite_vertices_iterator it = alpha_shape.finite_vertices_begin();
     it != alpha_shape.finite_vertices_end(); ++it) {
    AlphaShape::Vertex_handle vertex = it;

    // Check criteria and remove vertex
    if (/* Criteria */) {
        alpha_shape.remove(vertex);  // This results in a compilation error (C2248)
    }
}

I understand that alphaShape::remove is a private member function, and directly calling it leads to a compilation error. My overall goal is to simplify the alpha shape by removing certain vertices that meet specific criteria. The criteria could be related to vertex coordinates.

I would greatly appreciate guidance on how to achieve the desired simplification of the alpha shape. Is there an alternative method or approach I can use to iterate over the vertices and remove specific vertices based on my criteria? Are there any available functions or techniques in CGAL that can help me achieve this simplification?

I appreciate any help or insights on this matter. Thank you in advance!

Dawid
  • 477
  • 3
  • 14
  • 2
    If you look at the comments in the code near the private `remove`: "// the dynamic version is not yet implemented // deactivate the triangulation member functions". So when you remove a point, there are workarounds to update the triangulation, but all the extra alpha-shape information will need to be recomputed from scratch, and IIRC that information is more costly than building the triangulation, so you might as well recompute everything from just the points... – Marc Glisse Jul 12 '23 at 11:48
  • @MarcGlisse Thanks. That makes sense. – Dawid Jul 12 '23 at 12:28

0 Answers0