Repository navigation
Conversation
…offsets (P3a, part 1) The planar-geometry module the ContourTiler port sits on (VOLROVER-LIBRARY-PORTS-ROADMAP.md §3, P3a), replacing the GPL CGAL packages ContourTiler used with permissive ones: - inc/cvc/geometry/planar.h, src/cvc/geometry/planar/: integer points on a snapping grid (grid::fit picks a power-of-two unit and an origin from a box, so a grid point's world position is exact), Shewchuk's orient2d and incircle, rings and polygons with holes (area, orientation, simplicity, point location, clean-up, nesting as arrange_polygons did), Clipper2 Booleans and resolve(), one-pass offsets, and minkowski_sum. - wavefront_offset: the straight skeleton's offset (what offset_polygon.cpp took from CGAL), as mitred Clipper2 passes stepped from one wavefront event to the next on a grid 2^20 times finer, rounded once at the end. - Built only with Clipper2, CDT and Shewchuk's predicates (then cvc exports CVC_WITH_PLANAR); macOS has no bundles of those yet, so it is off there. - planar_test (T2 against brute force, T6 on two threads), in CVC_PORT_TESTS and the sanitizer lanes; the ports lane installs the geometry packages and checks the configure enabled it. - cgal_ab_planar.cpp (T16): cvc::planar against Polygon_set_2, the straight-skeleton offsets and minkowski_sum_2. A single mitred pass differs from the skeleton in 2 of 50 offset cases (0.4% and 7.4% of the area, past an edge event that leaves a reflex join); wavefront_offset agrees in all 50, and the Booleans in all 32.
This was referenced Nov 12, 2026
Closed
# Conflicts: # .github/workflows/ci.yml # src/cvc/tests/port_tests.cmake
…r2, CDT and Shewchuk there (#1165)
transfix
added a commit
that referenced
this pull request
Nov 15, 2026
…and the Boost.Polygon medial axis (P3a, #1158, #1162) (#1164) Squash of #1164, which is stacked on #1162 and #1158 and carries all of both: - #1158 (P3a, part 1): the grid, exact predicates, polygons, Clipper2 Booleans and offsets. - #1162 (P3a, part 2): CDT triangulations, Hertel-Mehlhorn partitions, Sibson coordinates. - #1164 (P3a, part 3): the Boost.Polygon medial axis. #1164's required checks passed on the combined tree.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase P3a of the VolumeRover ports plan (
docs/roadmap/VOLROVER-LIBRARY-PORTS-ROADMAP.md§3, §7), part 1 of 3: thecvc::planarmodule that the ContourTiler port (P3b) sits on. It replaces the GPL CGAL packages ContourTiler uses with permissive ones, all from cvcpkg (§1.2).What lands
inc/cvc/geometry/planar.h,src/cvc/geometry/planar/grid::fitpicks a power-of-two unit and an origin from a bounding box, so every vertex snaps once and every grid point's world position is exact.orient2dandincircle, segment intersection, point on segment.nest(ContourTiler'sarrange_polygons: rings arranged into polygons with holes by depth).unite,intersect,subtract,exclusive_or,resolve(fill rules), one-passoffsetwith any join, andminkowski_sum.wavefront_offset: the straight skeleton's offset. This is whatoffset_polygon.cpptook from CGAL. It runs mitred Clipper2 passes in steps, each ending at the wavefront's next event (an edge collapsing, or a vertex reaching another edge). The steps run on a grid 2^20 times finer, and the result rounds to the caller's grid once at the end.planar_erroron bad input.Build. Built only when Clipper2, CDT and Shewchuk's predicates are all found. cvc then exports
CVC_WITH_PLANAR.planar_testis one skipped test.Tests (T2, T6).
planar_test, against brute-force references:It is in
CVC_PORT_TESTSand the sanitizer lanes'SAN_CXX_TESTS. The ports lane now installs qhull, clipper2, cdt and shewchuk-predicates, and fails if the configure did not enablecvc::planar.A/B against CGAL (T16).
tools/cgal_ab/cgal_ab_planar.cppruns cvc::planar's own functions against ContourTiler's CGAL calls:Polygon_set_2,create_{interior,exterior}_skeleton_and_offset_polygons_with_holes_2andminkowski_sum_2. Each case compares areas, ring counts and the symmetric difference, within one grid unit per unit of boundary. Thecgal-abjob's path filter now coverssrc/cvc/geometry/planarandplanar.h.The P0c finding: one-pass offsets vs the straight skeleton
The libcvc workstream recorded that Clipper2's mitred offsets differ from straight-skeleton offsets past an edge event. The A/B narrows that down:
How
cvc::planarhandles it:wavefront_offsetsteps through those events and agrees with CGAL in all 50 cases, those two included (symmetric difference 0 after rounding). When every step rounded to the caller's grid instead, the error reached about two grid units per unit of boundary on dense contours, which is why the steps run on the finer grid.offsetstays available as the plain one-pass operation; its header documents where it differs.Checked locally (Windows, MSVC 19.44, CGAL 6.0.1; emsdk, node 22)
planar_test: 28/28 natively, and 28/28 as wasm-mt under node. Running it here meant relinking without-sNODERAWFS, because gtest can't read the working directory through NODERAWFS on Windows; the Linux ports lane doesn't need that.cgal_ab_test: 0 failures.wavefront_offsetagrees in all 50 cases, about 27× faster than CGAL.static constsentinels and message pointers are folded away), so the allowlist doesn't grow.cvc::planaritself has no statics.Parts 2 and 3
Each follows as its own PR stacked on this one.