ostk.mathematics.geometry.d3.transformation.rotation.RotationVector¶
- class RotationVector(*args, **kwargs)¶
Bases:
pybind11_objectOverloaded function.
__init__(self: ostk.mathematics.geometry.d3.transformation.rotation.RotationVector, axis: numpy.ndarray[numpy.float64[3, 1]], angle: ostk::mathematics::geometry::Angle) -> None
Create a rotation vector from axis and angle.
- Args:
axis (numpy.array): The rotation axis (will be normalized). angle (Angle): The rotation angle around the axis.
- Example:
>>> axis = numpy.array([0.0, 0.0, 1.0]) >>> angle = Angle.degrees(90.0) >>> rot_vector = RotationVector(axis, angle)
__init__(self: ostk.mathematics.geometry.d3.transformation.rotation.RotationVector, vector: numpy.ndarray[numpy.float64[3, 1]], angle_unit: ostk::mathematics::geometry::Angle::Unit) -> None
Create a rotation vector from a vector representation.
- Args:
vector (numpy.array): The rotation vector (magnitude represents angle). angle_unit (Angle.Unit): The unit of the angle in the vector magnitude.
- Example:
>>> vector = numpy.array([0.0, 0.0, 1.5708]) # π/2 in z-axis >>> rot_vector = RotationVector(vector, Angle.Unit.Radian)
Methods
Create a rotation vector from Euler angles.
Get the rotation angle.
Get the rotation axis vector.
Check if the rotation vector is defined.
Create a rotation vector from a quaternion.
Rectify the rotation vector in-place (ensure angle is in [0, π]).
Create a rotation vector from a rotation matrix.
Overloaded function.
Create an undefined rotation vector.
Create a unit rotation vector (no rotation).
Create a rotation vector around the x-axis.
Create a rotation vector around the y-axis.
Create a rotation vector around the z-axis.
- static euler_angle(
- euler_angle: ostk::mathematics::geometry::d3::transformation::rotation::EulerAngle,
Create a rotation vector from Euler angles.
- Parameters:
euler_angle (EulerAngle) -- The Euler angles to convert.
- Returns:
The equivalent rotation vector.
- Return type:
Example
>>> ea = EulerAngle.zyx(Angle.degrees(30), Angle.degrees(45), Angle.degrees(60)) >>> rot_vector = RotationVector.euler_angle(ea)
- get_angle( ) ostk::mathematics::geometry::Angle¶
Get the rotation angle.
- Returns:
The rotation angle around the axis.
- Return type:
Example
>>> rot_vector = RotationVector(axis, Angle.degrees(90.0)) >>> angle = rot_vector.get_angle() # 90 degrees
- get_axis( ) numpy.ndarray[numpy.float64[3, 1]]¶
Get the rotation axis vector.
- Returns:
The normalized rotation axis.
- Return type:
Vector3d
Example
>>> rot_vector = RotationVector(numpy.array([1.0, 0.0, 0.0]), angle) >>> axis = rot_vector.get_axis() # [1.0, 0.0, 0.0]
- is_defined( ) bool¶
Check if the rotation vector is defined.
- Returns:
True if the rotation vector is defined, False otherwise.
- Return type:
Example
>>> rot_vector = RotationVector(axis, angle) >>> rot_vector.is_defined() # True
- static quaternion( ) ostk.mathematics.geometry.d3.transformation.rotation.RotationVector¶
Create a rotation vector from a quaternion.
- Parameters:
quaternion (Quaternion) -- The quaternion to convert.
- Returns:
The equivalent rotation vector.
- Return type:
Example
>>> q = Quaternion.unit() >>> rot_vector = RotationVector.quaternion(q)
- rectify( ) None¶
Rectify the rotation vector in-place (ensure angle is in [0, π]).
Example
>>> rot_vector = RotationVector(axis, Angle.degrees(270.0)) >>> rot_vector.rectify() # Converts to equivalent rotation with angle ≤ π
- static rotation_matrix(
- rotation_matrix: ostk::mathematics::geometry::d3::transformation::rotation::RotationMatrix,
Create a rotation vector from a rotation matrix.
- Parameters:
rotation_matrix (RotationMatrix) -- The rotation matrix to convert.
- Returns:
The equivalent rotation vector.
- Return type:
Example
>>> rm = RotationMatrix.identity() >>> rot_vector = RotationVector.rotation_matrix(rm)
- to_string(*args, **kwargs)¶
Overloaded function.
to_string(self: ostk.mathematics.geometry.d3.transformation.rotation.RotationVector) -> ostk.core.type.String
Convert the rotation vector to string representation.
- Returns:
str: String representation of the rotation vector.
- Example:
>>> rot_vector = RotationVector.unit() >>> rot_vector.to_string()
to_string(self: ostk.mathematics.geometry.d3.transformation.rotation.RotationVector, precision: ostk.core.type.Integer) -> ostk.core.type.String
Convert the rotation vector to string representation with specified precision.
- Args:
precision (int): The precision for floating point numbers.
- Returns:
str: String representation of the rotation vector.
- Example:
>>> rot_vector = RotationVector.unit() >>> rot_vector.to_string(3)
- static undefined() ostk.mathematics.geometry.d3.transformation.rotation.RotationVector¶
Create an undefined rotation vector.
- Returns:
An undefined rotation vector.
- Return type:
Example
>>> undefined_vector = RotationVector.undefined() >>> undefined_vector.is_defined() # False
- static unit() ostk.mathematics.geometry.d3.transformation.rotation.RotationVector¶
Create a unit rotation vector (no rotation).
- Returns:
A rotation vector representing no rotation.
- Return type:
Example
>>> unit_vector = RotationVector.unit() >>> angle = unit_vector.get_angle() # 0 degrees
- static x(
- angle: ostk::mathematics::geometry::Angle,
Create a rotation vector around the x-axis.
- Parameters:
angle (Angle) -- The rotation angle around the x-axis.
- Returns:
A rotation vector around the x-axis.
- Return type:
Example
>>> rot_vector = RotationVector.x(Angle.degrees(90.0))
- static y(
- angle: ostk::mathematics::geometry::Angle,
Create a rotation vector around the y-axis.
- Parameters:
angle (Angle) -- The rotation angle around the y-axis.
- Returns:
A rotation vector around the y-axis.
- Return type:
Example
>>> rot_vector = RotationVector.y(Angle.degrees(90.0))
- static z(
- angle: ostk::mathematics::geometry::Angle,
Create a rotation vector around the z-axis.
- Parameters:
angle (Angle) -- The rotation angle around the z-axis.
- Returns:
A rotation vector around the z-axis.
- Return type:
Example
>>> rot_vector = RotationVector.z(Angle.degrees(90.0))