ostk.mathematics.geometry.d3.Transformation

class Transformation(self, matrix: numpy.ndarray[dtype=float64, shape=(4, 4), order='F'])

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

Attributes

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

rotation

rotation_around

string_from_type

translation

type_of_matrix

class Type(
value,
names=None,
*,
module=None,
qualname=None,
type=None,
start=1,
boundary=None,
)

Bases: Enum

apply_to

Overloaded function.

  1. apply_to(self, 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, vector: numpy.ndarray[dtype=float64, shape=(3), order='C']) -> numpy.ndarray[dtype=float64, shape=(3), order='C']

    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

Get the inverse transformation.

Returns:

The inverse transformation.

Return type:

Transformation

Example

>>> transformation = Transformation.identity()
>>> inverse = transformation.get_inverse()  # Identity transformation
get_matrix

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

Get the type of the transformation.

Returns:

The transformation type.

Return type:

Transformation.Type

Example

>>> transformation = Transformation.identity()
>>> transformation.get_type()  # Transformation.Type.Identity
identity = <nanobind.nb_func object>
rotation = <nanobind.nb_func object>
rotation_around = <nanobind.nb_func object>
string_from_type = <nanobind.nb_func object>
translation = <nanobind.nb_func object>
type_of_matrix = <nanobind.nb_func object>