A 2x3 matrix representing an affine 2D transformation.
This is an abstract base class implemented by AffineMatrix2D only so far, but in the future we also plan to derive GraphicsMatrix from it.
New in version 2.9.2.
__init__ | Default constructor. |
Concat | Concatenate this matrix with another one. |
Get | Get the component values of the matrix. |
Invert | Invert this matrix. |
IsEqual | Check that this matrix is identical with . |
IsIdentity | Check if this is the identity matrix. |
Mirror | Add mirroring to this matrix. |
Rotate | Add clockwise rotation to this matrix. |
Scale | Add scaling to this matrix. |
Set | Set all elements of this matrix. |
TransformDistance | Applies the linear part of this matrix, i.e. |
TransformPoint | Applies this matrix to the point. |
Translate | Add the translation to this matrix. |
__ne__ | Check that this matrix differs from . |
__eq__ | Check that this matrix is identical with . |
A 2x3 matrix representing an affine 2D transformation.
Possible constructors:
AffineMatrix2DBase()
Default constructor.
The matrix elements are initialize to the identity matrix.
Concatenate this matrix with another one.
The parameter matrix is the multiplicand.
Parameters: | t (AffineMatrix2DBase) – The multiplicand. |
---|
# | t.m_11 t.m_12 0 | | m_11 m_12 0 |
# matrix' = | t.m_21 t.m_22 0 | x | m_21 m_22 0 |
# | t.m_tx t.m_ty 1 | | m_tx m_ty 1 |
Get the component values of the matrix.
The rotational components of the matrix (upper 2 x 2), must be not None.
The translational components of the matrix, may be None.
Return type: | tuple |
---|---|
Returns: | ( mat2D, tr ) |
Invert this matrix.
If the matrix is not invertible, i.e. if its determinant is 0, returns False and doesn’t modify it.
# | m_11 m_12 0 |
# Invert | m_21 m_22 0 |
# | m_tx m_ty 1 |
Return type: | bool |
---|
Check that this matrix is identical with .
Parameters: | t (AffineMatrix2DBase) – The matrix compared with this. |
---|---|
Return type: | bool |
Check if this is the identity matrix.
Return type: | bool |
---|
Add mirroring to this matrix.
Parameters: | direction (int) – The direction(s) used for mirroring. One of HORIZONTAL, VERTICAL or their combination BOTH. |
---|
Add clockwise rotation to this matrix.
Parameters: | cRadians (float) – Rotation angle in radians, clockwise. |
---|
Add scaling to this matrix.
Parameters: |
|
---|
Set all elements of this matrix.
Parameters: |
|
---|
Overloaded Implementations:
TransformDistance (self, src)
Applies the linear part of this matrix, i.e.
without translation.
Parameters: | src (Point2DDouble) – |
---|
The source receiving the transformations.
Return type: | Point2DDouble |
---|---|
Returns: | The source with the transformations applied. |
TransformDistance (self, dx, dy)
Parameters: |
|
---|---|
Return type: | tuple |
Returns: | ( dx, dy ) |
Overloaded Implementations:
TransformPoint (self, src)
Applies this matrix to the point.
Parameters: | src (Point2DDouble) – |
---|
The point receiving the transformations.
Return type: | Point2DDouble |
---|---|
Returns: | The point with the transformations applied. |
TransformPoint (self, x, y)
Parameters: |
|
---|---|
Return type: | tuple |
Returns: | ( x, y ) |
Add the translation to this matrix.
Parameters: |
|
---|
Check that this matrix differs from .
Parameters: | t (AffineMatrix2DBase) – The matrix compared with this. |
---|
Check that this matrix is identical with .
Parameters: | t (AffineMatrix2DBase) – The matrix compared with this. |
---|