Two dimensional affine transform for linear mapping from 2D coordinates to other 2D coordinates. Parallel lines are preserved by these transforms. Affine transforms can perform any combination of translations, scales/flips, shears, and rotations. Class methods are provided to conveniently compose transforms from these operations.
Internally the transform is stored as a 3x3 transformation matrix. The transform may be constructed directly by specifying the first two rows of matrix values as 6 floats. Since the matrix is an affine transform, the last row is always (0, 0, 1).
Parameter: | members (float) – 6 floats for the first two matrix rows. |
---|
Compare transforms for approximate equality.
Parameter: | other (Affine) – Transform being compared. |
---|---|
Returns: | True if absolute difference between each element of each respective tranform matrix < EPSILON. |
Return the identity transform.
Return type: | Affine |
---|
Transform a sequence of points or vectors in place.
Parameter: | seq – Mutable sequence of Vec2 to be transformed. |
---|---|
Returns: | None, the input sequence is mutated in place. |
Create a rotation transform at the specified angle, optionally about the specified pivot point.
Parameters: |
|
---|---|
Return type: | Affine |
Create a scaling transform from a scalar or vector.
Parameter: | scaling (float or Vec2) – The scaling factor. A scalar value will scale in both dimensions equally. A vector scaling value scales the dimensions independently. |
---|---|
Return type: | Affine |
Create a shear transform along one or both axes.
Parameters: |
|
---|---|
Return type: | Affine |
Create a translation transform from an offset vector.
Parameter: | offset (Vec2) – Translation offset. |
---|---|
Return type: | Affine |