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
Overloaded function.
Get the inverse transformation.
Get the transformation matrix.
Get the type of the transformation.
Create an identity transformation.
Check if the transformation is defined.
Overloaded function.
Create a rotation transformation around a point.
Convert a transformation type to a string.
Create a translation transformation.
Determine the type of a transformation matrix.
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.
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)
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( ) ostk.mathematics.geometry.d3.Transformation ¶
Get the inverse transformation.
- Returns:
The inverse transformation.
- Return type:
Example
>>> transformation = Transformation.identity() >>> inverse = transformation.get_inverse() # Identity transformation
- get_matrix( ) numpy.ndarray[numpy.float64[4, 4]] ¶
Get the transformation matrix.
- Returns:
The 4x4 transformation matrix.
- Return type:
Example
>>> transformation = Transformation.identity() >>> matrix = transformation.get_matrix() # 4x4 identity matrix
- get_type( ) ostk::mathematics::geometry::d3::Transformation::Type ¶
Get the type of the transformation.
- Returns:
The transformation type.
- Return 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:
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:
Example
>>> transformation = Transformation.identity() >>> transformation.is_defined() # True
- static rotation(*args, **kwargs)¶
Overloaded function.
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
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,
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:
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,
Convert a transformation type to a string.
- Parameters:
type (Transformation.Type) -- The transformation type.
- Returns:
The string representation of the type.
- Return type:
Example
>>> transformation = Transformation.identity() >>> transformation.string_from_type() # "Identity"
- static translation(
- translation_vector: numpy.ndarray[numpy.float64[3, 1]],
Create a translation transformation.
- Parameters:
translation_vector (numpy.ndarray) -- The translation vector.
- Returns:
A translation transformation.
- Return type:
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]],
Determine the type of a transformation matrix.
- Parameters:
matrix (numpy.ndarray) -- The 4x4 transformation matrix.
- Returns:
The type of the transformation.
- Return 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:
Example
>>> transformation = Transformation.undefined() >>> transformation.is_defined() # False