9 #include "imstkRbdConstraint.h" 11 using namespace imstk;
22 std::shared_ptr<RigidBody> obj,
25 const double beta = 0.05) :
RbdConstraint(obj,
nullptr, Side::A),
26 m_beta(beta), m_fixedPt(fixedPt),
39 J = Eigen::Matrix<double, 3, 4>::Zero();
40 if ((m_side == Side::AB || m_side == Side::A) && !m_obj1->m_isStatic)
43 const Vec3d axes = (*m_q - *m_p).normalized();
44 const Vec3d diff = m_fixedPt - *m_p;
45 const Vec3d vecToLine = (diff - diff.dot(axes) * axes);
46 const Vec3d dirToLine = vecToLine.normalized();
48 vu = vecToLine.norm() * m_beta / dt;
49 J(0, 0) = dirToLine[0]; J(0, 1) = 0.0;
50 J(1, 0) = dirToLine[1]; J(1, 1) = 0.0;
51 J(2, 0) = dirToLine[2]; J(2, 1) = 0.0;
Abstract class for rigid body constraints. A RbdConstraint should mainly provide a constraint jacobia...
void compute(double dt) override
Compute constraint jacobian.
Constraints the line p, q to the fixedPt by rotating p and q.