Skip to content

PMP: Spatial sort polygon soup - #9483

Open
afabri wants to merge 10 commits into
CGAL:mainfrom
afabri:Spatial_sort-polygon_soup-GF
Open

PMP: Spatial sort polygon soup#9483
afabri wants to merge 10 commits into
CGAL:mainfrom
afabri:Spatial_sort-polygon_soup-GF

Conversation

@afabri

@afabri afabri commented May 19, 2026

Copy link
Copy Markdown
Member

Summary of Changes

Add CGAL::Polygon_mesh_processing::hilbert_sort_polygon_soup()

Todo

  • evaluate gain on higher level functions
  • Document in user manual

Release Management

  • Affected package(s): PMP
  • Small Feature (if any): tbd
  • Link to compiled documentation (obligatory for small feature) wrong link name to be changed
  • License and copyright ownership: GeometryFactory

@lrineau lrineau added the Not yet approved The feature or pull-request has not yet been approved. label May 27, 2026
@afabri

afabri commented Jun 5, 2026

Copy link
Copy Markdown
Member Author

I wanted to evaluate the gain, and took tangential_relaxation(mesh) expecting it to be a low hanging fruit. To my surprise it becomes 20% slower, without that I understand yet what happens. As the Hilbert sort sorts the polygon soup
I checked that the vertices./faces/halfedges of the generated Surface_mesh are also sorted. I then was wondering if tangential relaxation depends on the order, but it does not modify positions while iterating over the vertices, but per round.

As a side remark, tangential_relaxation(mesh) uses a std::unordered_map as property map for vertices and faces. This makes sense if it does on a subset of vertices. Otherwise a dynamic property map would be a better choice.

@afabri
afabri force-pushed the Spatial_sort-polygon_soup-GF branch from bc4759b to 3b614cd Compare June 8, 2026 12:29
@afabri

afabri commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

As explained here Hilbert sorting only guarantees that what is close in the sorted sequence is also geometrically close, but not the other way round. I added a benchmrk that only calls faces_around_target() for all vertices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Not yet approved The feature or pull-request has not yet been approved. Pkg::PMP Speed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants