dimforge / dimforge/nphysics

FEMVolume `renumber_dofs` breaks kinematic indices

Open
#283 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.6k
Forks
120
PR merge metrics
No merged PRs in 30d

Description

Hello,

the `boundary_collider_desc` in `FEMVolume` method calls `renumber_dofs` under the hood, which appears to neglect to update the `kinematic_nodes`, causing the kinematic nodes to be scattered throughout the volume.

Minimal code example:
```
let mut fem_body = FEMVolumeDesc::cube(5, 2, 2)
.scale(Vector3::new(10.0, 0.5, 0.5))
.young_modulus(1.0e3)
.poisson_ratio(0.2)
.mass_damping(0.2)
.build();

let to_be_kinematized = fem_body.positions().iter().enumerate().filter_map(|(i,p)| {
if i % 3 == 0 && *p == -5.0 {
dbg!(p);
Some(i/3)
} else {
None
}
}).collect::>();

for i in to_be_kinematized.iter() {
fem_body.set_node_kinematic(*i, true);
}

let co = fem_body.boundary_collider_desc();

{
let pp = fem_body.positions();
dbg!(to_be_kinematized.iter().map(|i| {
[pp[i * 3], pp[i * 3 + 1], pp[i * 3 + 2]]
}).collect::>());
}
```
Observe, in the output from `dbg!`, that the x-coordinates are all over the place.

Contributor guide

No contributing guide indexed for this repository

Research direction

Trace FEMVolume::boundary_collider_desc into renumber_dofs, then compare the node remapping with the kinematic_nodes state described in the reproducer. Done means the selected kinematic nodes retain their identities after renumbering and the example no longer reports scattered x-coordinates.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.