Repository navigation
P1: skeleton.compute, cvc skeleton and pycvc (skeleton port, part 3) - #1171
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.
The skeletonization's surfaces, on the part 2 port: - skeleton.compute, a job intrinsic through make_job_op<skeleton_params, skeleton>: the generic -start/-async forms and job.cancel come with it, cooperative or threaded, and the result is a dict of the strands, sheets and helix geometries, the polylines, the clusters and the warnings. add_skeleton_intrinsics(app) registers it on the app under the "skeleton" provider key. - cvc skeleton <input> -o <strands> [--sheets] [--helix] [--seconds]: the parameters come from the table, and the legacy flags (-r, -bbr, -thif, -thff, -plc, -medth, -medr) are translated; -mr and -hc are accepted and ignored with a note. - pycvc: skeletonize(geom, params=None, **keywords) and skeletonize_job, with skeleton_params as a param table, the GIL released and skeleton_error as ValueError. - result_job: once the stepper finishes, its own final status is read before take(), so job.status ends as the stepper's summary instead of the last in-progress line. Tests: skeleton_intrinsics_test (in CVC_PORT_TESTS, so on the wasm-mt ports lane), result_job_test's AStepperOwnStatusIsReadOnceDone, the cvc_cli_test skeleton cases and test_pycvc_skeleton.py.
…dicates macOS builds without CVC_WITH_SHEWCHUK until its bundles exist; skeletonize then raises, so the test says so and exits 0, as the C++ tests skip.
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
# Conflicts: # bindings/pycvc/CMakeLists.txt # bindings/pycvc/pycvc.i # src/cvc/tests/port_tests.cmake
…ia p1/skeleton
Both conflicts are two features added side by side, kept both: - src/cvc-cli/main.cpp: the includes for param_cli.h (cvc skeleton) and input_trace.h (cvc trace). - src/cvc-cli/cvc_cli_test.cpp: the cvc skeleton tests, then the cvc trace tests.
#1203 gives every cvc command its app as an argument and removes cvc_app(). - src/cvc-cli/main.cpp: the conflict was cmd_skeleton beside cmd_tetrahedralize2's new signature; kept both, and cmd_skeleton takes cvc::app & like the rest. - cmd_trace (#1168) still had the old signature and called cvc_app(), so master's cvc-cli does not build; it takes cvc::app & too, the same change as the separate fix for master.
transfix
added a commit
that referenced
this pull request
Nov 15, 2026
…os, exp, sqrt or tanh on the GPU (#1219) * EWave: each mode's rates from a texture worked out in double, not sqrt and tanh in float cvcgl_ewave fails on the macOS package lanes (Apple Software Renderer): the GPU window drifts from the CPU one at a steady 4.2e-3 of the RMS height per second of simulated time, the same at dt 0.2 and 0.1, to 3e-2 by step 48 against a 1e-3 bound (#1171, job 131824127881). A per-step error in cos, sin or exp would double its rate when dt halves; a rate off by about 1e-3 (omega = sqrt(g kappa), kappa = k tanh(min(k d, 20))) does not. #1174's macOS package jobs were all cancelled, so it never showed there. The update pass now reads omega, kappa / omega, g / omega and the damping rate from an RGBA32F texture that init() fills in double with the CPU window's formulas (det::tanh), and takes only the cos, sin and exp of a step, so a new dt still costs nothing. On Windows (Intel Arc) cvcgl_ewave passes before and after: step 48 h 1.95e-5 before, 1.92e-5 after; the wall run 5.62e-5 before, 5.60e-5 after. * EWave: each step's coefficients and real-space factors from the host, no cos/sin/exp on the GPU The first try (fea1efb) moved each mode's rates to a texture worked out in double but left the step's cos, sin and exp in the shader. On macOS CI (Apple Software Renderer) cvcgl_ewave failed with the same numbers to the digit: h 3.05e-2 at step 48, the wall run 4.36e-2. So the rates were never the problem. A drift that grows per second of simulated time is what a sin or cos off in proportion to its small angle gives. Now the host works out, in double and only when dt or the mask changes, what ewave::prepare and ewave::step work out on the CPU: each mode's 2 x 2 update with its damping (RGBA32F) and each cell's real-space factor (R32F, the beach, the sponge and land). The update and real-space passes are multiply-adds only. A new dt costs that host work and an n^2 upload; the same dt costs nothing more. Windows (Intel Arc): cvcgl_ewave step 48 h 1.92e-5 -> 8.80e-6, phi -> 9.06e-6; the wall run 5.60e-5 -> 9.62e-6. So Intel's in-shader cos/sin/exp were most of its GPU-CPU difference too.
transfix
added a commit
that referenced
this pull request
Nov 15, 2026
#1171 (P1 part 3: skeleton.compute, cvc skeleton, pycvc) added its job to pycvc_jobs.i and its CLI tests to cvc_cli_test.cpp where this branch adds segment_seeded_job and the cvc segment tests. Both kept, segmentation first.
transfix
added a commit
that referenced
this pull request
Nov 15, 2026
- stream_intrinsics.cpp: the stream provider stays `any`, and #1236's raster verbs are a provider of their own, registered `host_proxied`: they are synchronous, raster-open and raster-publish write the raster's mirrors into the state tree raw (write_node), and one thread paints and publishes a raster, so in an `any` group they run on the host thread. Registered host_only (the default) they would have put every isolated document of an app with the stream verbs in a host-affinity group. - STATE_EXEC_THREADED.md: the raster verbs and #1171's skeleton provider in the provider table, and the file list.
transfix
added a commit
that referenced
this pull request
Nov 15, 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 3 of P1: the skeletonization's surfaces (
docs/roadmap/VOLROVER-LIBRARY-PORTS-ROADMAP.md§1.6–§1.8, §2), on the part 2 port in #1167.What lands
skeleton.compute, the DSL intrinsic (inc/cvc/geometry/skeleton_intrinsics.h,src/cvc/geometry/skeleton/skeleton_intrinsics.cpp)make_job_op<skeleton_params, skeleton>, so it gets the generic forms from P0b:skeleton.compute;skeleton.compute-async;skeleton.compute-start, which publishes the job keys;job.cancel.sliced_threading). The parameters come from the state tree through the table.strands,sheetsandhelixas geometry data objects;polylines,clusters,sheet_clusters;warnings.add_skeleton_intrinsics(app)registers it on the app under the"skeleton"provider key. No statics.cvc skeleton <input> -o <strands> [--sheets F] [--helix F] [--seconds S]add_param_options<skeleton_params>), with their units, ranges and docs in--help.<stem>_sheets<ext>unless--sheetsnames a file.-r→--robust;-bbr r→--big-ball-ratio r²(the legacy flag is a ratio of radii, the parameter a ratio of squares);-thif/-thffin degrees → radians;-plc→--sheet-count,-medth→--medial-theta,-medr→--medial-ratio.-mrand-hcare accepted and ignored with a note: the legacy code never reads them.pycvc (
pycvc_skeleton.i,pycvc_jobs.i)pycvc.skeletonize(geom, params=None, **keywords).pycvc.skeleton_paramsas a param table: keywords, validation, copy.pycvc.skeletonize_job(...), aresult_jobwithstep,cancelandtake.skeleton_errorcomes through asValueError.A
result_jobfix (inc/cvc/core/result_job.h)step()now reads the stepper's own final status beforetake().job.statuswas left at the last in-progress line. Now it ends as the stepper's summary, such asdone: 1 strands, 0 sheets (0 clusters).result_job_testgainsAStepperOwnStatusIsReadOnceDonefor it.Tests (§2's T10, T11 and T12)
skeleton_intrinsics_test. It is inCVC_PORT_TESTS, so it also runs on the wasm-mt ports lane.job.canceland a kill part-way through.skeleton.compute-startfrom anon:action under the default limits (not raised). Itsjob.progresstakes several values while the frame loop runs, and the result lands at the target.test_pycvc_skeleton.py.ValueError.cvc_cli_test. The help, a capsule (whose strands read back withcvc info), the legacy flags, and a plane that fails with a clear message (as does an out-of-range--threshold).Local runs:
skeleton_intrinsics_test9/9,result_job_test19/19,job_intrinsics_test21/21,cvc_cli_test --gtest_filter=*Skeleton*4/4,pycvc_skeleton,pycvc_jobs,pycvc_paramsskeleton_intrinsics_test9/9,result_job_test19/19,skeleton_test10/10macOS
macOS builds without
CVC_WITH_SHEWCHUKuntil #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, and every test skips cleanly:skeletonizeraises a clear error;GTEST_SKIP;Update 2026-11-12 (late): #1165 has merged, and master is merged into this branch (099dcc3). So this CI run is the first with
CVC_WITH_SHEWCHUKon macOS, and the tests run on Apple clang instead of skipping.Update 2026-11-13: in the
package-macos / libcvc-release-grpc-staticjob (job 131824127850), the configure step found Shewchuk's predicates. All 23 skeleton tests and the TetComplex tests passed on Apple clang. The job is still red, on two of master's tests and nothing in this PR:cvcgl_ewave: the GPU wave window drifts from the CPU one on Apple's software renderer. Fixed by EWave: the step's numbers worked out on the host in double, no sin, cos, exp, sqrt or tanh on the GPU #1219.cvcgl_shadow_pass_programs: one level over its 2-level tolerance, in 3 bytes, on Apple's GL. It failed all 3 attempts here, and fails now and then elsewhere. Fixed by cvcgl_shadow_pass_programs: on Apple's GL, up to 12 bytes may be more than 2 levels out #1222.package-macos isn't a required check, and PRs no longer run it (#1205).
Not in this PR
cvc execdoesn't seeskeleton.computeyet.cvc execbuilds its own scheduler and doesn't read the app's intrinsic providers.cvc execto the app's providers is P0a's per-app provider work, and it applies to every port's intrinsics, not only this one.