ostk.mathematics.geometry.d3.Transformation

class Transformation(
self: ostk.mathematics.geometry.d3.Transformation,
matrix: numpy.ndarray[numpy.float64[4, 4]],
)

Bases: pybind11_object

Represents a 3D geometric transformation.

A Transformation can represent translation, rotation, scaling, reflection, shear, or general affine transformations.

Construct a transformation from a 4x4 matrix.

Parameters:

matrix (numpy.ndarray) -- A 4x4 transformation matrix.

Example

>>> import numpy as np
>>> matrix = numpy.eye(3)  # 3x3 identity matrix
>>> transformation = Transformation(matrix)

Methods

apply_to

Overloaded function.

get_inverse

Get the inverse transformation.

get_matrix

Get the transformation matrix.

get_type

Get the type of the transformation.

identity

Create an identity transformation.

is_defined

Check if the transformation is defined.

rotation

Overloaded function.

rotation_around

Create a rotation transformation around a point.

string_from_type

Convert a transformation type to a string.

translation

Create a translation transformation.

type_of_matrix

Determine the type of a transformation matrix.

undefined

Create an undefined transformation.

class Type(self: ostk.mathematics.geometry.d3.Transformation.Type, value: int)

Bases: pybind11_object

Members:

Undefined

Identity

Translation

Rotation

Scaling

Reflection

Shear

Affine

property name
apply_to(*args, **kwargs)

Overloaded function.

  1. apply_to(self: ostk.mathematics.geometry.d3.Transformation, point: ostk.mathematics.geometry.d3.object.Point) -> ostk.mathematics.geometry.d3.object.Point

    Apply the transformation to a point.

    Args:

    point (Point): The point to transform.

    Returns:

    Point: The transformed point.

    Example:
    >>> transformation = Transformation.identity()
    >>> point = Point(1.0, 2.0, 3.0)
    >>> transformed_point = transformation.apply_to(point)  # Point(1.0, 2.0, 3.0)
    
  2. apply_to(self: ostk.mathematics.geometry.d3.Transformation, vector: numpy.ndarray[numpy.float64[3, 1]]) -> numpy.ndarray[numpy.float64[3, 1]]

    Apply the transformation to a vector.

    Args:

    vector (numpy.ndarray): The vector to transform.

    Returns:

    numpy.ndarray: The transformed vector.

    Example:
    >>> transformation = Transformation.identity()
    >>> vector = Vector3d(1.0, 2.0, 3.0)
    >>> transformed_vector = transformation.apply_to(vector)  # Vector3d(1.0, 2.0, 3.0)
    
get_inverse(
self: ostk.mathematics.geometry.d3.Transformation,
) ostk.mathematics.geometry.d3.Transformation

Get the inverse transformation.

Returns:

The inverse transformation.

Return type:

Transformation

Example

>>> transformation = Transformation.identity()
>>> inverse = transformation.get_inverse()  # Identity transformation
get_matrix(
self: ostk.mathematics.geometry.d3.Transformation,
) numpy.ndarray[numpy.float64[4, 4]]

Get the transformation matrix.

Returns:

The 4x4 transformation matrix.

Return type:

numpy.ndarray

Example

>>> transformation = Transformation.identity()
>>> matrix = transformation.get_matrix()  # 4x4 identity matrix
get_type(
self: ostk.mathematics.geometry.d3.Transformation,
) ostk::mathematics::geometry::d3::Transformation::Type

Get the type of the transformation.

Returns:

The transformation type.

Return type:

Transformation.Type

Example

>>> transformation = Transformation.identity()
>>> transformation.get_type()  # Transformation.Type.Identity
static identity() ostk.mathematics.geometry.d3.Transformation

Create an identity transformation.

Returns:

An identity transformation.

Return type:

Transformation

Example

>>> transformation = Transformation.identity()
>>> transformation.is_defined()  # True
is_defined(self: ostk.mathematics.geometry.d3.Transformation) bool

Check if the transformation is defined.

Returns:

True if the transformation is defined.

Return type:

bool

Example

>>> transformation = Transformation.identity()
>>> transformation.is_defined()  # True
static rotation(*args, **kwargs)

Overloaded function.

  1. rotation(rotation_vector: ostk::mathematics::geometry::d3::transformation::rotation::RotationVector) -> ostk.mathematics.geometry.d3.Transformation

    Create a rotation transformation from a rotation vector.

    Args:

    rotation_vector (RotationVector): The rotation vector.

    Returns:

    Transformation: A rotation transformation.

    Example:
    >>> rotation_vector = RotationVector(1.0, 2.0, 3.0)
    >>> transformation = Transformation.rotation(rotation_vector)
    >>> transformation.is_defined()  # True
    
  2. rotation(rotation_matrix: ostk::mathematics::geometry::d3::transformation::rotation::RotationMatrix) -> ostk.mathematics.geometry.d3.Transformation

    Create a rotation transformation from a rotation matrix.

    Args:

    rotation_matrix (RotationMatrix): The rotation matrix.

    Returns:

    Transformation: A rotation transformation.

    Example:
    >>> rotation_matrix = RotationMatrix(1.0, 2.0, 3.0)
    >>> transformation = Transformation.rotation(rotation_matrix)
    >>> transformation.is_defined()  # True
    
static rotation_around(
point: ostk.mathematics.geometry.d3.object.Point,
rotation_vector: ostk::mathematics::geometry::d3::transformation::rotation::RotationVector,
) ostk.mathematics.geometry.d3.Transformation

Create a rotation transformation around a point.

Parameters:
  • point (Point) -- The point to rotate around.

  • rotation_vector (RotationVector) -- The rotation vector.

Returns:

A rotation transformation around the point.

Return type:

Transformation

Example

>>> point = Point(1.0, 2.0, 3.0)
>>> rotation_vector = RotationVector(1.0, 2.0, 3.0)
>>> transformation = Transformation.rotation_around(point, rotation_vector)
>>> transformation.is_defined()  # True
static string_from_type(
type: ostk::mathematics::geometry::d3::Transformation::Type,
) ostk.core.type.String

Convert a transformation type to a string.

Parameters:

type (Transformation.Type) -- The transformation type.

Returns:

The string representation of the type.

Return type:

str

Example

>>> transformation = Transformation.identity()
>>> transformation.string_from_type()  # "Identity"
static translation(
translation_vector: numpy.ndarray[numpy.float64[3, 1]],
) ostk.mathematics.geometry.d3.Transformation

Create a translation transformation.

Parameters:

translation_vector (numpy.ndarray) -- The translation vector.

Returns:

A translation transformation.

Return type:

Transformation

Example

>>> translation_vector = Vector3d(1.0, 2.0, 3.0)
>>> transformation = Transformation.translation(translation_vector)
>>> transformation.is_defined()  # True
static type_of_matrix(
matrix: numpy.ndarray[numpy.float64[4, 4]],
) ostk::mathematics::geometry::d3::Transformation::Type

Determine the type of a transformation matrix.

Parameters:

matrix (numpy.ndarray) -- The 4x4 transformation matrix.

Returns:

The type of the transformation.

Return type:

Transformation.Type

Example

>>> transformation = Transformation.identity()
>>> transformation.type_of_matrix()  # Transformation.Type.Identity
static undefined() ostk.mathematics.geometry.d3.Transformation

Create an undefined transformation.

Returns:

An undefined transformation.

Return type:

Transformation

Example

>>> transformation = Transformation.undefined()
>>> transformation.is_defined()  # False