diff --git a/Source/Controllers/imstkRigidObjectController.cpp b/Source/Controllers/imstkRigidObjectController.cpp index ad35d45ea7c39bb958911fdb685a18f205399d5c..5c73de57731dc52e7e2848bdccc13ed67657ecc9 100644 --- a/Source/Controllers/imstkRigidObjectController.cpp +++ b/Source/Controllers/imstkRigidObjectController.cpp @@ -75,15 +75,15 @@ RigidObjectController::update(const double dt) const Vec3d& devicePos = getPosition(); const Quatd& deviceOrientation = getOrientation(); - const Vec3d& deviceOffset = Vec3d(0.0, 0.0, 0.0); + const Vec3d& deviceOffset = Vec3d(0.0, 0.0, 0.0); // If using critical damping automatically compute kd if (m_useCriticalDamping) { - const double mass = m_rigidObject->getRigidBody()->getMass(); + const double mass = m_rigidObject->getRigidBody()->getMass(); const double linearKs = m_linearKs.maxCoeff(); m_linearKd = 2.0 * std::sqrt(mass * linearKs); - + const Mat3d inertia = m_rigidObject->getRigidBody()->getIntertiaTensor(); // Currently kd is not a 3d vector though it could be. // So here we make an approximation. Either: @@ -92,10 +92,10 @@ RigidObjectController::update(const double dt) // Both may behave weird on anistropic inertia tensors //const double inertiaScale = inertia.eigenvalues().real().maxCoeff(); const double inertiaScale = std::cbrt(inertia.determinant()); - const double angularKs = m_angularKs.maxCoeff(); + const double angularKs = m_angularKs.maxCoeff(); m_angularKd = 2.0 * std::sqrt(inertiaScale * angularKs); } - + // If kd > 2 * sqrt(mass * ks); The system is overdamped (may be intentional) // If kd < 2 * sqrt(mass * ks); The system is underdamped (never intended) diff --git a/Source/Controllers/imstkRigidObjectController.h b/Source/Controllers/imstkRigidObjectController.h index 201c54814a23a2d870d9b7896054256cc4d140a5..d483f623fc6d04b8a3570c4fe1c5f77c9510702f 100644 --- a/Source/Controllers/imstkRigidObjectController.h +++ b/Source/Controllers/imstkRigidObjectController.h @@ -174,8 +174,8 @@ protected: Vec3d m_tS = Vec3d::Zero(); Vec3d m_tD = Vec3d::Zero(); - double m_forceScaling = 0.0000075; - bool m_useSpring = true; ///> If off, pos & orientation directly set + double m_forceScaling = 0.0000075; + bool m_useSpring = true; ///> If off, pos & orientation directly set bool m_useCriticalDamping = true; ///> If on, kd is automatically computed bool m_forceSmoothening = true;