-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SofaConstraint] ADD control on constraint force in UniformConstraint #1027
[SofaConstraint] ADD control on constraint force in UniformConstraint #1027
Conversation
…orce to zero or restPosition
:d_iterative(initData(&d_iterative, true, "iterative", "Iterate over the bilateral constraints, otherwise a block factorisation\ | ||
is computed.")) | ||
:d_iterative(initData(&d_iterative, true, "iterative", "Iterate over the bilateral constraints, otherwise a block factorisation is computed.")) | ||
,d_constraintRestPos(initData(&d_constraintRestPos, false, "constraintRestPos", "if false, constraint the pos to be zero / if true constraint the current position to stay at rest position")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a verb... constrainToRestPos
resV->set(m_constraintIndex + i*N + j, vfree[i][j] + invDt * pos[i][j] ); | ||
} | ||
if (d_constraintRestPos.getValue()){ | ||
computeViolation(resV, m_constraintIndex, vfree, Deriv::size(),[&invDt,&pos,&vfree,&restPos](int i, int j) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lambda 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lambda is indeed nice but the indentation is strange.
I'd suggest
computeViolation( resV, m_constraintIndex, vfree, Deriv::size(), [&invDt, &pos, &vfree, &restPos](int i, int j) {
return vfree[i][j] + invDt * ( pos[i][j] - restPos[i][j] );
});
Hello Youness, Thank for the PR, could you explain abit if this is a new version of the one made by @ChristianDuriez (#1022) |
[ci-build][with-scene-tests][with-regression-tests] |
Force the constraint force to zero or restPosition
As @damienmarchal said, this is a new version of what Christian proposed in PR #1022 the only difference is that Damien propose to change all the for loops (inside the getConstraintViolation function) by one lambda function. And I will complete this PR next weeks by doing this in all constraints component.
This PR:
Reviewers will merge only if all these checks are true.