Calculating inertia from a support function

Please don't post Bullet support questions here, use the above forums instead.
Kayamon
Posts: 1
Joined: Sat Jul 23, 2011 12:20 am

Calculating inertia from a support function

Post by Kayamon »

Hello folks!

I'm hoping someone here can answer a physics question for me.

Is it possible to compute an inertia tensor for any arbitrary body, using just a GJK support function?
And on that note, is this even a good idea or should I not bother? It'd save a lot of code and special cases if it were doable.
Norbo
Posts: 5
Joined: Tue Nov 06, 2007 8:52 am

Re: Calculating inertia from a support function

Post by Norbo »

Using only a convex's support function, you can get a nice sampling of the surface, but using the extreme points directly would result in a biased inertia tensor that would be worse than a box-based approximation in many cases. Technically, you could create a convex hull from the surface points and compute the inertia tensor for that hull. There may be some fancy/non-expensive method of interpreting the surface points that I'm not aware of.

One alternative is to create a grid of mass points and test them for containment within the convex shape using your favorite containment algorithm (MPR or GJK are easy to adapt for this purpose). Those mass points then contribute to the inertia tensor.

Another conceptually similar approach is to raycast in a 2d grid from the +X and -X direction and get the hit times. You can compute an inertia tensor based on the hit coming from the +X direction and the hit coming from the -X direction. Quantizing the interval into mass points would be easy. Another option is to consider the row to be a rectangular prism and compute the whole inertia tensor based on a bunch of such offset box inertia tensors.

The accuracy of numerical integration methods are subject to the amount of samples you take, so they're only really worth it for the shapes that don't have straightforward inertia tensors. I use similar approaches for minkowski sums and wrapped shapes (shrink wrap over multiple convexes).
noone
Posts: 4
Joined: Sat Dec 30, 2006 8:19 pm

Re: Calculating inertia from a support function

Post by noone »

I recently implemented a version which works very well for me. The support map function is used to build a triangle mesh. And the triangle mesh is then used to get the inertia.

Have a look here: http://code.google.com/p/jitterphysics/ ... s/Shape.cs

MakeHull() and CalculateMassInertia() are the functions of interest. In all my test cases the inertia was nearly the same as the analytical value. The problem is that Iam not sure about "convergence/correctness" of the Hull making function. I recently (5min ago) contacted the original author of this function to get more information. The CalculateMassInertia function is then just a simple method based on an idea descriped here: www.number-none.com/blow/inertia/bb_inertia.doc (yeah, *.doc format!)