iMSTK
Interactive Medical Simulation Toolkit
|
Public Member Functions | |
PbdRigidBaryPointToPointConstraint (std::shared_ptr< RigidBody > obj1) | |
IMSTK_TYPE_NAME (PbdRigidBaryPointToPointConstraint) | |
bool | computeValueAndGradient (PbdState &bodies, double &c, std::vector< Vec3d > &dcdx) override |
Compute value and gradient of constraint function. More... | |
void | compute (double dt) override |
Compute constraint jacobian. | |
double | getRestValue () const |
Return the rest configuration for the constraint. | |
![]() | |
double | getRestLength () const |
void | setRestLength (const double length) |
Vec3d | computeInterpolantDifference (PbdState &bodies) const |
void | initConstraintToRest (PbdState &bodies, const std::vector< PbdParticleId > &ptIdsA, const std::vector< double > &weightsA, const std::vector< PbdParticleId > &ptIdsB, const std::vector< double > &weightsB, const double stiffnessA, const double stiffnessB) |
initialize constraint with current distance between the points as the resting length More... | |
void | initConstraint (const std::vector< PbdParticleId > &ptIdsA, const std::vector< double > &weightsA, const std::vector< PbdParticleId > &ptIdsB, const std::vector< double > &weightsB, const double stiffnessA, const double stiffnessB, const double restLength=0.0) |
Initialize the constraint. | |
bool | computeValueAndGradient (PbdState &bodies, double &c, std::vector< Vec3d > &dcdx) override |
Compute value and gradient of constraint function. More... | |
double | getRestValue () const |
Return the rest configuration for the constraint. | |
![]() | |
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. | |
void | setStiffnessA (const double stiffnessA) |
double | getStiffnessB () const |
void | setStiffnessB (const double stiffnessB) |
void | setEnableBoundaryCollisions (const double enableBoundaryCollisions) |
Get enableBoundaryCollision. | |
const double | getEnableBoundaryCollisions () const |
![]() | |
virtual const std::string | getTypeName () const =0 |
std::vector< PbdParticleId > & | getParticles () |
Get the vertex indices of the constraint. | |
bool | getCorrectVelocity () const |
Get/Set whether velocity should be corrected for this constraint. | |
void | setCorrectVelocity (const bool correctVelocity) |
const Vec3d & | getGradient (const int i) const |
Get gradient given the particle index in constraint. | |
double | getForce (const double dt) const |
Get the force magnitude, valid after solving lambda Only valid with xpbd. | |
double | getConstraintC () const |
Get constraint value C (how much the constraint is violated) | |
double | getLambda () const |
Get constraint value C (how much the constraint is violated) | |
void | zeroOutLambda () |
Zero's out the lagrange multplier before integration only used for xpbd, must be called before solving. | |
virtual void | correctVelocity (PbdState &bodies, const double dt) |
Correct velocities according to friction and restitution Corrects according to the gradient direction. | |
double | computeGeneralizedInvMass (const PbdState &bodies, const size_t particleIndex) const |
Compute generalized inverse mass of the particle. Note perf sensitive function. It has been intentionally inlined. More... | |
double | computeGeneralizedInvMass (const PbdState &bodies, const size_t particleIndex, const Vec3d &r) const |
Compute generalized inverse mass of the particle. More... | |
double | getRestitution () const |
Get/Set restitution. | |
void | setRestitution (const double restitution) |
double | getFriction () const |
Get/Set friction. | |
void | setFriction (const double friction) |
double | getStiffness () const |
Get/Set the stiffness. | |
void | setStiffness (const double stiffness) |
double | getCompliance () const |
Get/Set the compliance This function is also provided in case users need 0 compliance. | |
void | setCompliance (const double compliance) |
![]() | |
virtual const std::string | getTypeName () const =0 |
Additional Inherited Members | |
![]() | |
enum | SolverType { xPBD = 0, PBD } |
Type of solvers. | |
![]() | |
enum | Side { A, B, AB } |
![]() | |
Eigen::Matrix< double, 3, 4 > | J = Eigen::Matrix<double, 3, 4>::Zero() |
Jacobian, "vanish" to zero. | |
double | vu = 0.0 |
Bauhmgarte stabilization term. | |
double | range [2] = { 0.0, std::numeric_limits<double>::max() } |
std::shared_ptr< RigidBody > | m_obj1 = nullptr |
std::shared_ptr< RigidBody > | m_obj2 = nullptr |
Side | m_side = Side::AB |
![]() | |
PbdCollisionConstraint (const int numParticlesA, const int numParticlesB) | |
![]() | |
PbdConstraint (const size_t numParticles) | |
![]() | |
RbdConstraint (std::shared_ptr< RigidBody > rbd1, std::shared_ptr< RigidBody > rbd2, const Side side) | |
![]() | |
double | m_restLength = 0.0 |
std::vector< double > | m_weights |
![]() | |
std::vector< bool > | m_bodiesSides |
Stores 0 or 1 to indicate side of particle. | |
std::array< double, 2 > | m_stiffness = { 1.0, 1.0 } |
bool | m_enableBoundaryCollisions = false |
![]() | |
std::vector< PbdParticleId > | m_particles |
body, particle index | |
std::vector< Vec3d > | m_dcdx |
Normalized constraint gradients (per particle) | |
double | m_stiffness = 1.0 |
used in PBD, [0, 1] | |
double | m_compliance = 1e-7 |
used in xPBD, inverse of Stiffness | |
double | m_lambda = 0.0 |
Lagrange multiplier. | |
double | m_C = 0.0 |
Constraint Value. | |
double | m_friction = 0.0 |
double | m_restitution = 0.0 |
bool | m_correctVelocity = false |
Definition at line 16 of file imstkPbdRigidBaryPointToPointConstraint.h.
|
overridevirtual |
Compute value and gradient of constraint function.
compute value and gradient of constraint function and weight it by half to force the motion to the half way point between two bodies
[in,out] | set | of bodies involved in system |
[in,out] | c | constraint value |
[in,out] | dcdx | constraint gradient |
[in,out] | c | constraint value |
[in,out] | dcdxA | constraint gradient for A |
[in,out] | dcdxB | constraint gradient for B |
Implements imstk::PbdConstraint.
Definition at line 28 of file imstkPbdRigidBaryPointToPointConstraint.cpp.