1 #ifndef ROBOTICS_INERTIA_H 2 #define ROBOTICS_INERTIA_H 5 #include <KrisLibrary/math3d/geometry3d.h> 23 inline void BoxInertiaMatrix(Real x,Real y,Real z,Real m,
Matrix3& I)
26 I(0,0) = m*(Sqr(y)+Sqr(z))/12.0;
27 I(1,1) = m*(Sqr(x)+Sqr(z))/12.0;
28 I(2,2) = m*(Sqr(x)+Sqr(y))/12.0;
32 inline void SphereInertiaMatrix(Real r,Real m,
Matrix3& I)
35 I(0,0) = I(1,1) = I(2,2) = 0.4*Sqr(r)*m;
39 inline void HollowSphereInertiaMatrix(Real r,Real m,
Matrix3& I)
42 I(0,0) = I(1,1) = I(2,2) = 2.0/3.0*Sqr(r)*m;
46 inline void EllipsoidInertiaMatrix(Real x,Real y,Real z,Real m,
Matrix3& I)
49 I(0,0) = m*(Sqr(y)+Sqr(z))*0.2;
50 I(1,1) = m*(Sqr(x)+Sqr(z))*0.2;
51 I(2,2) = m*(Sqr(x)+Sqr(y))*0.2;
55 inline void CylinderInertiaMatrix(Real r,Real h,Real m,
Matrix3& I)
58 I(0,0) = I(1,1) = m*(Sqr(h)/12.0+Sqr(r)/4.0);
59 I(2,2) = m*Sqr(r)*0.5;
63 inline void CapsuleInertiaMatrix(Real r,Real h,Real m,
Matrix3& I)
69 Real b = 4.0/3.0*Pi*r*r*r;
70 Real density = m/(a+b);
73 I(0,0) = I(1,1) = M1*(0.25*Sqr(r) + Sqr(h)/12.0) + M2*(0.4*Sqr(r) + 0.375*r*h + 0.25*Sqr(h));
74 I(2,2) = (M1*0.5 + M2*0.4)*Sqr(r);
A generic geometric primitive class.
Definition: geometry3d.h:32
A 3D vector class.
Definition: math3d/primitives.h:136
Class declarations for useful 3D math types.
Contains all the definitions in the Math3D package.
Definition: AnyGeometry.h:12
void setCrossProduct(const Vector3 &)
sets the matrix that performs the vector cross product
Definition: math3d/primitives.h:1898
A 3x3 matrix class.
Definition: math3d/primitives.h:469
Contains all definitions in the Math package.
Definition: WorkspaceBound.h:12