Skip to content

[RodStraightSection] Fix rest shape double-offset for non-first sections#224

Open
lkarstensen wants to merge 1 commit intosofa-framework:masterfrom
lkarstensen:fix/issue-223-rod-straight-section-rest-shape
Open

[RodStraightSection] Fix rest shape double-offset for non-first sections#224
lkarstensen wants to merge 1 commit intosofa-framework:masterfrom
lkarstensen:fix/issue-223-rod-straight-section-rest-shape

Conversation

@lkarstensen
Copy link
Copy Markdown

Summary

Fixes #223.

RodStraightSection::getRestTransformOnX computed the rest position as x_start + x_used, but x_used is already the global curvilinear abscissa. This placed rest-shape nodes at 2 * x_start + local_offset instead of x_used for any section that is not the first in the wireMaterials list.

Example (stiff section 420 mm + flex section 30 mm):

x_start x_used Old result Correct
Section 0 0 210 210 ✓ 210
Section 1 420 430 850 430

The ~420 mm offset between rest shape and mechanical DOFs caused AdaptiveBeamForceFieldAndMass to generate huge elastic restoring forces every timestep, leading to simulation explosion on any disturbance (e.g. vessel-wall contact).

Fix

// Before
global_H_local.set(type::Vec3(x_start + x_used, 0.0, 0.0), Quat());

// After
global_H_local.set(type::Vec3(x_used, 0.0, 0.0), Quat());

This matches the pattern already used correctly by RodSpireSection and RodMeshSection. Zero effect on single-section wires (x_start = 0).

…ons (sofa-framework#223)

x_used is the global curvilinear abscissa; adding x_start again placed
the rest node at 2*x_start + local_offset instead of x_used. For wires
with two or more RodStraightSections this produced enormous elastic
restoring forces at every timestep, causing simulation explosion.

Fix: use x_used directly, consistent with RodSpireSection and RodMeshSection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RodStraightSection::getRestTransformOnX places rest-shape node at wrong position for non-first sections

1 participant