7 #include "imstkPuncturable.h" 8 #include "imstkEntity.h" 9 #include "imstkNeedle.h" 16 m_punctures[id] = data;
19 std::shared_ptr<Puncture>
22 auto iter = m_punctures.find(
id);
23 if (iter == m_punctures.end())
25 m_punctures[id] = std::make_shared<Puncture>();
27 return m_punctures[id];
31 Puncturable::getPunctured()
const 33 for (
auto puncture : m_punctures)
35 if (puncture.second->state == Puncture::State::INSERTED)
45 std::shared_ptr<Puncturable> puncturable,
48 std::shared_ptr<Entity> needleEntity = needle->getEntity().lock();
49 std::shared_ptr<Entity> puncturableEntity = puncturable->getEntity().lock();
50 CHECK(needleEntity !=
nullptr) <<
"Cannot generate puncture id without needle entity";
51 CHECK(puncturableEntity !=
nullptr) <<
"Cannot generate puncture id without puncturable entity";
52 return { needleEntity->getID(), puncturableEntity->getID(), supportId };
PunctureId getPunctureId(std::shared_ptr< Needle > needle, std::shared_ptr< Puncturable > puncturable, const int supportId)
Get puncture id between needle and puncturable.
void setPuncture(const PunctureId &id, std::shared_ptr< Puncture > data)
Get/Set puncture data.
std::tuple< int, int, int > PunctureId
Punctures are identified via three ints. The needle id, the puncturable id, and a local id that allow...