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.
…oordinates (P3a, part 2) The second part of the ContourTiler port's planar module (VOLROVER-LIBRARY-PORTS-ROADMAP.md §3, P3a), on top of part 1: - delaunay, constrained_delaunay and triangulate (a polygon's inside, holes included) on CDT, replacing Delaunay_triangulation_2 and Constrained_Delaunay_triangulation_2. Triangles are counterclockwise with a neighbour table; duplicates and collinear input are handled; crossing constraints throw. - convex_partition: Hertel-Mehlhorn on triangulate()'s triangles, replacing approx_convex_partition_2. - sibson_coordinates and sibson_interpolate on a Delaunay triangulation, replacing natural_neighbor_coordinates_2 and linear_interpolation (ContourTiler's interp.cpp). - planar_test: empty circumcircles (and, constrained, hidden only behind a constraint), exact areas, the neighbour table, partitions that tile the polygon within Hertel-Mehlhorn's bound, and Sibson weights against Voronoi cells built by half-plane clipping. - cgal_ab rows: the triangulations are CGAL's exactly and the Sibson weights equal CGAL's to 1e-14. The partitions are valid but never CGAL's: 15-45% fewer pieces, because CGAL's Hertel-Mehlhorn runs on a triangulation that is not Delaunay. - The roadmap records what that means for parity: ContourTiler's live untiled-region fill (medial_axis_stable) partitions into convex pieces and interpolates their centroids; the straight-skeleton fill is never called, so the partition, not the medial axis, is where the port's fills will differ.
# 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 2 of 3. Stacked on #1158: review only the last commit (cvc::planar: CDT triangulations, ...). Once #1158 merges, this PR's diff shrinks to that commit.What lands
cdt, MPL-2.0), replacing CGAL's GPL 2D triangulations:delaunay,constrained_delaunay, andtriangulate, which triangulates a polygon's inside, holes included.planar_error.convex_partition: Hertel–Mehlhorn ontriangulate()'s triangles, replacingapprox_convex_partition_2.sibson_coordinatesandsibson_interpolateon a Delaunay triangulation, replacingnatural_neighbor_coordinates_2andlinear_interpolation(ContourTiler'sinterp.cpp). The query point is found by a visibility walk.planar_test:cgal_ab_planar.cpp:Delaunay_triangulation_2;Constrained_Delaunay_triangulation_2's faces inside the polygon (ContourTiler's use);approx_convex_partition_2, plus Greene's, ContourTiler's fallback;natural_neighbor_coordinates_2withlinear_interpolation.What the A/B found (locally: Windows, MSVC 19.44, CGAL 6.0.1)
convex_partition_is_valid_2, but none equals CGAL's piece for piece. Hertel–Mehlhorn on CDT's Delaunay triangulation gives 15–45% fewer pieces thanapprox_convex_partition_2, which runs it on a constrained triangulation that is not Delaunay. On the dense contours that is 50–206 pieces against CGAL's 82–300.A parity finding for P3b and §9 item 2
ContourTiler's live untiled-region code does not use the straight skeleton.
medial_axis_stable(skeleton.cpp, called fromtiler_operations.cpp:1509) splits each untiled region into convex pieces withapprox_convex_partition_2(Greene's as the fallback). It puts a vertex at each piece's centroid and one on each diagonal between pieces, then lifts them off the slice planes by natural-neighbour interpolation.triangulate_to_medial_axis, is never called.cvc::planarwill place different interior vertices in untiled regions; region boundaries and tiles outside untiled regions need not change.The roadmap's §3 and §9 item 2 now say this. The recommendation (topology plus a Hausdorff tolerance) still stands. Exact parity in untiled regions would mean reproducing CGAL's own non-Delaunay constrained triangulation.
Checked locally
planar_test: 37/37 natively, and as wasm-mt under node (relinked without-sNODERAWFS, as in cvc::planar: grid, exact predicates, polygons, Clipper2 Booleans and offsets (P3a, part 1) #1158).cgal_ab_test: 0 failures.macOS: built there too, as in #1158 (master's #1165).