iMSTK
Interactive Medical Simulation Toolkit
imstkPortHoleInteraction.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 #include "imstkComponent.h"
8 #include "imstkMath.h"
9 
10 #pragma once
11 
12 namespace imstk
13 {
14 class Geometry;
15 class PbdConstraint;
16 class PbdObject;
17 class PbdRigidLineToPointConstraint;
18 class TaskNode;
19 
30 {
31 public:
32  PortHoleInteraction(const std::string& name = "PortHoleInteraction");
33 
34  void init() override;
35 
39  std::shared_ptr<PbdObject> getTool() const { return m_toolObject; }
40  void setTool(std::shared_ptr<PbdObject> toolObject);
42 
46  std::shared_ptr<Geometry> getToolGeometry() const { m_toolGeom; }
47  void setToolGeometry(std::shared_ptr<Geometry> toolGeom);
49 
53  const Vec3d& getPortHoleLocation() const { return m_portHoleLocation; }
54  void setPortHoleLocation(const Vec3d& portHoleLocation) { m_portHoleLocation = portHoleLocation; }
56 
61  double getCompliance() const { return m_compliance; }
62  void setCompliance(const double compliance) { m_compliance = compliance; }
64 
65 protected:
66  void handlePortHole();
67 
68  void initGraphEdges(std::shared_ptr<TaskNode> source, std::shared_ptr<TaskNode> sink) override;
69 
70  std::shared_ptr<PbdObject> m_toolObject = nullptr;
71  std::shared_ptr<Geometry> m_toolGeom = nullptr;
72  Vec3d m_portHoleLocation = Vec3d::Zero();
73  double m_compliance = 0.0001;
74 
75  std::shared_ptr<PbdRigidLineToPointConstraint> m_portConstraint = nullptr;
76  std::vector<PbdConstraint*> m_constraints;
77 
78  std::shared_ptr<TaskNode> m_portHoleHandleNode = nullptr;
79  std::shared_ptr<TaskNode> m_collisionGeometryUpdateNode = nullptr;
80 };
81 } // namespace imstk
void init() override
Initialize the component, called at a later time after all component construction is complete...
const Vec3d & getPortHoleLocation() const
Get/Set the port hole location to constrain the geometry too.
Compound Geometry.
A Behaviour represents a single component system A template is used here for UpdateInfo to keep the C...
std::shared_ptr< Geometry > getToolGeometry() const
Get/Set the tool geometry used for constraining.
double getCompliance() const
Get/Set constraint compliance. This effects how stiff the constraint of the line to.
std::shared_ptr< PbdObject > getTool() const
Get/Set the tool to be constrained.
Defines the behaviour to constrain a PbdObject LineMesh or Capsule to a fixed port hole location...