9 #include "imstkNeedle.h" 10 #include "imstkPbdCollisionHandling.h" 11 #include "imstkPbdObject.h" 12 #include "imstkPuncturable.h" 14 using namespace imstk;
31 const std::vector<CollisionElement>& elementsA,
32 const std::vector<CollisionElement>& elementsB)
override 35 auto needle = getInputObjectB()->getComponent<
Needle>();
38 if ((elementsA.size() > 0 || elementsB.size() > 0)
39 && needle->getState(punctureId) == Puncture::State::REMOVED)
41 needle->setState(punctureId, Puncture::State::TOUCHING);
42 puncturable->
setPuncture(punctureId, needle->getPuncture(punctureId));
46 if (needle->getState(punctureId) == Puncture::State::TOUCHING)
Implements PBD based collision handling. Given an input PbdObject and CollisionData it creates & adds...
PunctureId getPunctureId(std::shared_ptr< Needle > needle, std::shared_ptr< Puncturable > puncturable, const int supportId)
Get puncture id between needle and puncturable.
Place this on an object to make it puncturable by a needle. This allows puncturables to know they've ...
void handle(const std::vector< CollisionElement > &elementsA, const std::vector< CollisionElement > &elementsB) override
Add collision constraints based off contact data.
void handle(const std::vector< CollisionElement > &elementsA, const std::vector< CollisionElement > &elementsB) override
Handle the input collision data. Elements will be flipped (if needed) such that elementsA corresponds...
Base for all needles in imstk it supports global puncture state, per object puncture state...
std::shared_ptr< CollidingObject > getInputObjectA() const
Get the input objects.
void setPuncture(const PunctureId &id, std::shared_ptr< Puncture > data)
Get/Set puncture data.
Handles penetration constraints for the needle and the thread by creating a set of puncture points th...
std::tuple< int, int, int > PunctureId
Punctures are identified via three ints. The needle id, the puncturable id, and a local id that allow...