iMSTK
Interactive Medical Simulation Toolkit
imstkNeedle.h
1 /*
2 ** This file is part of the Interactive Medical Simulation Toolkit (iMSTK)
3 ** iMSTK is distributed under the Apache License, Version 2.0.
4 ** See accompanying NOTICE for details.
5 */
6 
7 #pragma once
8 
9 #include "imstkComponent.h"
10 #include "imstkPuncture.h"
11 
12 namespace imstk
13 {
20 class Needle : public Component
21 {
22 public:
23  Needle(const std::string& name = "Needle") : Component(name) { }
24  ~Needle() override = default;
25 
29  void setPuncture(const PunctureId& id, std::shared_ptr<Puncture> data);
30  std::shared_ptr<Puncture> getPuncture(const PunctureId& id);
32 
38  void setState(const PunctureId& id, const Puncture::State state);
39  Puncture::State getState(const PunctureId& id);
41 
42  PunctureMap& getPunctures() { return m_punctures; }
43 
47  bool getInserted() const;
48 
52  virtual Vec3d getNeedleDirection() const { return Vec3d(1.0, 0.0, 0.0); }
53  virtual Vec3d getNeedleTip() const { return Vec3d(0.0, 0.0, 0.0); }
54 
55 protected:
56  PunctureMap m_punctures;
57 };
58 } // namespace imstk
Compound Geometry.
virtual Vec3d getNeedleDirection() const
Returns direction at needle tip.
Definition: imstkNeedle.h:52
void setPuncture(const PunctureId &id, std::shared_ptr< Puncture > data)
Get/Set puncture data.
Definition: imstkNeedle.cpp:12
Base for all needles in imstk it supports global puncture state, per object puncture state...
Definition: imstkNeedle.h:20
void setState(const PunctureId &id, const Puncture::State state)
Get/set puncture state. This can be done through data too but this supports the allocation of new pun...
Definition: imstkNeedle.cpp:29
Represents a part of an entity, involved in a system. The component system is doubly linked meaning t...
std::tuple< int, int, int > PunctureId
Punctures are identified via three ints. The needle id, the puncturable id, and a local id that allow...
Definition: imstkPuncture.h:21
bool getInserted() const
Get if inserted at all.
Definition: imstkNeedle.cpp:46