Rotlib#

Euler angle ranges

Sequence

phi

theta

psi

XYZ, ZYX

[-pi, pi]

[-pi/2, pi/2]

[-pi, pi]

XZY, YZX

[-pi, pi]

[-pi, pi]

[-pi/2, pi/2]

ZXY, YXZ

[-pi/2, pi/2]

[-pi, pi]

[-pi, pi]

Euler angle sequence: ‘XYZ’ (world). First rotation by phi about X, second rotation by theta about Y, and the third rotation by psi about Z axis of the world (i.e. fixed) frame.

This is the same as the sequence used in the Blender blenlib code.

In contrast, the ‘XYZ’ sequence is understood in the Aerospace community as: First rotation about Z-axis, second rotation about Y-axis, and the third rotation about X-axis of the body frame.

Reference: D. Eberly, Euler angle formulas.

rotlib.align(v, old, new)[source]#

Rotate vectors such that a set of mutually orthogonal unit vectors aligns with another set of mutually orthogoanl unit vectors.

The vectors v are rotated using a rotation matrix that, when applied to the unit vectors old, aligns them in the direction of the unit vectors new.

Parameters:
v(3,) | (n,3) ndarray

Vectors to align.

old(3,) | (m,3) ndarray

A set of at most three mutually orthogonal unit vectors. A single vector can be of shape (3,) or (1,3). Else m must be 2 or 3.

new(3,) | (m,3) ndarray

Another set of mutually orthogonal unit vectors of the same shape as old. The angles between the vectors must be the same as those of old.

Returns:
outndarray

Aligned vectors. out is of the same shape as v.

rotlib.mat_is_rotmat(mat)[source]#

Checks if mat is a rotation matrix or not.

Parameters:
mat(3,3) ndarray

Array to check.

Returns:
bool

True if mat is a rotation matrix, False otherwise.

rotlib.quat_rand(rng)[source]#

Returns a random unit quaternion.

Parameters:
rngnumpy.random.Generator

A random number generator.

Returns:
(4,) ndarray

Unit quaternion.

rotlib.quat_identity()[source]#

Returns the identity unit quaternion.

Returns:
(4,) ndarray

Unit quaternion.

rotlib.quat_conjugated(q)[source]#

Conjugates a quaternion in-place and returns it.

Parameters:
q(4,) ndarray

Quaternion.

Returns:
(4,) ndarray

Conjugated quaternion.

rotlib.quat_inverted(q)[source]#

Inverts a quaternion in-place and returns it.

Parameters:
q(4,) ndarray

Quaternion.

Returns:
(4,) ndarray

Inverted quaternion.

rotlib.quat_normalized(q)[source]#

Normalizes a quaternion in-place and returns it.

Parameters:
q(4,) ndarray

Quaternion.

Returns:
(4,) ndarray

Normalized quaternion.

rotlib.quat_is_normalized(q)[source]#

Checks whether a quaternion is normalized, i.e. whether it is a unit quaternion.

Parameters:
q(4,) ndarray

Quaternion.

Returns:
bool

True if q is normalized, False otherwise.

rotlib.quat_prod(p, q, normalize=True)[source]#

Returns the product of two quaternions.

Parameters:
p(4,) ndarray

Quaternion.

q(4,) ndarray

Quaternion.

normalizebool

Whether to normalize the product.

Returns:
(4,) ndarray

Product of two quaternions. If normalize is True, this is also a unit quaternion.

rotlib.quat_angle_between(p, q)[source]#

Returns the angle between two unit quaternions p and q.

Parameters:
p(4,) ndarray

Unit quaternion.

q(4,) ndarray

Unit quaternion.

Returns:
float

Angle in radian.

rotlib.quat_interpolate(q1, q2, t)[source]#

Interpolate between two unit quaternions.

Parameters:
q1(4,) ndarray

Unit quaternion.

q2(4,) ndarray

Unit quaternion.

tfloat

A fraction between 0 and 1 (both inclusive) specifying the interpolation point.

Returns:
(4,) ndarray

Interpolated unit quaternion.

rotlib.quat_deriv_to_angvel_mat(q)[source]#

Returns the matrix mapping the derivative of a unit quaternion to angular velocity.

Parameters:
qdot(4,) ndarray

Derivative of a unit quaternion.

Returns:
(3,4) ndarray

Angular velocity matrix.

rotlib.quat_deriv_to_angvel(q, qdot)[source]#

Calculates the angular velocity from a unit quaternion and its time derivative.

