We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent afda3a8 commit 2fbd7adCopy full SHA for 2fbd7ad
1 file changed
src/sofa/collisionAlgorithm/operations/NeedleOperations.cpp
@@ -6,10 +6,18 @@ namespace sofa::collisionAlgorithm::Operations::Needle
6
bool prunePointsUsingEdges(std::vector<BaseProximity::SPtr>& couplingPts,
7
const EdgeElement::SPtr& edge)
8
{
9
+ if (!edge)
10
+ {
11
+ msg_warning("Needle::PrunePointsAheadOfTip")
12
+ << "Null element pointer in prunePointsUsingEdges; returning false";
13
+ return false;
14
+ }
15
const type::Vec3 edgeBase(edge->getP0()->getPosition());
16
const type::Vec3 tip(edge->getP1()->getPosition());
17
18
const type::Vec3 edgeDirection = tip - edgeBase;
19
+
20
+ if (couplingPts.empty()) return true;
21
const type::Vec3 tip2Pt = couplingPts.back()->getPosition() - tip;
22
23
// Positive dot product means the point is ahead of the tip
0 commit comments