Add missing C API bindings#1633
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1633 +/- ##
==========================================
+ Coverage 95.22% 95.24% +0.02%
==========================================
Files 34 34
Lines 7657 7657
==========================================
+ Hits 7291 7293 +2
+ Misses 366 364 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
IIRC the usage of the shared ptrs should be guarded by a mutex, so operations should be thread safe. I haven't really looked into that (I should have), but if it is not thread safe we should fix that. |
|
Good point — I took a look and it seems like That said, this is orthogonal to the bindings PR, so I'll remove the thread safety comment from this PR and follow up with a separate issue to discuss the fix. (A |
3d536ac to
4efccc1
Compare
New bindings:
- manifold_get_tolerance, manifold_set_tolerance, manifold_simplify,
manifold_num_prop_vert
- manifold_meshgl{,64}_tolerance, _run_flags_length, _run_flags,
_num_run, _update_normals
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
4efccc1 to
bd92b98
Compare
elalish
left a comment
There was a problem hiding this comment.
Thank you! Our original C API contributor is long gone, so it's great to see this getting some love.
I'm also excited to see the Rust bindings you're working on - we've had several users interested in having that. It'll be great to add to the list when it's ready.
Summary
ManifoldandMeshGL/MeshGL64methods that had no C binding:
manifold_get_tolerance,manifold_set_tolerance,manifold_simplify,manifold_num_prop_vertmanifold_meshgl{,64}_tolerance,_run_flags_length,_run_flags,_num_run,_update_normalsaccess, even read-only, due to lazy evaluation with mutable internal state.
Motivation
These gaps were found while building manifold-csg,
a new Rust FFI binding to the C API. Missing accessors for
runFlags,tolerance,NumRun, andUpdateNormalsprevent lossless round-tripping ofMeshGLdata.GetTolerance/SetTolerance/Simplifyare useful publicManifoldmethodswith no C-side equivalent (
manifold_epsilonexists but calls theGetEpsilontesting hook rather than the public
GetTolerance).The thread safety note documents the
mutable shared_ptrlazy-evaluationpattern in
ManifoldandCrossSection, which is relevant for FFI consumersthat need to decide whether concurrent read access is safe (it isn't).
Test plan
tolerance,num_prop_vert,meshgl_run_accessors,meshgl_update_normals)🤖 Generated with Claude Code