Transformation
- class compas.geometry.Transformation(matrix=None)[source]
Bases:
compas.data.data.DataThe
Transformationrepresents a 4x4 transformation matrix.It is the base class for transformations like
Rotation,Translation,Scale,Reflection,ProjectionandShear.The class allows to concatenate Transformations by multiplication, to calculate the inverse transformation and to decompose a transformation into its components of rotation, translation, scale, shear, and perspective. The matrix follows the row-major order, such that translation components x, y, z are in the right column of the matrix, i.e.
M[0][3], M[1][3], M[2][3] = x, y, z.- Parameters
matrix (list of list of float, optional) – The 4x4 transformation matrix.
Examples
>>> from compas.geometry import Frame >>> f1 = Frame([1, 1, 1], [0.68, 0.68, 0.27], [-0.67, 0.73, -0.15]) >>> T = Transformation.from_frame(f1) >>> Sc, Sh, R, Tl, P = T.decomposed() >>> Tinv = T.inverse()Attributes
DATASCHEMAThe schema of the data of this object.
JSONSCHEMANAMEbasis_vectorsThe basis vectors from the rotation component of the transformation matrix.
dataReturn a
Transformationobject's to a data dict.determinantThe determinant of the matrix of the transformation.
listFlattens the 4x4 transformation matrix into a list of 16 numbers.
projectionThe projection component of the transformation matrix.
rotationThe rotation component of the transformation matrix.
scaleThe scale component of the transformation matrix.
shearThe shear component of the transformation matrix.
translationThe translation component of the transformation matrix.
translation_vectorInherited Attributes
JSONSCHEMAThe schema of the JSON representation of the data of this object.
dtypeThe type of the object in the form of a '2-level' import and a class name.
guidThe globally unique identifier of the object.
jsondefinitionsReusable schema definitions.
jsonstringThe representation of the object data in JSON format.
jsonvalidatorJSON schema validator for draft 7.
nameThe name of the object.
Methods
Concatenate another transformation to this transformation.
Concatenate two transformations into one
Transformation.Returns a copy of the transformation.
Decompose the
Transformationinto itsScale,Shear,Rotation,TranslationandProjectioncomponents.Computes a change of basis transformation between two frames.
Creates a
Transformationfrom 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.
Creates a
Transformationfrom a list of 16 numbers.Creates a
Transformationfrom a 4x4 matrix-like object.Returns the inverse transformation.
Invert this transformation.
Returns the inverse transformation.
Convert a
Transformationobject to a data dict.Transpose the matrix of this transformation.
Create a transposed copy of this transformation.
Inherited Methods
Construct an object from serialized data contained in a JSON file.
Construct an object from serialized data contained in a JSON string.
Serialize the data representation of an object to a JSON file.
Serialize the data representation of an object to a JSON string.
Validate the object's data against its data schema (self.DATASCHEMA).
Validate the object's data against its json schema (self.JSONSCHEMA).