BoiledPotato
- 2
- 0
Parallel axis theorem, cube! (Confirm)
// Idisp = Icenter + mass[ (RdotR)*I - RcrossR ]
So to test it out, I create a long box at the origin, and then a smaller
box, half its width, so I can offset it along the x axis, and times it by
2, so it should equal the inertia tensor of the long box.
Is this correct?... why would it be wrong?
Thanx,
Jon
// ref: http://en.wikipedia.org/wiki/Parallel_axis_theorem
// Understanding?
float mass = 1.0f;
Matrix inertiabBox = BoxMatrix(mass/*mass*/, 3/*width*/, 10/*height*/, 50/*depth*/);
Matrix inertiaLongBox = BoxMatrix(mass/*mass*/, 6/*width*/, 10/*height*/, 50/*depth*/);
Vector3 R = new Vector3(3.0f,0,0); // Offset it by R
Matrix mA = inertiabBox + mass*( Vector3.Dot(R,R)*Matrix.Identity - OuterProduct(R,R) );
Matrix inertiaSameAsLongBox = 2 * mA; ? but why?
/* REF */
Matrix BoxMatrix(float mass, float w, float h, float d)
{
float ss = (1/12.0f) * mass;
Matrix bb = Matrix( ss*(h*h+d*d), 0, 0, 0,
0, ss*(w*w+d*d), 0, 0,
0, 0, ss*(w*w+h*h), 0,
0, 0, 0, 1 );
return bb;
}
Matrix OuterProduct( Vector3 a, Vector3 b)
{
return Matrix( a.X*b.X, a.X*b.Y, a.X*b.Z, 0.0f,
a.Y*b.X, a.Y*b.Y, a.Y*b.Z, 0.0f,
a.Z*b.X, a.Z*b.Y, a.Z*b.Z, 0.0f,
0, 0, 0, 1.0f );
}
// Idisp = Icenter + mass[ (RdotR)*I - RcrossR ]
So to test it out, I create a long box at the origin, and then a smaller
box, half its width, so I can offset it along the x axis, and times it by
2, so it should equal the inertia tensor of the long box.
Is this correct?... why would it be wrong?
Thanx,
Jon
// ref: http://en.wikipedia.org/wiki/Parallel_axis_theorem
// Understanding?
float mass = 1.0f;
Matrix inertiabBox = BoxMatrix(mass/*mass*/, 3/*width*/, 10/*height*/, 50/*depth*/);
Matrix inertiaLongBox = BoxMatrix(mass/*mass*/, 6/*width*/, 10/*height*/, 50/*depth*/);
Vector3 R = new Vector3(3.0f,0,0); // Offset it by R
Matrix mA = inertiabBox + mass*( Vector3.Dot(R,R)*Matrix.Identity - OuterProduct(R,R) );
Matrix inertiaSameAsLongBox = 2 * mA; ? but why?
/* REF */
Matrix BoxMatrix(float mass, float w, float h, float d)
{
float ss = (1/12.0f) * mass;
Matrix bb = Matrix( ss*(h*h+d*d), 0, 0, 0,
0, ss*(w*w+d*d), 0, 0,
0, 0, ss*(w*w+h*h), 0,
0, 0, 0, 1 );
return bb;
}
Matrix OuterProduct( Vector3 a, Vector3 b)
{
return Matrix( a.X*b.X, a.X*b.Y, a.X*b.Z, 0.0f,
a.Y*b.X, a.Y*b.Y, a.Y*b.Z, 0.0f,
a.Z*b.X, a.Z*b.Y, a.Z*b.Z, 0.0f,
0, 0, 0, 1.0f );
}