Physically Based Rotation: Take Two
| Keys | Source |
| x axis: w,s | rotint |
| y axis: a,d | Matrix |
| z axis: q,e | Quaternion |
| reset: r | Vector |
| tracing: t | Transformation |
| start/stop: g |
Built with Processing
What the hell is going on????
This is a much more telling applet than my previous one, and consequently quite a bit more complicated. It should launch with a random initial condition, but you can customize it as well. First off, read my earlier post about rigid body rotation. At the end of it I noted some issues with the integration algorithm. This new applet addresses this concern. In this applet the same simulation is being performed twice. Once (in red) is the old integration scheme from the earlier applet. It is called Euler integration and very prone to error, as we'll see. The second one, in green, is integrated using Runge-kutta, and the error is much more well managed. The boxes are the actual simulation objects. Projected from the origin are three vectors. The blue one is the angular momentum (specified with the q,w,e,a,s,d keys). The red one is the instantaneous angular velocity as determined by the Euler-integration. The green one is the same, but for the Runge-kutta. The tracings show where these were over time.
What It All Means
If you look at the traced out paths of the two integration methods, you notice two things. The first is that neither of them stay as circles, they both have pretty significant deviations from that, depending on the initial conditions. The second is that the red one spirals away from the green one. This is the bad part of Euler integration, the error is always in one direction, whereas Runge-Kutta has two-way error of much lower order. This means that neither is "perfect" in the sense that they produce 100% exact results, but the green one is much better because it stays confined to a disk. The red one drifts out aimlessly towards the axis of minimum inertia, and stays there afterward. This was probably terribly unclear… leave a comment with questions.