iMSTK
Interactive Medical Simulation Toolkit
imstkPbdRigidBaryPointToPointConstraint.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 "imstkPbdBaryPointToPointConstraint.h"
10 #include "imstkRbdConstraint.h"
11 
12 namespace imstk
13 {
14 // Define constraint Note: can be given to either solver
15 // Single point, build multiple of them for each entity in contact
17 {
18 public:
19  PbdRigidBaryPointToPointConstraint(std::shared_ptr<RigidBody> obj1);
20  ~PbdRigidBaryPointToPointConstraint() override = default;
21 
22  IMSTK_TYPE_NAME(PbdRigidBaryPointToPointConstraint);
23 
30  bool computeValueAndGradient(PbdState& bodies,
31  double& c, std::vector<Vec3d>& dcdx) override;
32 
33  // Constraint call for RBD
34  // Give change in impulse in direction of desired deformation
35  void compute(double dt) override;
36 
40  double getRestValue() const { return 0.0; }
41 
42 private:
43  double m_beta = 0.0001;
44  mutable Vec3d m_diff = Vec3d::Zero();
45 };
46 } // namespace imstk
Abstract class for rigid body constraints. A RbdConstraint should mainly provide a constraint jacobia...
Compound Geometry.
bool computeValueAndGradient(PbdState &bodies, double &c, std::vector< Vec3d > &dcdx) override
Compute value and gradient of constraint function.
Provides interface for accessing particles from a 2d array of PbdBody,Particles.
Definition: imstkPbdBody.h:229
Constrains two points from two separate cells/elements given via barycentric coordinates to be coinci...
double getRestValue() const
Return the rest configuration for the constraint.
void compute(double dt) override
Compute constraint jacobian.