Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 28 Feb 2013
Offline Last Active Sep 18 2014 06:45 AM

Posts I've Made

In Topic: Capsule Moment Of Inertia

12 September 2014 - 07:22 AM

Physically, the moment of inertia is basically a rotational form of regular translational inertia. Newton's 2nd law (\(F = ma\)) describes how masses are accelerated due to forces, but mass can be seen as a resistance to acceleration. In that way, more mass is more resistant to being accelerated. For translations, \(F=ma\) describes this. For rotations, \(T = J \alpha\) is the equivalent.


The inertia tensor (matrix) describes in essence how "hard" any object is to be rotated about some point and some axis. To calculate it, you choose a reference point (can be on or off the body, but we like using either the centroid or center of mass), choose reference axes (can be arbitrary but should be a right-handed basis at least), break the objects up into small, infinitesimal pieces, and then calculate the moment of inertia of each piece, then sum them up (usually in a kind of weighted average fashion). This is why integrals are usually present in the matrix formulation. The inertia matrix is useful when you are rotating in 3D and not necessarily along an axis of the reference frame from which you calculated the matrix (i.e. not rotating about the X, Y, or Z axis).


However, a lot of times the objects of which you want the moment of inertia are easily broken down to more simple geometric forms that can be easily calculated. In your capsule example, they are breaking down the capsule into cylinders and spheres, something easily more calculable than using the integral method. We can use do a similar thing as above by calculating the moments of inertia of each geometric piece and summing them up with a kind of weighted average. If we are summing up the moments of inertia in this way, our "weighted average" is the parallel axis theorem. The parallel axis theorem allows us to calculate the moment of inertia of an object and compensate for the distance that object is away from the rotation axis. We can see this by spinning a pencil about its middle or about its ends. It's "harder" to spin about the ends than about the middle because the bulk of the pencil's mass (or we can also say the center of mass) is much farther away from the rotation axis. The parallel axis theorem gives us the correct adjustment factor to sum things up this way. 


You labeled the cylinder and sphere terms correctly, but the "what's this for" is the term due to the parallel axis theorem by moving the half-spheres out away from the rotation axis, which is directly in the middle of the capsule. They seem to have combined the half-sphere moment of inertias and the parallel axis theorem transfer terms in the code.


Hope that helps!

In Topic: B-Spline sampling

04 September 2014 - 06:35 AM

The best book that will give you everything you need on B-splines and NURBS is "The NURBS Book" by Piegl and Tiller. It contains code snippets that can be directly implemented. As well, it does fun computational tricks, like only computing the non-zero basis functions for B-spline point evaluation, and so on. If you're doing any serious work with B-splines, do yourself a favor and pick it up.

In Topic: Something between bilinear and bicubic interpolation?

20 August 2014 - 12:44 PM

Mathematically, the Bezier formulation is equivalent to the normal bicubic and bilinear interpolation formulas. It's really only a different basis: power vs Bernstein basis. However, the Bezier form handles the "control point" vertices more naturally than the power basis.

In Topic: What is the fastest way to transform rigid body space

25 July 2014 - 03:25 PM

You probably could develop an algorithm using vectors and quaternions, but I don't think you can get faster (or simpler) than matrix math. If you're premultiplying all your matrices before you transform and solve for the inverse to get back, transforming is as easy as it's going to be.

In Topic: How are the trigonometric functions computed?

25 July 2014 - 03:11 PM

Mathematically, the easiest way is using a truncated infinite series and precomputing all the factorials and coefficients you'll need.


Actual computation is highly system-dependent. There are software implementations, like this IBM implementation (the code is complex and divided up into angle intervals with if/then/else statements to be fast) or this fdlibm code (which is easier to read). x86 processors have trig functions implemented in assembly and the FPU uses it's fsin() function.