Repository navigation
cvc::planar: the Boost.Polygon medial axis (P3a, part 3) - #1164
Merged
Merged
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.
The last part of the ContourTiler port's planar module (VOLROVER-LIBRARY-PORTS-ROADMAP.md §3, P3a), on top of parts 1 and 2: - medial_axis(polygon): the edges of Boost.Polygon's Voronoi diagram of the polygon's edges that lie inside it, without the secondary edges along the normals at reflex vertices; parabolic arcs sampled within a tolerance; each vertex's clearance; the graph also as polylines between branch points and ends. It stands where ContourTiler had CGAL's GPL straight skeleton. - planar_test: the rectangle's and a regular polygon's known axes, an L's arc round its reflex vertex, and on random polygons with and without holes every vertex's clearance, its two nearest boundary points and the graph's topology (one piece, a loop per hole), by brute force. - cgal_ab rows against create_interior_straight_skeleton_2: the same as the skeleton on convex polygons (Hausdorff distance 1e-9 to 2e-8 grid units, the same branch points), within 1.7-7.4% of a polygon's size of it on stars and dense contours, at about 14x CGAL's speed. - THIRD_PARTY_NOTICES: Boost.Polygon's Voronoi headers, now compiled into libcvc.
# Conflicts: # .github/workflows/ci.yml # src/cvc/tests/port_tests.cmake
…r2, CDT and Shewchuk there (#1165)
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 3 of 3. Stacked on #1158 and #1162: review only the last commit (cvc::planar: the Boost.Polygon medial axis).What lands
medial_axis(polygon, params). It stands where ContourTiler had CGAL's GPL straight skeleton (§1.2: no permissive C++ straight skeleton exists).tolerance.cvc::planarobject, Boost.Polygon's and CDT's headers included.planar_test:create_interior_straight_skeleton_2's bisectors against the medial axis, by Hausdorff distance.THIRD_PARTY_NOTICES.md: Boost.Polygon's Voronoi headers, now compiled into libcvc.What the A/B found (locally: Windows, MSVC 19.44, CGAL 6.0.1)
INFO, different by design):As #1162 found, ContourTiler's live untiled-region fill uses a convex partition rather than the straight skeleton. So this medial axis serves the port's straight-skeleton-shaped uses (the dead
triangulate_to_medial_axis, any later medial-axis fill) and doesn't decide parity.Checked locally
planar_test: 42/42 natively and as wasm-mt under node.cgal_ab_test: 0 failures.macOS: built there too, as in #1158 (master's #1165).
P3a as a whole
offset,wavefront_offset(the skeleton's offset),minkowski_sumpycvc: §3 asks for pycvc bindings of the tiler (
pycvc.tile_contours, P3b), not of the planar module, which is the tiler's internal layer. None are added here.