Skip to content

Commit e963681

Browse files
committed
[algorithm] Added comments
1 parent 7e6dc02 commit e963681

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/sofa/collisionAlgorithm/algorithm/InsertionAlgorithm.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace sofa::collisionAlgorithm
1616

1717
class InsertionAlgorithm : public BaseAlgorithm
1818
{
19-
public:
19+
public:
2020
SOFA_CLASS(InsertionAlgorithm, BaseAlgorithm);
2121

2222
typedef core::behavior::MechanicalState<defaulttype::Vec3Types> MechStateTipType;
@@ -223,6 +223,8 @@ class InsertionAlgorithm : public BaseAlgorithm
223223
auto projectOnVol = Operations::Project::Operation::get(l_volGeom);
224224
const BaseProximity::SPtr volProx =
225225
findClosestProxOnVol(tipProx, l_volGeom.get(), projectOnVol, getFilterFunc());
226+
// Proximity can be detected before the tip enters the tetra (e.g. near a boundary face)
227+
// Only accept proximities if the tip is inside the tetra during insertion
226228
if (volProx)
227229
{
228230
TetrahedronProximity::SPtr tetProx =
@@ -253,6 +255,8 @@ class InsertionAlgorithm : public BaseAlgorithm
253255
const type::Vec3 normal = (edgeProx->element()->getP1()->getPosition() -
254256
edgeProx->element()->getP0()->getPosition())
255257
.normalized();
258+
// If the coupling point lies ahead of the tip (positive dot product),
259+
// the needle is retreating. The last coupling point is removed
256260
if (dot(tip2Pt, normal) > 0_sreal)
257261
{
258262
m_couplingPts.pop_back();

0 commit comments

Comments
 (0)