Repository navigation
P1 part 2: the VolumeRover Skeletonization port on cvc::tet_complex - #1167
Merged
Merged
Conversation
…, part 1) The skeletonization port's tetrahedral complex (VOLROVER-LIBRARY-PORTS-ROADMAP.md §2), with TDS_3's conventions (an infinite vertex closing the hull, neighbours opposite vertices, mirror indices, CGAL's next_around_edge order), built by tet_complex_builder, a resumable stepper (§1.9): checking, ordering (BRIO rounds of Morton keys, a sliced LSD radix sort), inserting (Bowyer-Watson: a visibility walk from the last new cell, the conflict region re-starred from the new point), compacting, circumcentres. The predicates are Shewchuk's (cvcpkg shewchuk-predicates), with CGAL's symbolic perturbation for cospherical and coplanar ties, so the triangulation is unique and is CGAL's Delaunay_triangulation_3 cell for cell: cgal_ab_test's new tet_complex rows find it identical on all 11 of its inputs, the 10^3 and 20^3 lattices, an exactly cospherical integer sphere, the rounded sphere and a cocircular cylinder included, at 0.97-2x CGAL's speed in general position and 4-6x Qhull's batch build. The INFO rows show what dropping Qhull's flat tetrahedra would leave instead: 3,444 facets with no neighbour on the 10^3 lattice. tet_complex_test (a port test, so also wasm-mt under node, and in the sanitizer lanes): exact Delaunay and validity on clouds and degenerate input, equality with Qhull's batch build in general position, independence of input order and seed, traversals against brute force, duplicates, bad input, and the T7 harness. Without Shewchuk's predicates (macOS today) the builder throws and the test skips. The ports lane installs qhull and shewchuk-predicates; the cgal-ab job watches the new files.
The radix sort's arrays are allocated uninitialised, the point, duplicate and vertex-cell arrays are filled while keying, the remap and the circumcentres are appended in counted loops, and compaction moves the finite cells and then the infinite ones in two appending passes. The slowest 4096-unit step is now 0.4-0.8 ms at 20k-100k points (cgal_ab's stepped rows report it).
§1.2's replacement table, §1.9's third-party calls, §2's triangulation and resumable phases, the T16 row, the P1 row and §9 now say cvc::tet_complex, the exact incremental Delaunay on Shewchuk's predicates measured in this PR, instead of Qhull. Qhull stays only as the general-position cross-check in tet_complex_test and cgal_ab_test.
…n port, part 2) cvc::skeletonize, skeleton_stepper and skeletonize_job (inc/cvc/geometry/skeleton.h) with skeleton_params' table (skeleton_params.h): the legacy library (transfix/volrover src/Skeletonization, UT LGPL-2.1) ported into src/cvc/geometry/skeleton/ as the shared cvc::cocone core (init, util, Tight Cocone, Robust Cocone) and the skeleton stages (medial axis, U1 and its planar clusters, U2 and its graph, polylines, stars), on tet_complex behind a CGAL-shaped adapter (datastruct.h), so the vendored code keeps its shape. Resumable (§1.9): every long legacy function is a C++20 coroutine that yields once per loop iteration and per step of every walk (stepping.h); the stepper resumes the top one a unit at a time, through the triangulation's own phases and "building", "voronoi", "tight cocone", "medial axis", "sheets", "strands", "clean-up" and "output". The fixes (§2): no global bounding box, no srand/rand (colours by index), no debug files (their cases are warnings), Flat Phi and the sharp angle are parameters, the helix window is an off-by-default parameter, and both sheets (fanned) and strands are returned. Also fixed: five CGAL_assertion()s with side effects that release builds compiled out (has_vertex, find_acceptor), the infinite vertex's point read in is_cospherical_pair, closed loops dropped from the strands, and U2's dependence on the cells' memory order (the saddles are traced in a geometric order). T1: tools/volrover-goldens builds the legacy library with CGAL (patched copies; the same five assertions made plain calls) and writes goldens for four committed point clouds; the CI job installs CGAL, GMP, MPFR and Boost. skeleton_test matches them exactly on the capsule, the torus and the cospherical box, and contains all 361 legacy segments on the dumbbell (2 more, the order effect). Also T2-T8: kernel predicates, known shapes, point-order and rigid-motion invariance, bad input, threads and call order, the T7 harness, the parameter table. Passes natively and as wasm-mt under node; joins the ports lane and the sanitizer lanes.
transfix
enabled auto-merge (squash)
November 12, 2026 08:26
The asan-ubsan job failed in TetComplex.DuplicatesMapToTheirFirstPoint with a stack-buffer-overflow in shewchuk::detail::fast_expansion_sum_zeroelim, called from orient3dadapt. Shewchuk's expansion sums read one element past an input expansion on their last pass (`fnow = f[++findex]`); the value is never used, so the predicates' results are right, but the read is out of bounds. exact_predicates.cpp is now the only file that includes <shewchuk/predicates.hpp>, and tet_complex.cpp calls cvc::exact::orient3d, insphere and orient2d. The ASan builds compile that one file without ASan, as the cvcpkg deps are, so no instrumented copy of the header's inline functions is linked. The header itself should guard the read in cvcpkg's recipe.
…n skips The skeleton kernel (skeleton/datastruct.cpp) calls cvc::exact::orient3d and orient2d too, so exact_predicates.cpp stays the only file that includes <shewchuk/predicates.hpp> and no ASan-instrumented copy of its expansion sums is linked.
The skeleton goldens were made on Windows, and CI's check on ubuntu-24.04 compares bytes, so it failed on box_grid, capsule and dumbbell. The legacy output differs by platform: the last digits and the order of tied sheet polygons on the box and capsule, and on the dumbbell the merged chains themselves (361 segments on Windows, 362 on Linux), since the legacy code walks its cells in the allocator's memory order. Commit the goldens CI made (two CI runs made the same bytes). skeleton_test still passes against them: capsule, box and torus exact to 1e-9, and the port has all 362 legacy dumbbell segments plus 1 (it also contains Windows' 361). The README and the test's comment say so.
# Conflicts: # .github/workflows/ci.yml # src/cvc/tests/port_tests.cmake
# Conflicts: # .github/workflows/ci.yml # src/cvc/tests/port_tests.cmake
transfix
added a commit
that referenced
this pull request
Nov 14, 2026
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.
Part 2 of P1: the VolumeRover Skeletonization port (
docs/roadmap/VOLROVER-LIBRARY-PORTS-ROADMAP.md§2), built oncvc::tet_complexas you decided in #1157.What lands
inc/cvc/geometry/skeleton.handskeleton_params.hcvc::skeletonize(points | geometry, params),skeleton_stepperandskeletonize_job(aresult_job<skeleton>).skeleton_params, with itsparam_table: 14 fields, legacy defaults, units and ranges.The result holds:
strands: the U2 polylines as segments, plus the stars of the small planar clusters;sheets: the big clusters' Voronoi facets, fanned into triangles;helix: the legacy protein-helix strips, only withhelix_window;strand_of_line,sheet_of_tri, counts, andwarnings.src/cvc/geometry/skeleton/: the legacy library, ported (~5k lines). It is transfix/volroversrc/Skeletonizationat the pinned sha, UT LGPL-2.1, copyright headers kept.cvc::coconecore, shared:init,util,tcocone(Tight Cocone),rcocone(Robust Cocone). TightCocone, PocketTunnel and Curation reuse these later.medax, U1 (inmedax.cpp), U2 with the graph (u2.cpp), andskel(clusters, stars, polylines).datastruct.h, the CGAL-shaped adapter overtet_complex, so the vendored files keep their shape:VC_cell/VC_vertex, which carry the legacy cell and vertex bases' fields;Facet_circulator/Cell_circulatormoves;stepping.h). Every long legacy function yields once per loop iteration and per step of every walk: the umbrella walks, the boundary growth, the in/out propagation, U1's growth, U2's integral curves and the polyline walks. So every phase is sliced and the legacy control flow is untouched. libcvc's state_exec already uses coroutines on every platform.building,voronoi,tight cocone,medial axis,sheets,strands,clean-upandoutput.skeleton_contextof §1.3 is the stepper'simpl: the bounding box, diagnostics, the triangulation and the partial results are all per call.What it fixes on the way in (§2, plus what the A/B turned up)
From §2:
bounding_boxis now the call's own. The T6 order test guards it.srand(0)/rand()colours are gone. Colours depend on the sheet's rank; strands are green, stars blue.degen_tetra,*.degen,*.degen_VF) are gone. Each case is counted and becomes a warning.Found in the port:
CGAL_assertion()s had side effects.has_vertex()inmedax.cppandtcocone.cpp, andfind_acceptor()inu1.cppandu2.cpp, fill the indices the code then uses. Release builds compile the assertions out, which leaves the indices at -1 or uninitialised: the code then readsvertex(-1), andset_VF_on_medax(-1, -1)writes out of bounds. The port makes the calls.is_cospherical_pair()read the infinite vertex's uninitialised point across hull facets. It now returns false there.do_intersect(from Voronoi facets whose vertices coincide on cospherical input) are tested as the point or segment they span. The legacy passed them to CGAL'sdo_intersect, which excludes them by precondition.T1: the legacy library's own output
tools/volrover-goldensnow also builds the legacy Skeletonization with CGAL (cvcpkg's, in thevolrover goldensCI job). It compiles patched copies of the sources, with the five assertions made plain calls, as the port does.skeleton_driver.cppwrites whatskeletonize()returns. Four committed float-exact point clouds:Coordinates are compared to 1e-9 of the extent. The same T1 passes as wasm-mt under node, so MSVC and clang agree.
On the T16 skeleton row: the roadmap asked for "the skeletons built on each" triangulation. The goldens are exactly that: the legacy code on CGAL's DT3, against the port on
tet_complex.Other tests (
skeleton_test, inCVC_PORT_TESTSandSAN_CXX_TESTS)do_intersect(crossing, beside, coplanar, through an edge, degenerate point and segment), the circumcentres, orientation, collinearity, ray/segment.params_validate.Checked locally
skeleton_test10/10,tet_complex_test10/10, andcgal_ab_testpasses.skeleton_test10/10.make_goldens.py --libs genseg,skeletonwith CGAL 6.0.1 rewrites the GenSeg goldens byte-identically and writes the skeleton ones. CI's Linux check then made different bytes: the last digits, the order of tied box polygons, and on the dumbbell the merged chains (the legacy cells' memory order is the allocator's). So the committed skeleton goldens are the ones CI made on ubuntu-24.04 (21beba7; two runs made the same bytes), andskeleton_testpasses against both sets.Not here (part 3)
cvc skeleton, pycvc, theskeleton.computeintrinsic (with-start/-async/job.cancel), and T10–T12.macOS
Without Shewchuk's predicates until #1165 merges. The macOS bundles were published on 2026-11-12, and #1165 adds macOS to the recipe's scopes. Until then the skeleton is unavailable there:
skeletonizethrows, and the tests skip.Update 2026-11-12 (late): #1165 has merged, and master is merged into this branch (0a4ed9e). So this CI run is the first with
CVC_WITH_SHEWCHUKon macOS, and the tests run on Apple clang instead of skipping.