Rotation Matrix¶
Rotation matrix (DCM) attitude representation.
Provides the RotationMatrix class representing a rotation as a
3x3 orthogonal matrix with determinant +1 (SO(3)).
The constructor validates that the matrix is a proper rotation matrix
(orthogonal with det +1). The _from_internal classmethod bypasses
validation for use in pytree unflatten and conversion outputs.
RotationMatrix
¶
3x3 rotation matrix (Direction Cosine Matrix).
Internal storage is a shape (3, 3) JAX array. The constructor
validates SO(3) membership. Use _from_internal or from_matrix
with validate=False to skip validation when the matrix is already
known to be valid.
This class is registered as a JAX pytree with the data matrix as the sole leaf.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r11
|
float
|
Element (0, 0). |
required |
r12
|
float
|
Element (0, 1). |
required |
r13
|
float
|
Element (0, 2). |
required |
r21
|
float
|
Element (1, 0). |
required |
r22
|
float
|
Element (1, 1). |
required |
r23
|
float
|
Element (1, 2). |
required |
r31
|
float
|
Element (2, 0). |
required |
r32
|
float
|
Element (2, 1). |
required |
r33
|
float
|
Element (2, 2). |
required |
r11
property
¶
Element (0, 0).
r12
property
¶
Element (0, 1).
r13
property
¶
Element (0, 2).
r21
property
¶
Element (1, 0).
r22
property
¶
Element (1, 1).
r23
property
¶
Element (1, 2).
r31
property
¶
Element (2, 0).
r32
property
¶
Element (2, 1).
r33
property
¶
Element (2, 2).
__mul__(other)
¶
Matrix-matrix or matrix-vector multiplication.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
RotationMatrix | Array
|
|
required |
Returns:
| Type | Description |
|---|---|
RotationMatrix | Array
|
RotationMatrix | jax.Array: Result of multiplication. |
from_euler_angle(e)
classmethod
¶
Create from an EulerAngle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
e
|
EulerAngle
|
Source euler angle. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
RotationMatrix |
RotationMatrix
|
Equivalent rotation matrix. |
from_euler_axis(ea)
classmethod
¶
Create from an EulerAxis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ea
|
EulerAxis
|
Source euler axis. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
RotationMatrix |
RotationMatrix
|
Equivalent rotation matrix. |
from_matrix(matrix, validate=True)
classmethod
¶
Create from a 3x3 array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
matrix
|
Array
|
Array-like of shape |
required |
validate
|
bool
|
If |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
RotationMatrix |
RotationMatrix
|
New instance. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
from_quaternion(q)
classmethod
¶
Create from a Quaternion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
Quaternion
|
Source quaternion. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
RotationMatrix |
RotationMatrix
|
Equivalent rotation matrix. |
from_rotation_matrix(r)
classmethod
¶
Create from another RotationMatrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
RotationMatrix
|
Source rotation matrix. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
RotationMatrix |
RotationMatrix
|
Copy. |
rotation_x(angle, use_degrees=False)
classmethod
¶
Rotation about the x-axis.
Delegates to the existing Rx function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
angle
|
float
|
Rotation angle. |
required |
use_degrees
|
bool
|
If |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
RotationMatrix |
RotationMatrix
|
Rotation about x. |
rotation_y(angle, use_degrees=False)
classmethod
¶
Rotation about the y-axis.
Delegates to the existing Ry function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
angle
|
float
|
Rotation angle. |
required |
use_degrees
|
bool
|
If |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
RotationMatrix |
RotationMatrix
|
Rotation about y. |
rotation_z(angle, use_degrees=False)
classmethod
¶
Rotation about the z-axis.
Delegates to the existing Rz function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
angle
|
float
|
Rotation angle. |
required |
use_degrees
|
bool
|
If |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
RotationMatrix |
RotationMatrix
|
Rotation about z. |
to_euler_angle(order)
¶
Convert to EulerAngle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
order
|
EulerAngleOrder
|
|
required |
Returns:
| Name | Type | Description |
|---|---|---|
EulerAngle |
EulerAngle
|
Equivalent euler angle. |
to_euler_axis()
¶
Convert to EulerAxis.
Routes through quaternion.
Returns:
| Name | Type | Description |
|---|---|---|
EulerAxis |
EulerAxis
|
Equivalent euler axis. |
to_matrix()
¶
Return the underlying 3x3 array.
Returns:
| Type | Description |
|---|---|
Array
|
jnp.ndarray: Array of shape |
to_quaternion()
¶
to_rotation_matrix()
¶
Return a copy.
Returns:
| Name | Type | Description |
|---|---|---|
RotationMatrix |
RotationMatrix
|
New instance with same data. |