Parameters:
q(4,) ndarray

Unit quaternion.

qdot(4,) ndarray

Derivative of q. In general, this is not a unit vector.

Returns:
(3,) ndarray

Angular velocity.

rotlib.quat_deriv_from_angvel_mat(q)[source]#

Returns the matrix mapping angular velocity to time derivative of a unit quaternion.

Parameters:
q(4,) ndarray

Unit quaternion.

Returns:
(4,3) ndarray

Quaternion derivative matrix.

rotlib.quat_deriv_from_angvel(q, ang_vel)[source]#

Calculates the time derivative of a unit quaternion from angular velocity.

Parameters:
q(4,) ndarray

Unit quaternion.

ang_vel(3,) ndarray

Angular velocity.

Returns:
(3,) ndarray

Derivative of q. In general, this is not a unit vector.

rotlib.quat_rotmat(q)[source]#

Returns the rotation matrix corresponding to a unit quaternion.

Parameters:
q(4,) ndarray

Unit quaternion.

Returns:
(3,3) ndarray

Rotation matrix.

rotlib.quat_shiftmat(q, forward=False)[source]#

Returns the shifter matrix corresponding to a unit quaternion.

Parameters:
q(4,) ndarray

Unit quaternion.

forwardbool

Whether to shift forward, i.e., along the orientation or shift reverse.

Returns:
(3,3) ndarray

Shifter matrix.

rotlib.quat_rotate_vectors(v, q)[source]#

Rotates vectors by a unit quaternion.

Parameters:
v(3,) or (n,3) ndarray

A single 3-vector or n 3-vectors (the rows of v) to rotate.

q(4,) ndarray

Unit quaternion.

Returns:
(3,) or (n,3) ndarray

Rotated vectors.

rotlib.quat_shift_vectors(v, q, forward=False)[source]#

Given two frames A and B such that the orientation of frame B with respect to frame A is given by a unit quaternion, shifts vectors from A to B or B to A.

Parameters:
v(3,) or (n,3) ndarray

A single 3-vector or n 3-vectors (the rows of v) to shift.

q(4,) ndarray

Unit quaternion.

forwardbool

If True, shift from A to B. If False, shift from B to A.

Returns:
(3,) or (n,3) ndarray

Shifted vectors.

rotlib.quat_shift_tensor2(a, quat, forward=False)[source]#

Given two frames A and B such that the orientation of frame B with respect to frame A is given by a unit quaternion, shifts second-order tensors from A to B or B to A.

Parameters:
a(3,3) ndarray

A second-order tensor.

q(4,) ndarray

Unit quaternion.

forwardbool

If True, shift from A to B. If False, shift from B to A.

Returns:
(3,3) ndarray

Shifted second-order tensor.

rotlib.shift_tensor3_quat(a, quat, forward=False)[source]#

Given two frames A and B such that the orientation of frame B with respect to frame A is given by a unit quaternion, shifts third-order tensors from A to B or B to A.

Parameters:
a(3,3,3) ndarray

A third-order tensor.

q(4,) ndarray

Unit quaternion.

forwardbool

If True, shift from A to B. If False, shift from B to A.

Returns:
(3,3,3) ndarray

Shifted third-order tensor.

rotlib.quat_to_aa(q)[source]#

Converts a unit quaternion to an axis-angle representation.

Parameters:
q(4,) ndarray

Unit quaternion.

Returns:
axis(3,) ndarray

Unit vector along the axis of rotation.

anglefloat

Angle in radian.

rotlib.quat_to_dcm(q)[source]#

Converts a unit quaternion to a direction cosine matrix.

Parameters:
q(4,) ndarray

Unit quaternion.

Returns:
(3,3) ndarray

Direction cosine matrix.

rotlib.quat_to_euler(q, seq='XYZ', world=True)[source]#

Converts a unit quaternion to an Euler angle sequence.

Parameters:
q(4,) ndarray

Unit quaternion.

seq{‘XYZ’, ‘XZY’, ‘YXZ’, ‘YZX’, ‘ZXY’, ‘ZYX’}

Euler angle sequence.

worldbool

Whether the Euler angles are with respect to the world frame or not.

Returns:
(3,) ndarray

Euler angles.

rotlib.quat_from_any(orientation)[source]#

Converts an orientation to unit quaternion from either of the following: (1) Quaternion, (2) Euler angles, (3) Axis-angle, or (4) Direction cosine matrix.

Parameters:
orientationdict

