Skip to content

Commit c8bd748

Browse files
committed
[algorithm] edgeProx in if check
1 parent fb4e2c7 commit c8bd748

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/sofa/collisionAlgorithm/algorithm/InsertionAlgorithm.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,14 @@ class InsertionAlgorithm : public BaseAlgorithm
235235
Operations::CreateCenterProximity::Operation::get(itShaft->getTypeInfo());
236236
const BaseProximity::SPtr shaftProx = createShaftProximity(itShaft->element());
237237
const EdgeProximity::SPtr edgeProx = dynamic_pointer_cast<EdgeProximity>(shaftProx);
238-
const type::Vec3 normal = (edgeProx->element()->getP1()->getPosition() -
239-
edgeProx->element()->getP0()->getPosition())
240-
.normalized();
241-
if (dot(tip2Pt, normal) > 0_sreal) {
242-
m_couplingPts.pop_back();
238+
if(edgeProx)
239+
{
240+
const type::Vec3 normal = (edgeProx->element()->getP1()->getPosition() -
241+
edgeProx->element()->getP0()->getPosition())
242+
.normalized();
243+
if (dot(tip2Pt, normal) > 0_sreal) {
244+
m_couplingPts.pop_back();
245+
}
243246
}
244247
}
245248
}

0 commit comments

Comments
 (0)