File tree Expand file tree Collapse file tree 2 files changed +23
-4
lines changed
src/sofa/collisionAlgorithm/operations Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change 11#include < sofa/collisionAlgorithm/operations/NeedleOperations.h>
22
3- namespace sofa ::collisionAlgorithm::Operations::Needle {
3+ namespace sofa ::collisionAlgorithm::Operations::Needle
4+ {
45
5- // int register_Project_Edge = Operation::register_func<EdgeProximity>(&toolbox::EdgeToolBox::project);
6+ bool prunePointsUsingEdges (std::vector<BaseProximity::SPtr>& couplingPts,
7+ const EdgeElement::SPtr& edge)
8+ {
9+ const type::Vec3 edgeBase (edge->getP0 ()->getPosition ());
10+ const type::Vec3 tip (edge->getP1 ()->getPosition ());
611
12+ const type::Vec3 edgeDirection = tip - edgeBase;
13+ const type::Vec3 tip2Pt = couplingPts.back ()->getPosition () - tip;
14+
15+ // Positive dot product means the point is ahead of the tip
16+ if (dot (tip2Pt, edgeDirection) > 0_sreal) couplingPts.pop_back ();
17+
18+ return true ;
719}
820
21+ int register_PrunePointsAheadOfTip_Edge =
22+ PrunePointsAheadOfTip::register_func<EdgeElement>(&prunePointsUsingEdges);
23+ } // namespace sofa::collisionAlgorithm::Operations::Needle
Original file line number Diff line number Diff line change 22
33#include < sofa/collisionAlgorithm/BaseOperation.h>
44#include < sofa/collisionAlgorithm/BaseProximity.h>
5+ #include < sofa/collisionAlgorithm/elements/EdgeElement.h>
56
67namespace sofa ::collisionAlgorithm::Operations::Needle
78{
@@ -10,11 +11,11 @@ class PrunePointsAheadOfTip
1011 : public GenericOperation<PrunePointsAheadOfTip, // Type of the operation
1112 bool , // Default return type
1213 std::vector<BaseProximity::SPtr>&,
13- const BaseProximity ::SPtr& // Parameters
14+ const BaseElement ::SPtr& // Parameters
1415 >
1516{
1617 public:
17- bool defaultFunc (std::vector<BaseProximity::SPtr>&, const BaseProximity ::SPtr&) const override
18+ bool defaultFunc (std::vector<BaseProximity::SPtr>&, const BaseElement ::SPtr&) const override
1819 {
1920 return false ;
2021 }
@@ -27,4 +28,7 @@ class PrunePointsAheadOfTip
2728 }
2829};
2930
31+ bool prunePointsUsingEdges (std::vector<BaseProximity::SPtr>& couplingPts,
32+ const EdgeElement::SPtr& edgeProx);
33+
3034} // namespace sofa::collisionAlgorithm::Operations::Needle
You can’t perform that action at this time.
0 commit comments