newton.geometry.transform_inertia#

newton.geometry.transform_inertia(m, I, p, q)[source]#

Compute a rigid body’s inertia tensor expressed in a new coordinate frame.

The transformation applies (1) a rotation by quaternion q and (2) a parallel-axis shift by vector p (Steiner’s theorem). Let R be the rotation matrix corresponding to q. The returned inertia tensor \(\mathbf{I}'\) is

\[\mathbf{I}' \,=\, \mathbf{R}\,\mathbf{I}\,\mathbf{R}^\top \, + \, m\big(\lVert\mathbf{p}\rVert^2\,\mathbf{I}_3 \, - \, \mathbf{p}\,\mathbf{p}^\top\big),\]

where \(\mathbf{I}_3\) is the \(3\times3\) identity matrix.

Parameters:
  • m (float) – Mass of the rigid body.

  • I (wp.mat33) – Inertia tensor expressed in the body’s local frame, relative to its center of mass.

  • p (wp.vec3) – Position vector from the new frame’s origin to the body’s center of mass.

  • q (wp.quat) – Orientation of the body relative to the new frame, expressed as a quaternion.

Returns:

The transformed inertia tensor expressed in the new frame.

Return type:

wp.mat33