iMSTK
Interactive Medical Simulation Toolkit
imstkPbdCollisionConstraint.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 "imstkPbdConstraint.h"
10 
11 namespace imstk
12 {
29 {
30 public:
31  ~PbdCollisionConstraint() override = default;
32 
33  IMSTK_TYPE_NAME(PbdCollisionConstraint)
34 
35 public:
39  double getStiffnessA() const { return m_stiffness[0]; }
40  void setStiffnessA(const double stiffnessA) { m_stiffness[0] = stiffnessA; }
41  double getStiffnessB() const { return m_stiffness[1]; }
42  void setStiffnessB(const double stiffnessB) { m_stiffness[1] = stiffnessB; }
44 
48  void setEnableBoundaryCollisions(const double enableBoundaryCollisions) { m_enableBoundaryCollisions = enableBoundaryCollisions; }
49  const double getEnableBoundaryCollisions() const { return m_enableBoundaryCollisions; }
51 
55  void projectConstraint(PbdState& bodies,
56  const double dt, const SolverType& type) override;
57 
58 protected:
59  PbdCollisionConstraint(const int numParticlesA, const int numParticlesB);
60 
61  std::vector<bool> m_bodiesSides;
62  std::array<double, 2> m_stiffness = { 1.0, 1.0 };
66 };
67 } // namespace imstk
The PbdCollisionConstraint implements two sided collision. This allows the usage of differing stiffne...
Compound Geometry.
std::vector< bool > m_bodiesSides
Stores 0 or 1 to indicate side of particle.
void projectConstraint(PbdState &bodies, const double dt, const SolverType &type) override
Performs the actual positional solve.
double getStiffnessA() const
Get/Set stiffness A or B.
Base Constraint class for Position based dynamics constraints.
void setEnableBoundaryCollisions(const double enableBoundaryCollisions)
Get enableBoundaryCollision.
SolverType
Type of solvers.
Provides interface for accessing particles from a 2d array of PbdBody,Particles.
Definition: imstkPbdBody.h:229