Repository navigation
Allow user-provided vertex and edge areas in CollisionMesh - #273
Conversation
- Add set_vertex_areas/set_edge_areas (and Python property setters) - Reject bad sizes and non-finite or non-positive areas - Make custom areas and area Jacobians mutually exclusive - Document weighted use of initial_barrier_stiffness Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #273 +/- ##
==========================================
- Coverage 96.93% 96.93% -0.01%
==========================================
Files 194 194
Lines 17349 17377 +28
Branches 944 948 +4
==========================================
+ Hits 16817 16844 +27
- Misses 532 533 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks a lot for the quick answer. I have tried it on our axisymmetric setup: macOS arm64, Python 3.13, built from source with pip. It works. Setters
Weights
One request: allow zero areas. The setters require strictly positive values. In an axisymmetric model, the edges lying on the symmetry axis (r = 0) have zero ring area, and so does a vertex whose only edges lie on the axis. These primitives can legitimately sit in the collision mesh, e.g. a full solid of revolution whose extracted boundary includes the axis segment. Their zero weight is exactly what we want. Would accepting Version. The branch reports On |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Axisymmetric primitives on the symmetry axis have no ring area, and their zero weight is the correct result. Zero-weight collisions are dropped when the collisions are built, so they exert no contact force. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Thanks for testing this so thoroughly, and for the exact comparison against your loop. Zero areas: done in 8ef9135. The setters now accept finite, non-negative values; negative, NaN and infinite values are still rejected. Collisions whose weight is zero are dropped when the collision set is built, so primitives on the symmetry axis contribute no force and cost nothing. You shouldn't need the positive floor anymore. Version: |
|
That is perfect thank you very much! Best regards, |
Description
Adds setters for the vertex and edge areas of
CollisionMesh, so users can supply their own quadrature weights (e.g.,2πR·dsfor axisymmetric models) instead of the barycentric areas.set_vertex_areas/set_edge_areasin C++;vertex_areas/edge_areasare now read/write properties in Python.NormalCollisions::buildalready reads weights from these areas whenuse_area_weightingis on, so the weights reach the collisions with no per-collision loop. They also survive the rebuild insideogc.TrustRegion::update_if_needed, and merged vertex-vertex terms stay exact.average_mass / mean(weight)adjustment forinitial_barrier_stiffnesswith weighted collisions. Adaptive stiffness was designed for unweighted collisions; with area weighting and a physical barrier, κ is a material parameter in Young's-modulus units.API changes
CollisionMesh::set_vertex_areas(VectorXd)andCollisionMesh::set_edge_areas(VectorXd).mesh.vertex_areas = ...andmesh.edge_areas = ...now work. The getters still return read-only views, somesh.vertex_areas *= fandmesh.vertex_areas[i] = xraise. Usemesh.vertex_areas = f * mesh.vertex_areas.Limitations
init_area_jacobians()already ran, andinit_area_jacobians()throws once custom areas are set. This avoids silently inconsistent gradients.Fixes #266
Type of change
How Has This Been Tested?
[areas]: scaled areas give scaled collision weights; invalid input is rejected; the Jacobian guard throws in both orderspython/tests/test_collision_mesh.py: same behavior through the bindings, plus read-only getterTest Configuration:
Checklist