ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix¶
- class RotationMatrix(*args, **kwargs)¶
Bases:
pybind11_objectOverloaded function.
__init__(self: ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix, matrix: numpy.ndarray[numpy.float64[3, 3]]) -> None
Create a rotation matrix from a 3x3 matrix.
- Args:
matrix (Matrix3d): A 3x3 matrix representing the rotation.
- Example:
>>> matrix = Matrix3d.identity() >>> rotation_matrix = RotationMatrix(matrix)
__init__(self: ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix, first_coefficient: ostk.core.type.Real, second_coefficient: ostk.core.type.Real, third_coefficient: ostk.core.type.Real, fourth_coefficient: ostk.core.type.Real, fifth_coefficient: ostk.core.type.Real, sixth_coefficient: ostk.core.type.Real, seventh_coefficient: ostk.core.type.Real, eighth_coefficient: ostk.core.type.Real, ninth_coefficient: ostk.core.type.Real) -> None
Create a rotation matrix from nine coefficients (row-major order).
- Args:
first_coefficient (float): Matrix element (0,0). second_coefficient (float): Matrix element (0,1). third_coefficient (float): Matrix element (0,2). fourth_coefficient (float): Matrix element (1,0). fifth_coefficient (float): Matrix element (1,1). sixth_coefficient (float): Matrix element (1,2). seventh_coefficient (float): Matrix element (2,0). eighth_coefficient (float): Matrix element (2,1). ninth_coefficient (float): Matrix element (2,2).
- Example:
>>> rot_matrix = RotationMatrix(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0)
Methods
Create a rotation matrix from column vectors.
Create a rotation matrix from Euler angles.
Get a column of the rotation matrix at specified index.
Get the underlying 3x3 matrix.
Get a row of the rotation matrix at specified index.
Check if the rotation matrix is defined.
Create a rotation matrix from a quaternion.
Create a rotation matrix from a rotation vector.
Create a rotation matrix from row vectors.
Create a rotation matrix for rotation around the X-axis.
Create a rotation matrix for rotation around the Y-axis.
Create a rotation matrix for rotation around the Z-axis.
Get the transpose of this rotation matrix.
Transpose the rotation matrix in place.
Create an undefined rotation matrix.
Create a unit rotation matrix (identity matrix).
Create a rotation matrix from two pairs of vectors.
- __mul__(*args, **kwargs)¶
Overloaded function.
__mul__(self: ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix, arg0: ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix) -> ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix
__mul__(self: ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix, arg0: numpy.ndarray[numpy.float64[3, 1]]) -> numpy.ndarray[numpy.float64[3, 1]]
- static columns(
- first_column: numpy.ndarray[numpy.float64[3, 1]],
- second_column: numpy.ndarray[numpy.float64[3, 1]],
- third_column: numpy.ndarray[numpy.float64[3, 1]],
- second_column: numpy.ndarray[numpy.float64[3, 1]],
Create a rotation matrix from column vectors.
- Parameters:
first_column (Vector3d) -- The first column of the rotation matrix.
second_column (Vector3d) -- The second column of the rotation matrix.
third_column (Vector3d) -- The third column of the rotation matrix.
- Returns:
A rotation matrix from column vectors.
- Return type:
Example
>>> rot_matrix = RotationMatrix.columns(Vector3d(1.0, 0.0, 0.0), Vector3d(0.0, 1.0, 0.0), Vector3d(0.0, 0.0, 1.0))
- static euler_angle(
- euler_angle: ostk::mathematics::geometry::d3::transformation::rotation::EulerAngle,
Create a rotation matrix from Euler angles.
- Parameters:
euler_angle (EulerAngle) -- The Euler angles to convert.
- Returns:
The equivalent rotation matrix.
- Return type:
Example
>>> euler = EulerAngle.unit() >>> rot_matrix = RotationMatrix.euler_angle(euler)
- get_column_at( ) numpy.ndarray[numpy.float64[3, 1]]¶
Get a column of the rotation matrix at specified index.
- Parameters:
index (int) -- The column index (0, 1, or 2).
- Returns:
The column vector at the specified index.
- Return type:
Vector3d
Example
>>> rot_matrix = RotationMatrix.unit() >>> first_column = rot_matrix.get_column_at(0) # [1, 0, 0]
- get_matrix( ) numpy.ndarray[numpy.float64[3, 3]]¶
Get the underlying 3x3 matrix.
- Returns:
The 3x3 rotation matrix.
- Return type:
Matrix3d
Example
>>> rot_matrix = RotationMatrix.unit() >>> matrix = rot_matrix.get_matrix()
- get_row_at( ) numpy.ndarray[numpy.float64[3, 1]]¶
Get a row of the rotation matrix at specified index.
- Parameters:
index (int) -- The row index (0, 1, or 2).
- Returns:
The row vector at the specified index.
- Return type:
Vector3d
Example
>>> rot_matrix = RotationMatrix.unit() >>> first_row = rot_matrix.get_row_at(0) # [1, 0, 0]
- is_defined( ) bool¶
Check if the rotation matrix is defined.
- Returns:
True if the rotation matrix is defined, False otherwise.
- Return type:
Example
>>> rot_matrix = RotationMatrix(Matrix3d.identity()) >>> rot_matrix.is_defined() # True
- static quaternion( ) ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix¶
Create a rotation matrix from a quaternion.
- Parameters:
quaternion (Quaternion) -- The quaternion to convert.
- Returns:
The equivalent rotation matrix.
- Return type:
Example
>>> quat = Quaternion.unit() >>> rot_matrix = RotationMatrix.quaternion(quat)
- static rotation_vector(
- rotation_vector: ostk.mathematics.geometry.d3.transformation.rotation.RotationVector,
Create a rotation matrix from a rotation vector.
- Parameters:
rotation_vector (RotationVector) -- The rotation vector to convert.
- Returns:
The equivalent rotation matrix.
- Return type:
Example
>>> rot_vector = RotationVector.unit() >>> rot_matrix = RotationMatrix.rotation_vector(rot_vector)
- static rows(
- first_row: numpy.ndarray[numpy.float64[3, 1]],
- second_row: numpy.ndarray[numpy.float64[3, 1]],
- third_row: numpy.ndarray[numpy.float64[3, 1]],
- second_row: numpy.ndarray[numpy.float64[3, 1]],
Create a rotation matrix from row vectors.
- Parameters:
first_row (Vector3d) -- The first row of the rotation matrix.
second_row (Vector3d) -- The second row of the rotation matrix.
third_row (Vector3d) -- The third row of the rotation matrix.
- Returns:
A rotation matrix from row vectors.
- Return type:
Example
>>> rot_matrix = RotationMatrix.rows(Vector3d(1.0, 0.0, 0.0), Vector3d(0.0, 1.0, 0.0), Vector3d(0.0, 0.0, 1.0))
- static rx(
- rotation_angle: ostk::mathematics::geometry::Angle,
Create a rotation matrix for rotation around the X-axis.
- Parameters:
rotation_angle (Angle) -- The angle of rotation around X-axis.
- Returns:
A rotation matrix for X-axis rotation.
- Return type:
Example
>>> rot_x = RotationMatrix.rx(Angle.degrees(90.0))
- static ry(
- rotation_angle: ostk::mathematics::geometry::Angle,
Create a rotation matrix for rotation around the Y-axis.
- Parameters:
rotation_angle (Angle) -- The angle of rotation around Y-axis.
- Returns:
A rotation matrix for Y-axis rotation.
- Return type:
Example
>>> rot_y = RotationMatrix.ry(Angle.degrees(90.0))
- static rz(
- rotation_angle: ostk::mathematics::geometry::Angle,
Create a rotation matrix for rotation around the Z-axis.
- Parameters:
rotation_angle (Angle) -- The angle of rotation around Z-axis.
- Returns:
A rotation matrix for Z-axis rotation.
- Return type:
Example
>>> rot_z = RotationMatrix.rz(Angle.degrees(90.0))
- to_transposed( ) ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix¶
Get the transpose of this rotation matrix.
- Returns:
The transposed rotation matrix.
- Return type:
Example
>>> rot_matrix = RotationMatrix.rx(Angle.degrees(90.0)) >>> transposed = rot_matrix.to_transposed()
- transpose( ) None¶
Transpose the rotation matrix in place.
Example
>>> rot_matrix = RotationMatrix.rx(Angle.degrees(90.0)) >>> rot_matrix.transpose()
- static undefined() ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix¶
Create an undefined rotation matrix.
- Returns:
An undefined rotation matrix.
- Return type:
Example
>>> undefined_matrix = RotationMatrix.undefined() >>> undefined_matrix.is_defined() # False
- static unit() ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix¶
Create a unit rotation matrix (identity matrix).
- Returns:
The 3x3 identity rotation matrix.
- Return type:
Example
>>> unit_matrix = RotationMatrix.unit() >>> matrix = unit_matrix.get_matrix() # 3x3 identity matrix
- static vector_basis(
- source_vectors: tuple[numpy.ndarray[numpy.float64[3, 1]], numpy.ndarray[numpy.float64[3, 1]]],
- destination_vectors: tuple[numpy.ndarray[numpy.float64[3, 1]], numpy.ndarray[numpy.float64[3, 1]]],
Create a rotation matrix from two pairs of vectors.
Constructs orthonormal basis frames from each pair of vectors and returns the rotation matrix that transforms from the source basis to the destination basis. The first vector defines the primary direction, and the second vector is used to determine the orientation of the basis (via cross product).
- Parameters:
- Returns:
Rotation matrix transforming from source to destination basis.
- Return type:
Example
>>> # Identity rotation >>> source1 = numpy.array([1.0, 0.0, 0.0]) >>> source2 = numpy.array([0.0, 1.0, 0.0]) >>> rot = RotationMatrix.vector_basis((source1, source2), (source1, source2))
>>> # 90-degree rotation around Z-axis >>> dest1 = numpy.array([0.0, 1.0, 0.0]) >>> dest2 = numpy.array([-1.0, 0.0, 0.0]) >>> rot = RotationMatrix.vector_basis((source1, source2), (dest1, dest2))