cgal icon indicating copy to clipboard operation
cgal copied to clipboard

Track patch border edges splitting in PMP::split

Open Simon-Lopez opened this issue 3 years ago • 3 comments

CGAL::Polygon_mesh_processing::split ends with splitting the edges marked as constrained during the previous corefinement step.

I would find useful that some operations in this splitting process are tracked by a visitor. Yet the visitor used in corefinement is not pass to internal::split_along_edges.

Moreover in the CGAL::Polygon_mesh_processing::Corefinement::Default_visitor base class there are two member functions :

  void before_edge_duplicated(halfedge_descriptor /*h_old*/, TriangleMesh&){} // called before a patch border edge is duplicated
  void after_edge_duplicated(halfedge_descriptor /*h_old*/,
                             halfedge_descriptor /* f_new */, TriangleMesh&){} // called after a patch border edge is duplicated

which seem to be designed for this but do not really fit the current implementation of split_along_edges.

Personnaly, I would love to have the following member functions available :

  void before_vertex_duplicated(vertex_descriptor /*v_old*/, TriangleMesh& /*tm*/) {} // called after a vertex is duplicated on a patch border edge
  void after_vertex_duplicated(vertex_descriptor /*v_old*/, vertex_descriptor /*v_new*/, TriangleMesh& /*tm*/) {}

Simon-Lopez avatar Jul 14 '22 13:07 Simon-Lopez

I've tried a few lines of code which fit my needs on this branch : https://github.com/Simon-Lopez/cgal/tree/call_visitor_for_patch_border_splitting commit: https://github.com/Simon-Lopez/cgal/commit/b0d925ed119547cf1799d3a6ebe8fb7b45d81182

I'm not really sure about where to call after_edge_duplicated and with which arguments (the two border halfedges ?).

Would it be ok to make a PR ?

Simon-Lopez avatar Jul 14 '22 13:07 Simon-Lopez

Hi Simon! what information do you need that is not available? Don't you have what you need with before_edge_split (), edge_split(), after_edge_split() ?

sloriot avatar Jul 15 '22 07:07 sloriot

Hi @sloriot.

Thanks a lot for your quick answer.

From what I understood, the functions *_edge_split() are called during the corefinement step when an edge is splitted into two edges (with one (corefinement) intersection point that splits the edge).

I'm interested in what happens during the step after the corefinement when each edge on the splitted mesh is duplicated to isolate patches. I would like to keep track of the association between duplicated edges. Obviously, I could retrieve all constrained edges after the split algorithm and look for the "associated edges" but as this information is available during the split_along_edges() algorithm I found usefull to have a visitor to collect it. Another option would be to make only the corefinement step and reimplement on my side the split_along_edges() step (😞).

BTW, it would be useful to have this split_along_edges() algorithm exposed as a PMP algorithm and not as an internal function.

Simon-Lopez avatar Jul 15 '22 09:07 Simon-Lopez

Fixed by the merge of PR https://github.com/CGAL/cgal/pull/6812.

lrineau avatar Sep 13 '22 10:09 lrineau