diff --git a/src/mesa_pd/data/shape/Box.h b/src/mesa_pd/data/shape/Box.h index 7cc5606785586fea4c1156a3bb796b5fc34a1456..cb67d2d6306c9f09d18aa3f26ae893d4754233e5 100644 --- a/src/mesa_pd/data/shape/Box.h +++ b/src/mesa_pd/data/shape/Box.h @@ -61,7 +61,10 @@ void Box::updateMassAndInertia(const real_t density) edgeLength_[0]*edgeLength_[0] + edgeLength_[2]*edgeLength_[2] , edgeLength_[0]*edgeLength_[0] + edgeLength_[1]*edgeLength_[1] ) * (m / static_cast<real_t>( 12 )); + mass_ = m; invMass_ = real_t(1.0) / m; + + inertiaBF_ = I; invInertiaBF_ = I.getInverse(); } diff --git a/src/mesa_pd/data/shape/CylindricalBoundary.h b/src/mesa_pd/data/shape/CylindricalBoundary.h index abe3bca759184a7f8f167ebdc2d5cffb67a7634c..81a04d7e47daf073d6a09616f85369f209838d15 100644 --- a/src/mesa_pd/data/shape/CylindricalBoundary.h +++ b/src/mesa_pd/data/shape/CylindricalBoundary.h @@ -59,8 +59,11 @@ private: inline void CylindricalBoundary::updateMassAndInertia(const real_t /*density*/) { - invMass_ = real_t(0.0); - invInertiaBF_ = Mat3(real_t(0.0)); + mass_ = std::numeric_limits<real_t>::infinity(); + invMass_ = real_t(0); + + inertiaBF_ = Mat3(std::numeric_limits<real_t>::infinity()); + invInertiaBF_ = Mat3(real_t(0)); } inline diff --git a/src/mesa_pd/data/shape/Ellipsoid.h b/src/mesa_pd/data/shape/Ellipsoid.h index 8ff9411852f7f08de766a5409b31cc5e68a05d5d..7101209cbc2d29e7d9f5fb394686545af0169662 100644 --- a/src/mesa_pd/data/shape/Ellipsoid.h +++ b/src/mesa_pd/data/shape/Ellipsoid.h @@ -61,7 +61,9 @@ void Ellipsoid::updateMassAndInertia(const real_t density) real_c(0.2) * m * (semiAxes_[2] * semiAxes_[2] + semiAxes_[0] * semiAxes_[0]), real_c(0.2) * m * (semiAxes_[0] * semiAxes_[0] + semiAxes_[1] * semiAxes_[1])); + mass_ = m; invMass_ = real_t(1.0) / m; + inertiaBF_ = I; invInertiaBF_ = I.getInverse(); }