This class implements quaternions and the commonly used algebraic operations on quaternions. The class is templated: you can use either float or double precision. Supports using quaternions to represent/manipulate rotations.

License type: MIT (X11),
as described in quaternion.h.
This is a very permissive licence. You can use this code in your products if you are a company. Academic use is allowed too of course (but please acknowledge). See the license text (in quaternion.h) for the exact legal interpretation.

Dependencies: none.

quaternion.h
quaternion.cpp
example.cpp

Version: 1.0. Released: Mar 04, 2007

Classes 'RigidBodyDynamics' and 'RigidBodyDynamics_GeneralTensor' implement 6-DOF rigid dynamics of a single rigid body, as explained, for example, in:

David Baraff: "An Introduction to Physically Based Modeling: Rigid Body Simulation I: Unconstrained Rigid Body Dynamics" (SIGGRAPH 97 Course Notes)In other words, these two classes allow you to simulate the motion of a single rigid body, under any specified (potentially time-varying) external forces and torques. Arbitrary tensors of inertia are supported. The solution is computed by numerically timestepping the ordinary differential equations of rigid body motion, derived from the Newton's 2nd law, and conservation of linear momentum and angular momentum. For example, ballistic motion can be simulated if gravity is used as the external force. Objects bouncing off the ground/impacting other objects can be simulated if you combine 'RigidBodyDynamics' (or 'RigidBodyDynamics_GeneralTensor') with a collision detection algorithm that provides the contact external forces.

License type: MIT (X11),
as described in rigidBodyDynamics.h.
This is a very permissive licence. You can use this code in your products if you are a company. Academic use is allowed too of course (but please acknowledge). See the license text (in rigidBodyDynamics.h) for the exact legal interpretation.

Dependencies: Quaternion C++ class (see above).

rigidBodyDynamics.h
rigidBodyDynamics.cpp
rigidBodyDynamics_generalTensor.h
rigidBodyDynamics_generalTensor.cpp
example.cpp

Version: 1.0. Released: Mar 04, 2007

M * q''(t) + C * q'(t) + K * q(t) = f(t)

This class integrates a single harmonic oscillator, that is,
this code can timestep the following one-dimensional Ordinary Differential Equation:

M * q''(t) + C * q'(t) + K * q(t) = f(t), where M,C,K are scalar constants, and f=f(t) is a given (discretely sampled) function of time, and q=q(t) is the unknown (i.e., what we are solving for). The system must be underdamped (as is the case in, e.g., sound simulations): C < 2 * sqrt(M*K).

The integration uses an IIR filter and is as such EXACT up to floating point arithmetic (i.e., this is better than integrating the ODE with a numerical integrator such as Euler/Runge-Kutta/Central Differences,etc.). The timestep computation is very simple and runs at very fast rates (easily at 44.1 kHz). This code can be used (and has been used) to integrate the modal oscillators for simulating sound, for example, in the following paper:

Doug L. James, Jernej Barbic, Dinesh K. Pai: Precomputed Acoustic Transfer: Output-sensitive, accurate sound generation for geometrically complex vibration sources, ACM Transactions on Graphics 25(3) (SIGGRAPH 2006), p. 987-995, Boston, MA, August 2006.License type: MIT (X11), as stated in harmonicOscillator_IIR.h. This is a very permissive licence. You can use this code in your products if you are a company. Academic use is allowed too of course (but please acknowledge). See the license text (in harmonicOscillator_IIR.h) for the exact legal interpretation.

Dependencies: none.

harmonicOscillator_IIR.h harmonicOscillator_IIR.cpp example.cpp

Version: 1.0. Released: Mar 04, 2007

More coming soon. I am cleaning up the code that I wrote for my PhD...