Translation
- class compas.geometry.Translation(matrix=None, check=True)[source]
Bases:
compas.geometry.transformations.transformation.Transformation
Create a translation transformation.
- Parameters
matrix (4x4 matrix-like, optional) – A 4x4 matrix (or similar) representing a translation.
- Raises
ValueError – If the default constructor is used, and the provided transformation matrix is not a translation.
Examples
>>> T = Translation.from_vector([1, 2, 3]) >>> T[0, 3] == 1 True >>> T[1, 3] == 2 True >>> T[2, 3] == 3 True
>>> from compas.geometry import Vector >>> T = Translation.from_vector(Vector(1, 2, 3)) >>> T[0, 3] == 1 True >>> T[1, 3] == 2 True >>> T[2, 3] == 3 True
>>> T = Translation([[1, 0, 0, 1], [0, 1, 0, 2], [0, 0, 1, 3], [0, 0, 0, 1]]) >>> T[0, 3] == 1 True >>> T[1, 3] == 2 True >>> T[2, 3] == 3 True
Attributes
translation_vector
The translation vector.
Inherited Attributes
DATASCHEMA
The schema of the data of this object.
JSONSCHEMA
The schema of the JSON representation of the data of this object.
JSONSCHEMANAME
basis_vectors
The basis vectors from the rotation component of the transformation matrix.
data
Return a
Transformation
object's to a data dict.determinant
The determinant of the matrix of the transformation.
dtype
The type of the object in the form of a '2-level' import and a class name.
guid
The globally unique identifier of the object.
jsondefinitions
Reusable schema definitions.
jsonstring
The representation of the object data in JSON format.
jsonvalidator
JSON schema validator for draft 7.
list
Flattens the 4x4 transformation matrix into a list of 16 numbers.
name
The name of the object.
projection
The projection component of the transformation matrix.
rotation
The rotation component of the transformation matrix.
scale
The scale component of the transformation matrix.
shear
The shear component of the transformation matrix.
translation
The translation component of the transformation matrix.
Methods
Create a translation transformation from a translation vector.
Inherited Methods
Concatenate another transformation to this transformation.
Concatenate two transformations into one
Transformation
.Returns a copy of the transformation.
Decompose the
Transformation
into itsScale
,Shear
,Rotation
,Translation
andProjection
components.Computes a change of basis transformation between two frames.
Creates a
Transformation
from a data dict.Construct a transformation from a rotation represented by Euler angles.
Computes a transformation from world XY to frame.
Computes a transformation between two frames.
Construct an object from serialized data contained in a JSON file.
Construct an object from serialized data contained in a JSON string.
Creates a
Transformation
from a list of 16 numbers.Creates a
Transformation
from a 4x4 matrix-like object.Returns the inverse transformation.
Invert this transformation.
Returns the inverse transformation.
Convert a
Transformation
object to a data dict.Serialize the data representation of an object to a JSON file.
Serialize the data representation of an object to a JSON string.
Transpose the matrix of this transformation.
Create a transposed copy of this transformation.
Validate the object's data against its data schema (self.DATASCHEMA).
Validate the object's data against its json schema (self.JSONSCHEMA).