Module avian3d::dynamics::integrator::semi_implicit_euler

source ·
Expand description

The semi-implicit or symplectic Euler integration scheme.

Semi-implicit Euler integration is the most common integration scheme because it is simpler and more efficient than implicit Euler integration, has great energy conservation, and provides much better accuracy than explicit Euler integration.

Semi-implicit Euler integration evalutes the acceleration at the current timestep and the velocity at the next timestep:

v = v_0 + a * Δt (linear velocity)
ω = ω_0 + α * Δt (angular velocity)

and computes the new position:

x = x_0 + v * Δt (position)
θ = θ_0 + ω * Δt (rotation)

This order is opposite to explicit Euler integration, which uses the velocity at the current timestep instead of the next timestep. The explicit approach can lead to bodies gaining energy over time, which is why the semi-implicit approach is typically preferred.

Functions§

  • Computes angular acceleration based on the current angular velocity, torque, and inertia. Note that this does not account for gyroscopic motion. To compute the gyroscopic angular velocity correction, use solve_gyroscopic_torque.
  • Integrates position and rotation based on the given velocities in order to find the position and rotation after delta_seconds have passed.
  • Integrates velocity based on the given forces in order to find the linear and angular velocity after delta_seconds have passed.
  • Computes linear acceleration based on the given forces and mass.
  • Computes the angular correction caused by gyroscopic motion, which may cause objects with non-uniform angular inertia to wobble while spinning.