iMSTK
Interactive Medical Simulation Toolkit
imstkRbdContactConstraint.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 "imstkRbdConstraint.h"
10 #include "imstkMacros.h"
11 
12 namespace imstk
13 {
20 {
21 public:
23  std::shared_ptr<RigidBody> obj1,
24  std::shared_ptr<RigidBody> obj2,
25  const Vec3d& contactN,
26  const Vec3d& contactPt,
27  const double contactDepth,
28  const double beta = 0.05,
29  const Side side = Side::AB) : RbdConstraint(obj1, obj2, side),
30  m_contactPt(contactPt), m_contactN(contactN),
31  m_contactDepth(contactDepth), m_beta(beta)
32  {
33  }
34 
35  ~RbdContactConstraint() override = default;
36 
37  IMSTK_TYPE_NAME(RbdContactConstraint);
38 
39 public:
40  void compute(double dt) override;
41 
42 private:
43  Vec3d m_contactPt;
44  Vec3d m_contactN;
45  double m_contactDepth;
46  double m_beta = 0.05;
47 };
48 } // namespace imstk
Abstract class for rigid body constraints. A RbdConstraint should mainly provide a constraint jacobia...
Compound Geometry.
A hard rigid body constraint to prevent intersection.
void compute(double dt) override
Compute constraint jacobian.