9 #include "imstkPbdDistanceConstraint.h" 10 #include "imstkPbdConstraintFunctor.h" 51 void setRestLength(
const double restLength) {
m_restLength = restLength; }
52 const double getRestLength()
const {
return m_restLength; }
54 void setInitRestLength(
const double initRestLength) { m_initialRestLength = initRestLength; }
55 const double getInitRestLength()
const {
return m_initialRestLength; }
61 void resetStiffness() {
m_stiffness = m_initialStiffness; }
63 bool isInflated()
const {
return m_inflated; }
64 void setInflated() { m_inflated =
true; }
67 double m_initialRestLength = 0.0;
68 double m_initialStiffness = 1.0;
69 double m_diffusionRate = 0.00001;
71 bool m_inflated =
false;
85 int i1,
int i2)
override 87 auto constraint = std::make_shared<PbdInflatableDistanceConstraint>();
88 constraint->initConstraint(vertices[i1], vertices[i2],
89 { m_bodyIndex, i1 }, { m_bodyIndex, i2 },
m_stiffness);
double m_restLength
Rest length between the nodes.
void projectConstraint(PbdState &bodies, const double dt, const SolverType &type) override
Apply diffusion and update positions.
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...
void initConstraint(const Vec3d &p0, const Vec3d &p1, const PbdParticleId &pIdx0, const PbdParticleId &pIdx1, const double k=1e5)
Initialize the constraint with resting length as the length between the two points.
Distance constraints between two nodal points.
std::shared_ptr< PbdDistanceConstraint > makeDistConstraint(const VecDataArray< double, 3 > &vertices, int i1, int i2) override
Create the distance constraint.
void initConstraint(const Vec3d &p0, const Vec3d &p1, const PbdParticleId &pIdx0, const PbdParticleId &pIdx1, const double k=1e5)
Initializes the inflatable distance constraint.
double m_stiffness
used in PBD, [0, 1]
SolverType
Type of solvers.
void resetRestLength()
Reset constraint rest measurement.
PbdDistanceConstraintFunctor generates constraints between the edges of the input TetrahedralMesh...
virtual void projectConstraint(PbdState &bodies, const double dt, const SolverType &type)
Update positions by projecting constraints.
Provides interface for accessing particles from a 2d array of PbdBody,Particles.