The keys and values are:

  • ‘repr’ = 'quat' | 'euler' | 'axis_angle' | 'dcm'

  • ‘quat’ = (4,) ndarray

  • ‘euler’ = (3,) ndarray

  • ‘seq’ = 'XYZ' | 'XZY' | 'YXZ' | 'YZX' | 'ZXY' | 'ZYX'

  • ‘world’ = True | False

  • ‘axis’ = (3,) ndarray

  • ‘angle’ = float

  • ‘dcm’ = (3,3) ndarray

For any value of ‘repr’, only the relevant keys are accessed, the rest are ignored. E.g., if ‘repr’ = 'quat', only the ‘quat’ key is necessary, but for ‘repr’ = 'euler', the required keys are ‘euler’, ‘seq’, and ‘world’.

Returns:
(4,) ndarray

Unit quaternion.

rotlib.aa_fix(axis, angle, normalize=True)[source]#

Returns a copy of axis and angle by modifying their values to ensure a right handed rotation with angle in [0, pi).

Parameters:
axis(3,) ndarray

Axis of rotation. If this is not a unit vector, set normalize to True.

anglefloat

Angle in radian.

normalizebool

Whether to normalize the axis to a unit vector.

Returns:
axis(3,) ndarray

Modified axis of rotation, possibly normalized.

anglefloat

Modified angle in radian.

rotlib.aa_rand(rng)[source]#

Generates a random orientation in axis-angle representation.

The axis is a random vector drawn from a uniform distribution on the surface of a unit sphere. The current implementation in based on the algorithm from Allen & Tildesley p. 349.

Parameters:
rngnumpy.random.Generator

A random number generator.

Returns:
axis(3,) ndarray

Axis of rotation. This is a unit vector.

anglefloat

Angle in radian.

rotlib.aa_rotmat(axis, angle)[source]#

Returns the rotation matrix corresponding to an axis-angle representation.

Parameters:
axis(3,) ndarray

Unit vector along the axis.

anglefloat

Angle of rotation in radian. 0 <= angle < pi.

Returns:
(3,3) ndarray

Rotation matrix.

rotlib.aa_from_rotmat(rotmat)[source]#

Extracts axis and angle from a rotation matrix.

Parameters:
rotmat(3,3) ndarray

Rotation matrix (must be orthonormal).

Returns:
axis(3,) ndarray

Unit vector along the axis.

anglefloat

Angle of rotation in radian.

rotlib.aa_rotate_vectors(v, axis, angle)[source]#

Rotates vectors about axis by angle.

Parameters:
v(3,) or (n,3) ndarray

A single 3-vector or n 3-vectors (the rows of v) to rotate.

axis(3,) ndarray

Unit vector along the axis.

anglefloat

Angle of rotation in radian. 0 <= angle < pi.

Returns:
(3,) or (n,3) ndarray

Rotated vectors.

rotlib.aa_shiftmat(axis, angle, forward=False)[source]#

Returns the shifter matrix corresponding to an axis-angle representation.

Parameters:
axis(3,) ndarray

Unit vector along the axis.

anglefloat

Angle of rotation in radian. 0 <= angle < pi.

forward: bool

Whether to shift forward, i.e., along the orientation or shift reverse.

Returns:
(3,3) ndarray

Shifter matrix.

rotlib.aa_shift_vectors(v, axis, angle, forward=False)[source]#

Given two frames A and B such that the orientation of frame B with respect to frame A is given by an axis-angle representation, shifts vectors from A to B or B to A.

Parameters:
v(3,) or (n,3) ndarray

A single 3-vector or n 3-vectors (the rows of v) to shift.

axis(3,) ndarray

Unit vector along the axis.

anglefloat

Angle of rotation in radian. 0 <= angle < pi.

forwardbool

If True, shift from A to B. If False, shift from B to A.

Returns:
(3,) or (n,3) ndarray

Shifted vectors.

rotlib.aa_shift_tensor2(a, axis, angle, forward=False)[source]#

Given two frames A and B such that the orientation of frame B with respect to frame A is given by an axis-angle representation, shifts second order tensors from A to B or B to A.

Parameters:
a(3,3) ndarray

A second-order tensor.

axis(3,) ndarray

Unit vector along the axis.

anglefloat

Angle of rotation in radian. 0 <= angle < pi.

forwardbool

If True, shift from A to B. If False, shift from B to A.

Returns:
(3,3) ndarray

Shifted second order tensor.

rotlib.aa_shift_tensor3(a, axis, angle, forward=False)[source]#

Given two frames A and B such that the orientation of frame B with respect to frame A is given by an axis-angle representation, shifts third order tensors from A to B or B to A.

Parameters:
a(3,3,3) ndarray

A third-order tensor.

axis(3,) ndarray

Unit vector along the axis.

anglefloat

Angle of rotation in radian. 0 <= angle < pi.

forwardbool

If True, shift from A to B. If False, shift from B to A.

Returns:
(3,3,3) ndarray

Shifted third order tensor.

rotlib.aa_to_quat(axis, angle)[source]#

Converts an axis-angle representation to a unit quaternion.

Parameters:
axis(3,) ndarray

Axis of rotation. This must be a unit vector.

anglefloat

Angle in radian. 0 <= angle < pi.

Returns:
q(4,) ndarray

Unit quaternion.

rotlib.aa_to_dcm(axis, angle)[source]#

Converts an axis-angle representation to a direction cosine matrix.

Parameters:
axis(3,) ndarray

Unit vector along the axis.

anglefloat

Angle in radian. 0 <= angle < pi.

Returns:
(3,3) ndarray

Direction cosine matrix.

rotlib.aa_to_euler(axis, angle, seq='XYZ', world=True)[source]#

Coverts an axis-angle representation to Euler angles.

Parameters:
axis(3,) ndarray

Unit vector along the axis.

anglefloat

Angle in radian. 0 <= angle < pi.

seq{‘XYZ’, ‘XZY’, ‘YXZ’, ‘YZX’, ‘ZXY’, ‘ZYX’}

Euler angle sequence.

worldbool

Whether the Euler angles are with respect to the world frame or not.

Returns:
(3,) ndarray

Euler angles.

rotlib.aa_from_any(orientation)[source]#

Converts an orientation to axis-angle from any of the following: (1) Quaternion, (2) Euler angles, (3) Axis-angle, or (4) Direction cosine matrix.

Parameters:
orientationdict

See any_to_quat().

Returns:
axis(3,) ndarray

Axis of rotation. This is a unit vector.

anglefloat

Angle in radian.

rotlib.mat_is_dcm(mat)[source]#

Checks if mat is a direction cosine matrix or not.

Parameters:
mat(3,3) ndarray

Array to check.

Returns:
bool

True if mat is a direction cosine matrix, False otherwise.

rotlib.dcm_from_axes(A, B)[source]#

Returns the direction cosine matrix of axes(i.e. frame) B with respect to axes(i.e. frame) A.

Parameters:
A(3,3) ndarray

The rows of A represent the orthonormal basis vectors of frame A.

B(3,3) ndarray

The rows of B represent the orthonormal basis vectors of frame B.

Returns:
(3,3) ndarray

The dcm of frame B w.r.t. frame A.

rotlib.dcm_rotmat(dcm)[source]#

Returns the rotation matrix corresponding to a direction cosine matrix.

Parameters:
dcm(3,3) ndarray

Direction cosine matrix.

Returns:
(3,3) ndarray

Rotation matrix.

rotlib.dcm_shiftmat(dcm, forward=False)[source]#

Returns the shifter matrix corresponding to a direction cosine matrix.

Parameters:
dcm(3,3) ndarray

Direction cosine matrix.

forwardbool

Whether to shift forward, i.e., along the orientation or shift reverse.

Returns:
(3,3) ndarray

Shifter matrix.

rotlib.dcm_rotate_vectors(v, dcm)[source]#

Rotates vectors by a direction cosine matrix.

Parameters:
v(3,) or (n,3) ndarray

A single 3-vector or n 3-vectors (the rows of v) to rotate.

dcm(3,3) ndarray

Direction cosine matrix.

Returns:
(3,) or (n,3) ndarray

Rotated vectors.

rotlib.dcm_shift_vectors(v, dcm, forward=False)[source]#

Given two frames A and B such that the orientation of frame B with respect to frame A is given by a direction cosine matrix, shifts vectors from A to B or B to A.

Parameters:
v(3,) or (n,3) ndarray

A single 3-vector or n 3-vectors (the rows of v) to shift.

dcm(3,3) ndarray

Direction cosine matrix.

forwardbool

If True, shift from A to B. If False, shift from B to A.

Returns:
(3,) or (n,3) ndarray

Shifted vectors.

rotlib.dcm_shift_tensor2(a, dcm, forward=False)[source]#

Given two frames A and B such that the orientation of frame B with respect to frame A is given by a direction cosine matrix, shifts second-order tesnors from A to B or B to A.

Parameters:
a(3,3) ndarray

A second-order tensor.

dcm(3,3) ndarray

Direction cosine matrix.

forwardbool

If True, shift from A to B. If False, shift from B to A.

Returns:
(3,3) ndarray

Shifted second-order tensor.

rotlib.dcm_shift_tensor3(a, dcm, forward=False)[source]#

Given two frames A and B such that the orientation of frame B with respect to frame A is given by a direction cosine matrix, shifts third-order tesnors from A to B or B to A.

Parameters:
a(3,3,3) ndarray

A third-order tensor.

dcm(3,3) ndarray

Direction cosine matrix.

forwardbool

If True, shift from A to B. If False, shift from B to A.

Returns:
(3,3,3) ndarray

Shifted third-order tensor.

rotlib.dcm_to_quat(dcm)[source]#

Converts a direction cosine matrix to a unit quaternion.

Parameters:
dcm(3,3) ndarray

Direction cosine matrix

Returns:
q(4,) ndarray

Unit quaternion

rotlib.dcm_to_aa(dcm)[source]#

Converts a direction cosine matrix to an axis-angle representation.

Parameters:
dcm(3,3) ndarray

Direction cosine matrix

Returns:
axis(3,) ndarray

Axis of rotation. This is a unit vector.

anglefloat

Angle in radian.

rotlib.dcm_to_euler(dcm, seq='XYZ', world=True)[source]#

Converts a direction cosine matrix to a Euler angles.

Parameters:
dcm(3,3) ndarray

Direction cosine matrix

seq{‘XYZ’, ‘XZY’, ‘YXZ’, ‘YZX’, ‘ZXY’, ‘ZYX’}

Euler angle sequence.

worldbool

Whether the Euler angles are with respect to the world frame or not.

Returns:
(3,) ndarray

The three Euler angles phi (rotation about X), theta (rotation about Y), and psi (rotation about Z).

rotlib.dcm_from_any(orientation)[source]#

Converts an orientation to direction cosine matrix from any of the following: (1) Quaternion, (2) Euler angles, (3) Axis-angle, or (4) Direction cosine matrix.

Parameters:
orientationdict

See any_to_quat().

Returns:
(3,3) ndarray

Direction cosine matrix.

rotlib.euler_rotmat(euler, seq='XYZ', world=True)[source]#

Returns the rotation matrix for a set of Euler angles.

Parameters:
euler(3,)

Euler angles in radian.

seq{‘XYZ’, ‘XZY’, ‘YXZ’, ‘YZX’, ‘ZXY’, ‘ZYX’}

Sequence of Euler angles.

worldbool

Whether the euler angles are with respect to the world frame or not.

rotlib.euler_factor_rotmat(rotmat, seq='XYZ', world=True)[source]#

Factorize a rotation matrix to obtain the three Euler angles.

Parameters:
rotmat(3,3) ndarray

Rotation matrix

seq{‘XYZ’, ‘XZY’, ‘YXZ’, ‘YZX’, ‘ZXY’, ‘ZYX’}

Euler angle sequence.

worldbool

Whether the Euler angles are with respect to the world frame or not.

rotlib.euler_shiftmat(euler, seq='XYZ', world=True, forward=False)[source]#

Returns the shifter matrix for a set of Euler angles.

Parameters:
euler(3,)

Euler angles in radian.

seq{‘XYZ’, ‘XZY’, ‘YXZ’, ‘YZX’, ‘ZXY’, ‘ZYX’}

Sequence of Euler angles.

worldbool

Whether the euler angles are with respect to the world frame or not.

forwardbool

Whether to shift forward, i.e., along the orientation or shift reverse.

Returns:
(3,3) ndarray

Shifter matrix.

rotlib.euler_rotate_vectors(v, euler, seq='XYZ', world=True)[source]#

Rotates vectors with a set of Euler angles.

Parameters:
v(3,) or (n,3) ndarray

A single 3-vector or n 3-vectors (the rows of v) to rotate.

euler(3,) ndarray

Euler angles.

seq{‘XYZ’, ‘XZY’, ‘YXZ’, ‘YZX’, ‘ZXY’, ‘ZYX’}

Sequence of Euler angles.

worldbool

Whether the euler angles are with respect to the world frame or not.

Returns:
(3,) or (n,3) ndarray

Rotated vectors.

rotlib.euler_shift_vectors(v, euler, seq='XYZ', world=True, forward=False)[source]#

Given two frames A and B such that the orientation of frame B with respect to frame A is given by three Euler angles, shifts vectors from A to B or B to A.

