bundles / scipy latest / scipy / spatial / transform / _rotation / Rotation / from_davenport
staticmethod
scipy.spatial.transform._rotation:Rotation.from_davenport
source: build-install/usr/lib/python3.14/site-packages/scipy/spatial/transform/_rotation.py:816
Signature
def from_davenport(axes: ArrayLike, order: str, angles: ArrayLike | float, degrees: bool = False) → RotationSummary
Initialize from Davenport angles.
Extended Summary
Rotations in 3-D can be represented by a sequence of 3 rotations around a sequence of axes.
The three rotations can either be in a global frame of reference (extrinsic) or in a body centred frame of reference (intrinsic), which is attached to, and moves with, the object under rotation [1].
For both Euler angles and Davenport angles, consecutive axes must be are orthogonal (axis2 is orthogonal to both axis1 and axis3). For Euler angles, there is an additional relationship between axis1 or axis3, with two possibilities:
axis1andaxis3are also orthogonal (asymmetric sequence)axis1 == axis3(symmetric sequence)
For Davenport angles, this last relationship is relaxed [2], and only the consecutive orthogonal axes requirement is maintained.
Parameters
axes: array_like, shape (3,) or (..., [1 or 2 or 3], 3)Axis of rotation, if one dimensional. If two or more dimensional, describes the sequence of axes for rotations, where each axes[..., i, :] is the ith axis. If more than one axis is given, then the second axis must be orthogonal to both the first and third axes.
order: strIf it is equal to 'e' or 'extrinsic', the sequence will be extrinsic. If it is equal to 'i' or 'intrinsic', sequence will be treated as intrinsic.
angles: float or array_like, shape (..., [1 or 2 or 3])Angles specified in radians (
degreesis False) or degrees (degreesis True). Each angle i in the last dimension ofanglesturns around the corresponding axis axis[..., i, :]. The resulting rotation has the shape np.broadcast_shapes(np.atleast_2d(axes).shape[:-2], np.atleast_1d(angles).shape[:-1]) Dimensionless angles are thus only valid for a single axis.degrees: bool, optionalIf True, then the given angles are assumed to be in degrees. Default is False.
Returns
rotation: `Rotation` instanceObject containing the rotation represented by the sequence of rotations around given axes with given angles.
Examples
from scipy.spatial.transform import Rotation as R
✓ex = [1, 0, 0] ey = [0, 1, 0] ez = [0, 0, 1]✓
axes = [ez, ey, ex] r = R.from_davenport(axes, 'extrinsic', [90, 0, 0], degrees=True) r.as_quat().shape✓
(4,)It is equivalent to Euler angles in this case:
r.as_euler('zyx', degrees=True)
✓array([90., 0., -0.])Initialize multiple rotations in one object:
r = R.from_davenport(axes, 'extrinsic', [[90, 45, 30], [35, 45, 90]], degrees=True) r.as_quat().shape✓
(2, 4)Using only one or two axes is also possible:
r = R.from_davenport([ez, ex], 'extrinsic', [[90, 45], [35, 45]], degrees=True) r.as_quat().shape✓
(2, 4)Non-canonical axes are possible, and they do not need to be normalized, as long as consecutive axes are orthogonal:
e1 = [2, 0, 0] e2 = [0, 1, 0] e3 = [1, 0, 1] axes = [e1, e2, e3] r = R.from_davenport(axes, 'extrinsic', [90, 45, 30], degrees=True)✓
r.as_quat()
✗array([ 0.70106, 0.43046, -0.0923 , 0.56099])
Aliases
scipy.spatial.transform.Rotation.from_davenport