Scale
- class compas.geometry.Scale[source]
Bases:
Transformation
Class representing a scale transformation.
- Parameters:
- matrixlist[list[float]], optional
A 4x4 matrix (or similar) representing a scaling.
- checkbool, optional
If
True
, the provided matrix will be checked for validity.- namestr, optional
The name of the transformation.
- Raises:
- ValueError
If
check
isTrue
and the provided transformation matrix is not a scale matrix.
Examples
>>> S = Scale.from_factors([1, 2, 3]) >>> S[0, 0] == 1 True >>> S[1, 1] == 2 True >>> S[2, 2] == 3 True
>>> from compas.geometry import Point, Frame >>> point = Point(2, 5, 0) >>> frame = Frame(point, (1, 0, 0), (0, 1, 0)) >>> points = [point, Point(2, 10, 0)] >>> S = Scale.from_factors([2.] * 3, frame) >>> [p.transformed(S) for p in points] [Point(2.000, 5.000, 0.000), Point(2.000, 15.000, 0.000)]
Methods
Construct a scale transformation from scale factors.
Inherited Methods
Converts the instance to a string.
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 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 of this type from a JSON file.
Construct an object of this type from 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.
Compute a hash of the data for comparison during version control using the sha256 algorithm.
Convert an object to its native data representation and save it to a JSON file.
Convert an object to its native data representation and save it to a JSON string.
Transpose the matrix of this transformation.
Create a transposed copy of this transformation.
Validate the data against the object's data schema.