Skip to content
Snippets Groups Projects
Commit 7cd51270 authored by Lukas Werner's avatar Lukas Werner
Browse files

Fixed mass and inertia for some shapes

parent d9578f8f
No related merge requests found
...@@ -61,7 +61,10 @@ void Box::updateMassAndInertia(const real_t density) ...@@ -61,7 +61,10 @@ void Box::updateMassAndInertia(const real_t density)
edgeLength_[0]*edgeLength_[0] + edgeLength_[2]*edgeLength_[2] , edgeLength_[0]*edgeLength_[0] + edgeLength_[2]*edgeLength_[2] ,
edgeLength_[0]*edgeLength_[0] + edgeLength_[1]*edgeLength_[1] ) * (m / static_cast<real_t>( 12 )); edgeLength_[0]*edgeLength_[0] + edgeLength_[1]*edgeLength_[1] ) * (m / static_cast<real_t>( 12 ));
mass_ = m;
invMass_ = real_t(1.0) / m; invMass_ = real_t(1.0) / m;
inertiaBF_ = I;
invInertiaBF_ = I.getInverse(); invInertiaBF_ = I.getInverse();
} }
......
...@@ -59,8 +59,11 @@ private: ...@@ -59,8 +59,11 @@ private:
inline inline
void CylindricalBoundary::updateMassAndInertia(const real_t /*density*/) void CylindricalBoundary::updateMassAndInertia(const real_t /*density*/)
{ {
invMass_ = real_t(0.0); mass_ = std::numeric_limits<real_t>::infinity();
invInertiaBF_ = Mat3(real_t(0.0)); invMass_ = real_t(0);
inertiaBF_ = Mat3(std::numeric_limits<real_t>::infinity());
invInertiaBF_ = Mat3(real_t(0));
} }
inline inline
......
...@@ -61,7 +61,9 @@ void Ellipsoid::updateMassAndInertia(const real_t density) ...@@ -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_[2] * semiAxes_[2] + semiAxes_[0] * semiAxes_[0]),
real_c(0.2) * m * (semiAxes_[0] * semiAxes_[0] + semiAxes_[1] * semiAxes_[1])); real_c(0.2) * m * (semiAxes_[0] * semiAxes_[0] + semiAxes_[1] * semiAxes_[1]));
mass_ = m;
invMass_ = real_t(1.0) / m; invMass_ = real_t(1.0) / m;
inertiaBF_ = I;
invInertiaBF_ = I.getInverse(); invInertiaBF_ = I.getInverse();
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment