jax.scipy.spatial.transform.Rotation#
- class jax.scipy.spatial.transform.Rotation(quat)[source]#
Rotation in 3 dimensions.
JAX implementation of
scipy.spatial.transform.Rotation.Examples
Construct an object describing a 90 degree rotation about the z-axis:
>>> from jax.scipy.spatial.transform import Rotation >>> r = Rotation.from_euler('z', 90, degrees=True)
Convert to a rotation vector:
>>> r.as_rotvec() Array([0. , 0. , 1.5707964], dtype=float32)
Convert to rotation matrix:
>>> r.as_matrix() Array([[ 0. , -0.99999994, 0. ], [ 0.99999994, 0. , 0. ], [ 0. , 0. , 0.99999994]], dtype=float32)
Compose with another rotation:
>>> r2 = Rotation.from_euler('x', 90, degrees=True) >>> r3 = r * r2 >>> r3.as_matrix() Array([[0., 0., 1.], [1., 0., 0.], [0., 1., 0.]], dtype=float32)
See the scipy
Rotationdocumentation for further examples of manipulating Rotation objects.- Parameters:
quat (Array)
- __init__()#
Methods
__init__()apply(vectors[, inverse])Apply this rotation to one or more vectors.
as_euler(seq[, degrees])Represent as Euler angles.
as_matrix()Represent as rotation matrix.
as_mrp()Represent as Modified Rodrigues Parameters (MRPs).
as_quat([canonical, scalar_first])Represent as quaternions.
as_rotvec([degrees])Represent as rotation vectors.
concatenate(rotations)Concatenate a sequence of Rotation objects.
count(value, /)Return number of occurrences of value.
from_euler(seq, angles[, degrees])Initialize from Euler angles.
from_matrix(matrix)Initialize from rotation matrix.
from_mrp(mrp)Initialize from Modified Rodrigues Parameters (MRPs).
from_quat(quat)Initialize from quaternions.
from_rotvec(rotvec[, degrees])Initialize from rotation vectors.
identity([num, dtype])Get identity rotation(s).
index(value[, start, stop])Return first index of value.
inv()Invert this rotation.
magnitude()Get the magnitude(s) of the rotation(s).
mean([weights])Get the mean of the rotations.
random(random_key[, num])Generate uniformly distributed rotations.
Attributes
quatAlias for field number 0
singleWhether this instance represents a single rotation.