RotationMatrix Class¶
The RotationMatrix class represents attitude using Direction Cosine Matrices (DCM) for spacecraft orientation and coordinate transformations.
RotationMatrix ¶
RotationMatrix(r11: float, r12: float, r13: float, r21: float, r22: float, r23: float, r31: float, r32: float, r33: float)
Represents a rotation using a 3x3 rotation matrix (Direction Cosine Matrix).
A rotation matrix is an orthogonal 3x3 matrix with determinant +1 that represents rotation in 3D space. Also known as a Direction Cosine Matrix (DCM).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r11 | float | Element at row 1, column 1 | required |
r12 | float | Element at row 1, column 2 | required |
r13 | float | Element at row 1, column 3 | required |
r21 | float | Element at row 2, column 1 | required |
r22 | float | Element at row 2, column 2 | required |
r23 | float | Element at row 2, column 3 | required |
r31 | float | Element at row 3, column 1 | required |
r32 | float | Element at row 3, column 2 | required |
r33 | float | Element at row 3, column 3 | required |
Raises:
| Type | Description |
|---|---|
BraheError | If the matrix is not a valid rotation matrix |
Example
Initialize instance.
r11 property ¶
r11: float
Get element (1,1) of the rotation matrix.
Returns:
| Name | Type | Description |
|---|---|---|
float | float | Matrix element at row 1, column 1 |
r12 property ¶
r12: float
Get element (1,2) of the rotation matrix.
Returns:
| Name | Type | Description |
|---|---|---|
float | float | Matrix element at row 1, column 2 |
r13 property ¶
r13: float
Get element (1,3) of the rotation matrix.
Returns:
| Name | Type | Description |
|---|---|---|
float | float | Matrix element at row 1, column 3 |
r21 property ¶
r21: float
Get element (2,1) of the rotation matrix.
Returns:
| Name | Type | Description |
|---|---|---|
float | float | Matrix element at row 2, column 1 |
r22 property ¶
r22: float
Get element (2,2) of the rotation matrix.
Returns:
| Name | Type | Description |
|---|---|---|
float | float | Matrix element at row 2, column 2 |
r23 property ¶
r23: float
Get element (2,3) of the rotation matrix.
Returns:
| Name | Type | Description |
|---|---|---|
float | float | Matrix element at row 2, column 3 |
r31 property ¶
r31: float
Get element (3,1) of the rotation matrix.
Returns:
| Name | Type | Description |
|---|---|---|
float | float | Matrix element at row 3, column 1 |
r32 property ¶
r32: float
Get element (3,2) of the rotation matrix.
Returns:
| Name | Type | Description |
|---|---|---|
float | float | Matrix element at row 3, column 2 |
r33 property ¶
r33: float
Get element (3,3) of the rotation matrix.
Returns:
| Name | Type | Description |
|---|---|---|
float | float | Matrix element at row 3, column 3 |
Rx builtin ¶
Rx(angle: float, angle_format: AngleFormat) -> RotationMatrix
Create a rotation matrix for rotation about the X axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
angle | float | Rotation angle in radians or degrees | required |
angle_format | AngleFormat | Units of input angle (RADIANS or DEGREES) | required |
Returns:
| Name | Type | Description |
|---|---|---|
RotationMatrix | RotationMatrix | Rotation matrix for X-axis rotation |
Ry builtin ¶
Ry(angle: float, angle_format: AngleFormat) -> RotationMatrix
Create a rotation matrix for rotation about the Y axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
angle | float | Rotation angle in radians or degrees | required |
angle_format | AngleFormat | Units of input angle (RADIANS or DEGREES) | required |
Returns:
| Name | Type | Description |
|---|---|---|
RotationMatrix | RotationMatrix | Rotation matrix for Y-axis rotation |
Rz builtin ¶
Rz(angle: float, angle_format: AngleFormat) -> RotationMatrix
Create a rotation matrix for rotation about the Z axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
angle | float | Rotation angle in radians or degrees | required |
angle_format | AngleFormat | Units of input angle (RADIANS or DEGREES) | required |
Returns:
| Name | Type | Description |
|---|---|---|
RotationMatrix | RotationMatrix | Rotation matrix for Z-axis rotation |
from_euler_angle builtin ¶
from_euler_angle(e: EulerAngle) -> RotationMatrix
Create a rotation matrix from Euler angles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
e | EulerAngle | Euler angle representation | required |
Returns:
| Name | Type | Description |
|---|---|---|
RotationMatrix | RotationMatrix | Equivalent rotation matrix |
from_euler_axis builtin ¶
from_euler_axis(e: EulerAxis) -> RotationMatrix
Create a rotation matrix from an Euler axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
e | EulerAxis | Euler axis representation | required |
Returns:
| Name | Type | Description |
|---|---|---|
RotationMatrix | RotationMatrix | Equivalent rotation matrix |
from_matrix builtin ¶
from_matrix(m: ndarray) -> RotationMatrix
Create a rotation matrix from a 3x3 numpy array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m | ndarray | 3x3 rotation matrix | required |
Returns:
| Name | Type | Description |
|---|---|---|
RotationMatrix | RotationMatrix | New rotation matrix instance |
Raises:
| Type | Description |
|---|---|
BraheError | If the matrix is not a valid rotation matrix |
from_quaternion builtin ¶
from_quaternion(q: Quaternion) -> RotationMatrix
Create a rotation matrix 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 builtin ¶
from_rotation_matrix(r: RotationMatrix) -> RotationMatrix
Create a rotation matrix from another rotation matrix (copy constructor).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r | RotationMatrix | Source rotation matrix | required |
Returns:
| Name | Type | Description |
|---|---|---|
RotationMatrix | RotationMatrix | New rotation matrix instance |
to_euler_angle method descriptor ¶
to_euler_angle(order: str) -> EulerAngle
Convert to Euler angle representation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
order | str | Desired rotation sequence (e.g., "XYZ", "ZYX") | required |
Returns:
| Name | Type | Description |
|---|---|---|
EulerAngle | EulerAngle | Equivalent Euler angles |
to_matrix method descriptor ¶
to_matrix() -> ndarray
Convert rotation matrix to a 3x3 numpy array.
Returns:
| Type | Description |
|---|---|
ndarray | numpy.ndarray: 3x3 rotation matrix |
to_quaternion method descriptor ¶
to_quaternion() -> Quaternion
to_rotation_matrix method descriptor ¶
to_rotation_matrix() -> RotationMatrix