Skip to content

Commit

Permalink
Revert "[model] missing normalize force direction (#263)"
Browse files Browse the repository at this point in the history
This reverts commit 6e06e88.
  • Loading branch information
EulalieCoevoet committed Feb 9, 2024
1 parent c5b3b37 commit 76c3a41
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/SoftRobots/component/constraint/model/CableModel.inl
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ void CableModel<DataTypes>::bwdInit()
return;
}


// The initial length of the cable is set or computed in bwdInit so the mapping (if there is any)
// will be considered

Expand Down Expand Up @@ -442,6 +443,7 @@ void CableModel<DataTypes>::computePointsActionArea()
computeBarycentric(closestTriangle, closestProjectionOnTriangle, m_alphaBarycentric[i], m_betaBarycentric[i]);
m_closestTriangle[i] = closestTriangle;


}
else
{
Expand Down Expand Up @@ -644,6 +646,7 @@ void CableModel<DataTypes>::buildConstraintMatrix(const ConstraintParams* cParam

if(!m_hasSlidingPoint)
{

if ( d_hasPullPoint.getValue())
{
Deriv direction = DataTypes::coordDifference(d_pullPoint.getValue(),positions[d_indices.getValue()[0]]);
Expand Down Expand Up @@ -675,6 +678,7 @@ void CableModel<DataTypes>::buildConstraintMatrix(const ConstraintParams* cParam
for(unsigned int j=0; j<m_areaIndices[0].size(); j++)
rowIterator.setCol(m_areaIndices[1][j], - direction*m_ratios[0][j]);
}

}
}
else
Expand Down Expand Up @@ -703,7 +707,6 @@ void CableModel<DataTypes>::buildConstraintMatrix(const ConstraintParams* cParam
directionAhead.normalize();

Deriv slidingDirection = directionBeyond - directionAhead;
slidingDirection.normalize();
if (d_hasPullPoint.getValue())
{
if (id_method == 0)
Expand Down Expand Up @@ -746,15 +749,16 @@ void CableModel<DataTypes>::buildConstraintMatrix(const ConstraintParams* cParam
directionAhead.normalize();

Deriv slidingDirection = directionBeyond - directionAhead;
slidingDirection.normalize();

if (id_method == 0)
rowIterator.setCol(currentIndex, slidingDirection);
else
{
for(unsigned int j=0; j<m_areaIndices[i].size(); j++)
rowIterator.setCol(m_areaIndices[i][j], slidingDirection*m_ratios[i][j]);
}
}


}
else // end point of the cable
{
Expand Down

0 comments on commit 76c3a41

Please sign in to comment.