iMSTK
Interactive Medical Simulation Toolkit
imstkLinearProjectionConstraint.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 "imstkMath.h"
10 
11 namespace imstk
12 {
19 {
20 public:
21  LinearProjectionConstraint(const size_t& nodeId, const bool isFixed = false);
22  LinearProjectionConstraint() = delete;
23 
24  ~LinearProjectionConstraint() = default;
25 
26  static const std::string getStaticTypeName() { return "LinearProjectionConstraint"; }
27  const std::string getTypeName() const { return "LinearProjectionConstraint"; }
28 
32  void setProjection(const size_t& nodeId, const Vec3d& p, const Vec3d& q = Vec3d::Zero());
33 
37  void setProjectionToLine(const size_t& nodeId, const Vec3d& p);
38 
42  void setProjectorToDirichlet(const size_t& nodeId);
43  void setProjectorToDirichlet(const unsigned int& nodeId, const Vec3d z);
44 
48  void reset();
49 
53  inline void setValue(const Vec3d& v) { m_value = v; }
54 
58  inline const Mat3d& getProjector() const { return m_projection; }
59 
63  inline const Vec3d& getValue() const { return m_value; }
64 
68  inline const size_t& getNodeId() const { return m_nodeId; }
69 
73  inline bool isFixed() const { return m_isFixedConstraint; }
74 
75 private:
76  size_t m_nodeId;
77  bool m_isFixedConstraint;
78  Mat3d m_projection;
79  Vec3d m_value;
80 };
81 } // imstk
const size_t & getNodeId() const
Get the node id.
Compound Geometry.
const Mat3d & getProjector() const
Get the projector.
const Vec3d & getValue() const
Get the value.
void setProjectionToLine(const size_t &nodeId, const Vec3d &p)
Form the projection.
void setProjectorToDirichlet(const size_t &nodeId)
Set the projector to simulate Dirichlet conditions.
void setValue(const Vec3d &v)
Set the value in the restricted subspace.
void setProjection(const size_t &nodeId, const Vec3d &p, const Vec3d &q=Vec3d::Zero())
Form the projection.
void reset()
Reset the linear projector.
bool isFixed() const
Returns true if the constraint is fixed.