iMSTK
Interactive Medical Simulation Toolkit
imstkPbdDihedralConstraint.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 {
19 {
20 public:
22 
23  IMSTK_TYPE_NAME(PbdDihedralConstraint)
24 
25 
41  void initConstraint(
42  const Vec3d& p0, const Vec3d& p1, const Vec3d& p2, const Vec3d& p3,
43  const PbdParticleId& pIdx0, const PbdParticleId& pIdx1,
44  const PbdParticleId& pIdx2, const PbdParticleId& pIdx3,
45  const double k);
46 
53  bool computeValueAndGradient(PbdState& bodies,
54  double& c, std::vector<Vec3d>& dcdx) override;
55 
59  double getRestValue() const { return m_restAngle; }
60 
61 public:
62  double m_restAngle = 0.0;
63 };
64 } // namespace imstk
std::pair< int, int > PbdParticleId
Index pair that refers to a particle in a PbdState. Index 0 is the body id, Index 1 is the particle i...
Compound Geometry.
double getRestValue() const
Return the rest configuration for the constraint.
Base Constraint class for Position based dynamics constraints.
Angular constraint between two triangular faces.
void initConstraint(const Vec3d &p0, const Vec3d &p1, const Vec3d &p2, const Vec3d &p3, const PbdParticleId &pIdx0, const PbdParticleId &pIdx1, const PbdParticleId &pIdx2, const PbdParticleId &pIdx3, const double k)
initConstraint p3 / | \ / | \ p0 | p1 \ | / \ | / p2
Provides interface for accessing particles from a 2d array of PbdBody,Particles.
Definition: imstkPbdBody.h:229
bool computeValueAndGradient(PbdState &bodies, double &c, std::vector< Vec3d > &dcdx) override
Compute value and gradient of the constraint.