iMSTK
Interactive Medical Simulation Toolkit
imstkPbdObjectCollision.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 "imstkCollisionInteraction.h"
10 #include "imstkMacros.h"
11 
12 namespace imstk
13 {
14 class PbdObject;
15 
23 {
24 public:
28  PbdObjectCollision(std::shared_ptr<PbdObject> obj1, std::shared_ptr<CollidingObject> obj2,
29  std::string cdType = "");
30 
31  ~PbdObjectCollision() override = default;
32 
33  IMSTK_TYPE_NAME(PbdObjectCollision)
34 
35 
36  void setRestitution(const double restitution);
40  double getRestitution() const;
42 
47  void setFriction(const double friction);
48  double getFriction() const;
50 
55  bool getUseCorrectVelocity() const;
56  void setUseCorrectVelocity(const bool useCorrectVelocity);
58 
64  void setRigidBodyCompliance(const double compliance);
65  double getRigidBodyCompliance() const;
67 
73  void setDeformableStiffnessA(const double stiffness);
74  double getDeformableStiffnessA() const;
75  void setDeformableStiffnessB(const double stiffness);
76  double getDeformableStiffnessB() const;
78 
82  void initGraphEdges(std::shared_ptr<TaskNode> source, std::shared_ptr<TaskNode> sink) override;
83 
84 protected:
85  std::shared_ptr<TaskNode> m_updatePrevGeometryCCDNode = nullptr;
86 
87 private:
89  void setupConnections(std::shared_ptr<PbdObject> obj1, std::shared_ptr<CollidingObject> obj2,
90  std::string cdType = "");
91 };
92 } // namespace imstk
void setRigidBodyCompliance(const double compliance)
Get/Set compliance of rigid body contacts. Defaults to 0 compliance/infinitely stiff. This is what is needed most of the time but sometimes making a contact a bit softer can be helpful.
bool getUseCorrectVelocity() const
Get/Set whether velocity is corrected (in some cases this could cause instabilities) ...
void setDeformableStiffnessA(const double stiffness)
Get/Set stiffness of deformable contacts. Defaults to 1.0. This is what is needed most of the time bu...
Compound Geometry.
PbdObjectCollision(std::shared_ptr< PbdObject > obj1, std::shared_ptr< CollidingObject > obj2, std::string cdType="")
Constructor for PbdObject-PbdObject or PbdObject-CollidingObject collisions.
Abstract class for defining collision interactions between objects.
This class defines a collision interaction between two PbdObjects or PbdObject & CollidingObject.
void setFriction(const double friction)
Get/Set the friction, which gives how much velocity is removed along the tangents during contact...
void setRestitution(const double restitution)
Get/Set the restitution, which gives how much velocity is removed along the contact normals during co...
void initGraphEdges()
Initializes the edges of the SceneObject&#39;s computational graph.