Translation
- class compas.geometry.Translation(matrix=None, check=True)[source]
Bases:
Transformation
Class representing a translation transformation.
- Parameters
matrix (list[list[float]], optional) – A 4x4 matrix (or similar) representing a translation.
- Attributes
translation_vector (
compas.geometry.Vector
) – The translation vector.- 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
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 its components.
Construct a change of basis transformation between two frames.
Construct an object of this type from the provided data.
Construct a transformation from a rotation represented by Euler angles.
Construct a transformation from world XY to frame.
Construct 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 list[list[float]] object.
Returns the inverse transformation.
Invert this transformation.
Returns the inverse transformation.
Convert an object to its native data representation.
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.
Validate the object's data against its json schema.