Skip to content

Commit 4e64e68

Browse files
committed
[algorithm] update algorithm logic
1 parent ee940a4 commit 4e64e68

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/sofa/collisionAlgorithm/algorithm/InsertionAlgorithm.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,12 @@ class InsertionAlgorithm : public BaseAlgorithm
216216
const BaseProximity::SPtr tipProx = createTipProximity(itTip->element());
217217
if (!tipProx) return;
218218

219+
// Remove coupling points that are ahead of the tip in the insertion direction
220+
ElementIterator::SPtr itShaft = l_shaftGeom->begin(l_shaftGeom->getSize() - 2);
221+
auto prunePointsAheadOfTip =
222+
Operations::Needle::PrunePointsAheadOfTip::get(itShaft->getTypeInfo());
223+
prunePointsAheadOfTip(m_couplingPts, itShaft->element());
224+
219225
// 2.1 Check whether coupling point should be added
220226
const type::Vec3 tip2Pt = m_couplingPts.back()->getPosition() - tipProx->getPosition();
221227
if (tip2Pt.norm() > d_tipDistThreshold.getValue())
@@ -248,11 +254,6 @@ class InsertionAlgorithm : public BaseAlgorithm
248254
}
249255
else // Don't bother with removing the point that was just added
250256
{
251-
// Remove coupling points that are ahead of the tip in the insertion direction
252-
ElementIterator::SPtr itShaft = l_shaftGeom->begin(l_shaftGeom->getSize() - 2);
253-
auto prunePointsAheadOfTip =
254-
Operations::Needle::PrunePointsAheadOfTip::get(itShaft->getTypeInfo());
255-
prunePointsAheadOfTip(m_couplingPts, itShaft->element());
256257
}
257258
}
258259

0 commit comments

Comments
 (0)