7 #include "NeedleInteraction.h" 8 #include "imstkArcNeedle.h" 9 #include "imstkCollisionDetectionAlgorithm.h" 10 #include "imstkImplicitGeometry.h" 11 #include "imstkLineMesh.h" 12 #include "imstkPuncturable.h" 13 #include "imstkRigidObject2.h" 14 #include "imstkTaskGraph.h" 15 #include "NeedleRigidBodyCH.h" 17 using namespace imstk;
19 NeedleInteraction::NeedleInteraction(std::shared_ptr<CollidingObject> tissueObj,
20 std::shared_ptr<RigidObject2> needleObj,
21 const std::string& collisionName) :
24 CHECK(needleObj->containsComponent<
ArcNeedle>())
25 <<
"NeedleInteraction only works with objects that have a ArcNeedle component";
27 <<
"NeedleInteraction only works with objects that have a Puncturable component";
28 CHECK(std::dynamic_pointer_cast<ImplicitGeometry>(tissueObj->getCollidingGeometry()) !=
nullptr)
29 <<
"NeedleInteraction only works with SDF colliding geometry on colliding tissueObj";
35 auto needleRbdCH = std::make_shared<NeedleRigidBodyCH>();
36 needleRbdCH->setInputRigidObjectA(needleObj);
37 needleRbdCH->setInputCollidingObjectB(tissueObj);
38 needleRbdCH->setInputCollisionData(getCollisionDetection()->getCollisionData());
39 needleRbdCH->setBaumgarteStabilization(0.01);
40 setCollisionHandlingA(needleRbdCH);
Place this on an object to make it puncturable by a needle. This allows puncturables to know they've ...