Repository navigation
libigl-backed geometry processing and P1 finite elements (CVC_ENABLE_LIBIGL) - #591
Merged
Merged
Conversation
…IBIGL) New Eigen-free public API backed by libigl's MPL-2.0 core (header-only) and Eigen 5: - inc/cvc/geometry/mesh_ops.h: angle/area-weighted normals, orient_outward (real winding fix, what reorient() was meant to do), repair (weld by true distance, degenerate/unreferenced removal, attribute remapping), principal / mean / Gaussian curvature, implicit cotangent smoothing (+ uniform, Taubin), mesh_locator (AABB closest point, scale-free double-precision ray casting, fast-winding-number signed distance and winding number), heat-method geodesics with a cached solver, tet volumes / orientation / boundary surface / isosurface / planar slices, and colormaps (built-in tables without libigl). - inc/cvc/geometry/fem.h: P1 FEM on tets or triangle surfaces: stiffness and mass matrices, gradients, Poisson, Laplace, backward-Euler heat with progress/cancel, Laplacian eigenmodes (dense up to 400 vertices, else a shift-invert subspace iteration on SimplicialLDLT); degenerate elements are dropped from assembly. - cvc::sdf gains SDF_IGL (exact distance, FWN sign, any grid dims; cvc-cli `-a igl`, pycvc enum), and geometry::project() uses exact closest points when libigl is enabled (the CGAL path, with its edge-clamp bug, stays as the fallback). Build: option CVC_ENABLE_LIBIGL (default ON, auto-OFF when Eigen3/libigl are missing; the API then throws mesh_ops_unavailable). The finds run under CMAKE_FIND_PACKAGE_PREFER_CONFIG because CGAL's FindEigen3 cannot parse Eigen 5. All Eigen/libigl code lives in src/cvc/geometry/igl/ (no cvc headers) and builds as cvc_igl: a private static archive for a shared cvc, so template instantiations stay out of cvc.dll's export table (+248 exports total), or an OBJECT library compiled into a static cvc. Serial libigl loops on single-threaded wasm only. New gtests: mesh_ops_test (39), fem_test (16) and a cvc_igl packaging check.
GeometryNode can colour a mesh by a per-vertex scalar field: setScalarField / setScalarRange / setColorMap / clearScalarField / hasScalarField / scalarRange, plus state keys color_by (none, colors, function, k1, k2, mean, gaussian), colormap, scalar_min and scalar_max, so .ari documents and ImGui bindings can drive it with no glue. Colours are computed on the CPU with cvc::colormap_rgb into the existing 3-channel uchar array (WebGL-safe); range/colormap changes recolour in place without a rebuild, and the field survives render-mode and use_single_color rebuilds. Curvature kinds read geometry::curvatures() or compute them once via cvc::compute_curvature when libigl is available; meshes with no surface triangles get no field. TETS render mode now draws the outward boundary surface (cvc::tet_boundary_surface, all points kept so per-vertex fields still line up) instead of the wireframe placeholder, falling back to edges without libigl. pycvc_gl gains set_scalar_field / set_color_map / scalar_range. Tests: cvcgl_scalar_field (incl. a rendered-pixel check that skips without GL) and cvcgl_tet_surface (headless), both with libigl-on and -off branches.
…mponents
Two cvcGL scene node types, registered from register_cvcgl_extensions when
libcvc has CVC_ENABLE_LIBIGL (a document with `customs: required` fails fast
otherwise):
- mesh_lab: loads geometry like a `geometry` node, seeds node-scoped
<node>.mesh_ops.* keys from its props, and runs smooth (cvc::smooth),
decimate (cvc::simplify), repair, orient and curvature requests on a
per-node async_lane, colouring by mean/gaussian/k1/k2 curvature or heat
geodesic distance (cached solver) through GeometryNode::setScalarField.
- fe_lab: tet-meshes a volume source with LBIE (the SDF is negated first:
LBIE meshes {v > iso}, verified empirically), orients the tets, solves
Poisson or backward-Euler heat (hot floor, progress + Stop), and shows the
field on the boundary surface and a movable slice child (<id>_slice).
Commands use a request-key convention (a button writes <node>.mesh_ops.request
or <node>.fe.request; the node's tick consumes it), documented in ARIADNE.md.
New components mesh_tools.ari and fe_controls.ari, INDEX.ari entries (plus the
missing forest/sea/sky ones), and a mesh_lab.ari demo for ariadne_hello.
Also: `source: { sdf: { algorithm: v1|v2|igl } }` (default v2; igl falls back
to v2 without libigl); scene_realize helpers (fit_to_ground,
read_node_geometry, load_node_volume, sdf_volume_from_mesh) promoted out of
the anonymous namespace; AriRuntime now calls register_cvcgl_extensions so
pycvc-hosted documents get custom node types; ARIADNE.md section 5.3 example
fixed to real loader syntax.
Tests: mesh_lab/fe_lab sections in cvcgl_ariadne_realize (decimate, curvature
and geodesic colouring, tet-meshing the bunny SDF, Poisson, heat, stop,
auto_solve queueing, slice visibility) and AriadneComponents.
ShippedComponentsLoadClean, which loads every shipped component from the
source tree and checks the INDEX catalog.
… notices - docs/roadmap/LIBIGL-GEOMETRY-FE-ROADMAP.md: how libigl upgrades geometry processing and FE work in libcvc: decisions, what phase 1 delivers, an audit of current geometry defects with file:line, the phase 2-4 plan (recipe/CI wiring, pycvc bindings, AABB picking, tet data-path fixes, wasm rollout, CGAL reduction, volrover3 geometry_ops backend, deformation), what not to do, licensing, and the cvcpkg publish runbook. - docs/GEOMETRY_API.md: a "Mesh Operations and Finite Elements (libigl)" reference for mesh_ops.h / fem.h, SDF_IGL and the exact project(); stale statements fixed (copy-on-write, 13 array types, smoothing signature and behaviour, enum names, sdf/iso/tetrahedralize signatures, the LBIE side of the isovalue, tet-orientation loss on decode). - THIRD_PARTY_NOTICES.md: Eigen 5.0.1 (MPL-2.0 plus the Apache-2.0 BFloat16.h, BSD, COLAMD and SuperLU notices actually compiled in) and libigl 2.6.4 core (MPL-2.0, MIT FastWindingNumberForSoups, public-domain raytri.c), with the Apache-2.0 question flagged for an owner decision. - WATER-RENDERING-ROADMAP.md: a dated note at D-W6 that an FEM consumer now exists.
transfix
added a commit
that referenced
this pull request
Oct 26, 2026
…BLE_LIBIGL in CI (#799) #591 landed mesh_ops.h / fem.h behind CVC_ENABLE_LIBIGL, but the libcvc recipe never declared eigen or libigl, so every install-deps-based lane (PR CI, ci-recipe, publish, release/nightly) configured with the option auto-OFF: CI never compiled the libigl code and the published libcvc bundles ship the throwing stubs. The bundles now exist on cvcpkg.org for every libcvc platform (eigen 5.0.1+cvc.1 and libigl 2.6.4+cvc.2, release/shared: linux x86_64 + arm64, macos arm64 + x86_64, windows x86_64; cy-pca/cvcpkg#145, #148), and every lane fetches release deps (Windows is release-only), so declare them as runtime deps of libcvc (scoped to linux/macos/windows, like pocketfft) and libcvc-cuda. CVC_ENABLE_LIBIGL flips itself OFF when the packages are missing, which would pass green while testing nothing, so the package-linux/macos/windows test steps now fail unless MeshOps.* / Fem.* tests are registered (the same guard the cvcgl_* tests already have).
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.
Brings libigl (MPL-2.0 core module only, header-only) and Eigen 5 into libcvc behind
CVC_ENABLE_LIBIGL. They back an Eigen-free geometry / finite-element API and are used from cvcGL and Ariadne. Companion recipes: cy-pca/cvcpkg#145. The design rationale, current-state audit and phase plan are indocs/roadmap/LIBIGL-GEOMETRY-FE-ROADMAP.md.What's in it (4 commits)
inc/cvc/geometry/mesh_ops.handfem.h, both Eigen-free.orient_outward(an actual winding fix),repair.mesh_locator(AABB closest point, scale-free double-precision ray casting, fast-winding-number signed distance).cvc::sdfgetsSDF_IGL(exact distance, robust sign on open meshes, any grid dimensions;cvc sdf -a igl).geometry::project()uses exact closest points when libigl is enabled. The CGAL path, including its edge-clamp bug, stays as the fallback.GeometryNodescalar-field colouring:setScalarField/setColorMap/setScalarRange, plus state keyscolor_by,colormap,scalar_min,scalar_max.mesh_labnode type: smooth, decimate, repair, orient, and curvature or geodesic colouring, run off the render thread.fe_labnode type: LBIE tet mesh, then a Poisson or heat solve, with the field shown on the surface and on a movable slice.mesh_tools.ariandfe_controls.aricomponents, and amesh_lab.aridemo.sdf: { algorithm: igl }.AriRuntimenow registers the cvcGL extensions.Build design
CVC_ENABLE_LIBIGLdefaults ON and switches itself OFF if Eigen3 or libigl is missing; the API then throwscvc::mesh_ops_unavailable. The finds run underCMAKE_FIND_PACKAGE_PREFER_CONFIG, because CGAL'sFindEigen3.cmakecannot parse Eigen 5's version.src/cvc/geometry/igl/, which includes no cvc headers, and builds ascvc_igl.cvc_iglis a private static archive, so the template instantiations stay out ofcvc.dll's export table. The measured cost is +248 exports (47,084 in total).cvc_iglis an OBJECT library compiled intolibcvc.a.cvcTargets.cmake.Verification (Windows, MSVC 19.44, Release)
MAGICK_*coder-path environment as ci.yml. Separately, I found two pre-existing issues, both unrelated to this PR:hexahedralize --improve optimization. Master-era code crashed 9 times in 400 runs, so it predates this branch. It makesCvcCliTest.Regression_MeshImproveMethodsNoCrashflaky.magick_io.cpp'sCVC_DEPS_PREFIXfallback doesn't locate the coders when running from a build tree.cvc_iglpackaging check pass.CVC_ENABLE_LIBIGL=OFF(what CI builds until the bundles are published): cvc, cvcGL and the touched tests build and pass. The cvcGL tests also exercise their no-libigl branches.mesh_ops.cppandfem.cppcleanly, with libigl on and off.Follow-up in this PR
CI currently builds with libigl auto-OFF, because the eigen and libigl bundles aren't on cvcpkg.org yet. Once cy-pca/cvcpkg#145 is merged and the bundles are published, a commit here will:
eigenandlibigltocvcpkg/recipes/libcvc(runtime, scoped to linux, macos and windows);CVC_ENABLE_LIBIGLresolved ON.Owner decision
Eigen/Corealways includes the Apache-2.0BFloat16.h, so it gets compiled into the LGPL-2.1-onlycvc.dll. This is flagged in THIRD_PARTY_NOTICES and in roadmap §6.