EulerAxis Class¶
The EulerAxis class represents attitude using axis-angle representation (Euler's rotation theorem).
EulerAxis
¶
EulerAxis(axis: ndarray, angle: float, angle_format: AngleFormat)
Represents a rotation using Euler axis-angle representation.
The Euler axis-angle representation describes a rotation as a single rotation about a specified axis by a given angle. This is also known as the axis-angle or rotation vector representation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
axis
|
ndarray
|
3-element unit vector specifying rotation axis |
required |
angle
|
float
|
Rotation angle in radians or degrees |
required |
angle_format
|
AngleFormat
|
Units of input angle (RADIANS or DEGREES) |
required |
Example
Initialize instance.
__doc__
class-attribute
¶
__doc__ = 'Represents a rotation using Euler axis-angle representation.\n\nThe Euler axis-angle representation describes a rotation as a single rotation\nabout a specified axis by a given angle. This is also known as the axis-angle\nor rotation vector representation.\n\nArgs:\n axis (numpy.ndarray): 3-element unit vector specifying rotation axis\n angle (float): Rotation angle in radians or degrees\n angle_format (AngleFormat): Units of input angle (RADIANS or DEGREES)\n\nExample:\n ```python\n import brahe as bh\n import numpy as np\n\n # Rotation of 90 degrees about z-axis\n axis = np.array([0.0, 0.0, 1.0])\n e = bh.EulerAxis(axis, np.pi/2, bh.AngleFormat.RADIANS)\n print(f"Angle: {e.angle} rad")\n\n # Convert to quaternion\n q = e.to_quaternion()\n ```'
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.
__module__
class-attribute
¶
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.
angle
property
¶
angle: float
Get the rotation angle in radians.
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Rotation angle in radians |
axis
property
¶
axis: ndarray
Get the rotation axis as a numpy array.
Returns:
| Type | Description |
|---|---|
ndarray
|
numpy.ndarray: 3-element unit vector specifying rotation axis |
__new__
builtin
¶
Create and return a new object. See help(type) for accurate signature.
from_euler_angle
builtin
¶
from_euler_angle(e: EulerAngle) -> EulerAxis
Create an Euler axis from Euler angles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
e
|
EulerAngle
|
Euler angle representation |
required |
Returns:
| Name | Type | Description |
|---|---|---|
EulerAxis |
EulerAxis
|
Equivalent Euler axis |
from_euler_axis
builtin
¶
from_quaternion
builtin
¶
from_quaternion(q: Quaternion) -> EulerAxis
Create an Euler axis from a quaternion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
Quaternion
|
Source quaternion |
required |
Returns:
| Name | Type | Description |
|---|---|---|
EulerAxis |
EulerAxis
|
Equivalent Euler axis |
from_rotation_matrix
builtin
¶
from_rotation_matrix(r: RotationMatrix) -> EulerAxis
Create an Euler axis from a rotation matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r
|
RotationMatrix
|
Rotation matrix |
required |
Returns:
| Name | Type | Description |
|---|---|---|
EulerAxis |
EulerAxis
|
Equivalent Euler axis |
from_values
builtin
¶
Create an Euler axis from individual axis components and angle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
X component of rotation axis |
required |
y
|
float
|
Y component of rotation axis |
required |
z
|
float
|
Z component of rotation axis |
required |
angle
|
float
|
Rotation angle in radians or degrees |
required |
angle_format
|
AngleFormat
|
Units of input angle (RADIANS or DEGREES) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
EulerAxis |
EulerAxis
|
New Euler axis instance |
from_vector
builtin
¶
from_vector(v: ndarray, angle_format: AngleFormat, vector_first: bool) -> EulerAxis
Create an Euler axis from a numpy array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
v
|
ndarray
|
4-element array containing axis and angle |
required |
angle_format
|
AngleFormat
|
Units of angle (RADIANS or DEGREES) |
required |
vector_first
|
bool
|
If True, array is [x, y, z, angle], else [angle, x, y, z] |
required |
Returns:
| Name | Type | Description |
|---|---|---|
EulerAxis |
EulerAxis
|
New Euler axis 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_euler_axis
method descriptor
¶
to_euler_axis() -> EulerAxis
Convert to Euler axis representation (returns self).
Returns:
| Name | Type | Description |
|---|---|---|
EulerAxis |
EulerAxis
|
This Euler axis |
to_quaternion
method descriptor
¶
to_quaternion() -> Quaternion
Convert to quaternion representation.
Returns:
| Name | Type | Description |
|---|---|---|
Quaternion |
Quaternion
|
Equivalent quaternion |
to_rotation_matrix
method descriptor
¶
to_rotation_matrix() -> RotationMatrix
Convert to rotation matrix representation.
Returns:
| Name | Type | Description |
|---|---|---|
RotationMatrix |
RotationMatrix
|
Equivalent rotation matrix |
to_vector
method descriptor
¶
to_vector(angle_format: AngleFormat, vector_first: bool) -> ndarray
Convert Euler axis to a numpy array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
angle_format
|
AngleFormat
|
Units for output angle (RADIANS or DEGREES) |
required |
vector_first
|
bool
|
If True, returns [x, y, z, angle], else [angle, x, y, z] |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
numpy.ndarray: 4-element array containing axis and angle |