Parameters:
v(3,) or (n,3) ndarray

A single 3-vector or n 3-vectors (the rows of v) to shift.

euler(3,)

Euler angles in radian.

seq{‘XYZ’, ‘XZY’, ‘YXZ’, ‘YZX’, ‘ZXY’, ‘ZYX’}

Sequence of Euler angles.

worldbool

Whether the euler angles are with respect to the world frame or not.

forwardbool

If True, shift from A to B. If False, shift from B to A.

Returns:
(3,) or (n,3) ndarray

Shifted vectors.

rotlib.euler_shift_tensor2(a, euler, forward=False)[source]#

Given two frames A and B such that the orientation of frame B with respect to frame A is given by three Euler angles, shifts second-order tensors from A to B or B to A.

Parameters:
a(3,3) ndarray

A second-order tensor

euler(3,)

Euler angles in radian.

seq{‘XYZ’, ‘XZY’, ‘YXZ’, ‘YZX’, ‘ZXY’, ‘ZYX’}

Sequence of Euler angles.

worldbool

Whether the euler angles are with respect to the world frame or not.

forwardbool

If True, shift from A to B. If False, shift from B to A.

Returns:
(3,3) ndarray

Shifted second order tensor.

rotlib.euler_shift_tensor3(a, euler, forward=False)[source]#

Given two frames A and B such that the orientation of frame B with respect to frame A is given by three Euler angles, shifts third-order tensors from A to B or B to A.

Parameters:
a(3,3,3) ndarray

A third-order tensor

euler(3,)

Euler angles in radian.

seq{‘XYZ’, ‘XZY’, ‘YXZ’, ‘YZX’, ‘ZXY’, ‘ZYX’}

Sequence of Euler angles.

worldbool

Whether the euler angles are with respect to the world frame or not.

forwardbool

If True, shift from A to B. If False, shift from B to A.

Returns:
(3,3,3) ndarray

Shifted third-order tensor.

rotlib.euler_to_quat(euler, seq='XYZ', world=True)[source]#

Convert Euler angles to a unit quaternion.

Parameters:
euler(3,) ndarray

The three Euler angles.

seq{‘XYZ’, ‘XZY’, ‘YXZ’, ‘YZX’, ‘ZXY’, ‘ZYX’}

Sequence of euler.

worldbool

Whether euler is with respect to the world frame or not.

Returns:
(4,) ndarray

Unit quaternion.

rotlib.euler_to_aa(euler, seq='XYZ', world=True)[source]#

Convert Euler angles to an axis-angle representation.

Parameters:
euler(3,) ndarray

The three Euler angles in radian.

seq{‘XYZ’, ‘XZY’, ‘YXZ’, ‘YZX’, ‘ZXY’, ‘ZYX’}

Sequence of euler.

worldbool

Whether euler is with respect to the world frame or not.

Returns:
axis(3,) ndarray

Unit vector along the direction of the axis.

anglefloat

Angle in radian.

rotlib.euler_to_dcm(euler, seq='XYZ', world=True)[source]#

Convert Euler angles to a direction cosine matrix.

Parameters:
euler(3,) ndarray

The three Euler angles in radian.

seq{‘XYZ’, ‘XZY’, ‘YXZ’, ‘YZX’, ‘ZXY’, ‘ZYX’}

Sequence of euler.

worldbool

Whether euler is with respect to the world frame or not.

Returns:
(3,3) ndarray

Direction cosine matrix

rotlib.euler_to_euler(euler, seq, world, to_seq, to_world)[source]#

Convert one set of Euler angles to another.

Parameters:
euler(3,) ndarray

The three Euler angles.

seq{‘XYZ’, ‘XZY’, ‘YXZ’, ‘YZX’, ‘ZXY’, ‘ZYX’}

Sequence of euler.

worldbool

Whether euler is with respect to the world frame or not.

to_seq{‘XYZ’, ‘XZY’, ‘YXZ’, ‘YZX’, ‘ZXY’, ‘ZYX’}

Convert euler with sequence seq to the sequence to_seq.

to_worldbool

Whether the converted euler angles are with respect to the world frame or not.

Returns:
(3,) ndarray

Euler angles.

rotlib.euler_from_any(orientation, to_seq, to_world)[source]#

Converts to Euler angles from any of the following: (1) Quaternion, (2) Euler angles, (3) Axis-angle, or (4) Direction cosine matrix.

Parameters:
orientationdict

See any_to_quat().

Returns:
(3,) ndarray

Euler angles.