ostk.mathematics.geometry.d3.Transformation¶
- class Transformation(self, matrix: numpy.ndarray[dtype=float64, shape=(4, 4), order='F'])¶
Bases:
objectRepresents 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
Overloaded function.
Get the inverse transformation.
Get the transformation matrix.
Get the type of the transformation.
- class Type(
- value,
- names=None,
- *,
- module=None,
- qualname=None,
- type=None,
- start=1,
- boundary=None,
- names=None,
Bases:
Enum
- apply_to¶
Overloaded function.
apply_to(self, point: ostk.mathematics.geometry.d3.object.Point) -> ostk.mathematics.geometry.d3.object.PointApply 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)
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:
Example
>>> transformation = Transformation.identity() >>> inverse = transformation.get_inverse() # Identity transformation
- get_matrix¶
Get the transformation matrix.
- Returns:
The 4x4 transformation matrix.
- Return type:
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:
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>¶