• Advertisement
Sign in to follow this  

Capsule Moment Of Inertia

This topic is 4578 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This is how it's done in Open Dynamics Engine (ODE), and it work well for me too =D

void dMassSetCappedCylinder (dMass *m, dReal density, int direction,
dReal radius, dReal length)
dReal M1,M2,Ia,Ib;
dUASSERT (direction >= 1 && direction <= 3,"bad direction number");
dMassSetZero (m);
M1 = M_PI*radius*radius*length*density; // cylinder mass
M2 = (REAL(4.0)/REAL(3.0))*M_PI*radius*radius*radius*density; // total cap mass
m->mass = M1+M2;
Ia = M1*(REAL(0.25)*radius*radius + (REAL(1.0)/REAL(12.0))*M1*length*length) +
M2*(REAL(0.4)*radius*radius + REAL(0.375)*radius*length + REAL(0.25)*length*length);
Ib = (M1*REAL(0.5) + M2*REAL(0.4))*radius*radius;
m->_I(0,0) = Ia;
m->_I(1,1) = Ia;
m->_I(2,2) = Ia;
m->_I(direction-1,direction-1) = Ib;

# ifndef dNODEBUG
checkMass (m);
# endif

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement