Skip to content

Commit

Permalink
[model] missing normalize force direction
Browse files Browse the repository at this point in the history
  • Loading branch information
EulalieCoevoet committed Jan 29, 2024
1 parent 7aa1f09 commit 939eeb8
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/SoftRobots/component/constraint/model/CableModel.inl
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ 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 @@ -443,7 +442,6 @@ void CableModel<DataTypes>::computePointsActionArea()
computeBarycentric(closestTriangle, closestProjectionOnTriangle, m_alphaBarycentric[i], m_betaBarycentric[i]);
m_closestTriangle[i] = closestTriangle;


}
else
{
Expand Down Expand Up @@ -646,7 +644,6 @@ 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 @@ -678,7 +675,6 @@ 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 @@ -707,6 +703,7 @@ 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 @@ -749,16 +746,15 @@ 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 939eeb8

Please sign in to comment.