[Constraint] Improve initialization and state validation in StopperLagrangianConstraint#5935
Open
alxbilger wants to merge 1 commit intosofa-framework:masterfrom
Open
[Constraint] Improve initialization and state validation in StopperLagrangianConstraint#5935alxbilger wants to merge 1 commit intosofa-framework:masterfrom
alxbilger wants to merge 1 commit intosofa-framework:masterfrom
Conversation
…grangianConstraint
bakpaul
reviewed
Feb 4, 2026
Comment on lines
+47
to
+53
| helper::WriteAccessor<Data<VecCoord> > xData = *this->mstate->write(core::vec_id::write_access::position); | ||
| VecCoord& x = xData.wref(); | ||
| if (x[d_index.getValue()].x() < d_min.getValue()) | ||
| x[d_index.getValue()].x() = (Real) d_min.getValue(); | ||
| if (x[d_index.getValue()].x() > d_max.getValue()) | ||
| x[d_index.getValue()].x() = (Real) d_max.getValue(); | ||
|
|
Contributor
There was a problem hiding this comment.
I get that this is just the old code refactored. But I find it intriguing that a lagrangian constraint is performing a pure projection at init. Nobody asked for this. I would remove this because it might create very bad internal stress in some cases.
Contributor
Author
There was a problem hiding this comment.
This projection is here since the introduction of the component (9be66af)
If we remove the projection, we can remove the entire init method.
Contributor
There was a problem hiding this comment.
I would advocate for it. Let the constraint solver do the work instead of doing something unrelated before the solving...
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.
By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).
Reviewers will merge this pull-request only if