ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix

class RotationMatrix(*args, **kwargs)

Bases: pybind11_object

Overloaded function.

  1. __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)
    
  2. __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

columns

Create a rotation matrix from column vectors.

euler_angle

Create a rotation matrix from Euler angles.

get_column_at

Get a column of the rotation matrix at specified index.

get_matrix

Get the underlying 3x3 matrix.

get_row_at

Get a row of the rotation matrix at specified index.

is_defined

Check if the rotation matrix is defined.

quaternion

Create a rotation matrix from a quaternion.

rotation_vector

Create a rotation matrix from a rotation vector.

rows

Create a rotation matrix from row vectors.

rx

Create a rotation matrix for rotation around the X-axis.

ry

Create a rotation matrix for rotation around the Y-axis.

rz

Create a rotation matrix for rotation around the Z-axis.

to_transposed

Get the transpose of this rotation matrix.

transpose

Transpose the rotation matrix in place.

undefined

Create an undefined rotation matrix.

unit

Create a unit rotation matrix (identity matrix).

vector_basis

Create a rotation matrix from two pairs of vectors.

__mul__(*args, **kwargs)

Overloaded function.

  1. __mul__(self: ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix, arg0: ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix) -> ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix

  2. __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]],
) ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix

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:

RotationMatrix

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,
) ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix

Create a rotation matrix from Euler angles.

Parameters:

euler_angle (EulerAngle) -- The Euler angles to convert.

Returns:

The equivalent rotation matrix.

Return type:

RotationMatrix

Example

>>> euler = EulerAngle.unit()
>>> rot_matrix = RotationMatrix.euler_angle(euler)
get_column_at(
self: ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix,
index: int,
) 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(
self: ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix,
) 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(
self: ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix,
index: int,
) 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(
self: ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix,
) bool

Check if the rotation matrix is defined.

Returns:

True if the rotation matrix is defined, False otherwise.

Return type:

bool

Example

>>> rot_matrix = RotationMatrix(Matrix3d.identity())
>>> rot_matrix.is_defined()  # True
static quaternion(
quaternion: ostk.mathematics.geometry.d3.transformation.rotation.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:

RotationMatrix

Example

>>> quat = Quaternion.unit()
>>> rot_matrix = RotationMatrix.quaternion(quat)
static rotation_vector(
rotation_vector: ostk.mathematics.geometry.d3.transformation.rotation.RotationVector,
) ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix

Create a rotation matrix from a rotation vector.

Parameters:

rotation_vector (RotationVector) -- The rotation vector to convert.

Returns:

The equivalent rotation matrix.

Return type:

RotationMatrix

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]],
) ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix

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:

RotationMatrix

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,
) ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix

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:

RotationMatrix

Example

>>> rot_x = RotationMatrix.rx(Angle.degrees(90.0))
static ry(
rotation_angle: ostk::mathematics::geometry::Angle,
) ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix

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:

RotationMatrix

Example

>>> rot_y = RotationMatrix.ry(Angle.degrees(90.0))
static rz(
rotation_angle: ostk::mathematics::geometry::Angle,
) ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix

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:

RotationMatrix

Example

>>> rot_z = RotationMatrix.rz(Angle.degrees(90.0))
to_transposed(
self: ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix,
) ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix

Get the transpose of this rotation matrix.

Returns:

The transposed rotation matrix.

Return type:

RotationMatrix

Example

>>> rot_matrix = RotationMatrix.rx(Angle.degrees(90.0))
>>> transposed = rot_matrix.to_transposed()
transpose(
self: ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix,
) 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:

RotationMatrix

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:

RotationMatrix

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]]],
) ostk.mathematics.geometry.d3.transformation.rotation.RotationMatrix

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:
  • source_vectors (tuple[numpy.array, numpy.array]) -- A pair of 3-dimensional source vectors.

  • destination_vectors (tuple[numpy.array, numpy.array]) -- A pair of 3-dimensional destination vectors.

Returns:

Rotation matrix transforming from source to destination basis.

Return type:

RotationMatrix

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))