.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2020 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. _wx.AffineMatrix2D:
==========================================================================================================================================
|phoenix_title| **wx.AffineMatrix2D**
==========================================================================================================================================
A 3x2 matrix representing an affine ``2D`` transformation.
.. versionadded:: 2.9.2
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html

Inheritance diagram for class
AffineMatrix2D:
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.AffineMatrix2D.__init__` Default constructor.
:meth:`~wx.AffineMatrix2D.Concat` Concatenate this matrix with another one.
:meth:`~wx.AffineMatrix2D.Get` Get the component values of the matrix.
:meth:`~wx.AffineMatrix2D.Invert` Invert this matrix.
:meth:`~wx.AffineMatrix2D.IsEqual` Check that this matrix is identical with `t`.
:meth:`~wx.AffineMatrix2D.IsIdentity` Check if this is the identity matrix.
:meth:`~wx.AffineMatrix2D.Mirror` Add mirroring to this matrix.
:meth:`~wx.AffineMatrix2D.Rotate` Add clockwise rotation to this matrix.
:meth:`~wx.AffineMatrix2D.Scale` Add scaling to this matrix.
:meth:`~wx.AffineMatrix2D.Set` Set all elements of this matrix.
:meth:`~wx.AffineMatrix2D.TransformDistance` Applies the linear part of this matrix, i.e. without translation.
:meth:`~wx.AffineMatrix2D.TransformPoint` Applies this matrix to the point.
:meth:`~wx.AffineMatrix2D.Translate` Add the translation to this matrix.
:meth:`~wx.AffineMatrix2D.__ne__` Check that this matrix differs from `t`.
:meth:`~wx.AffineMatrix2D.__eq__` Check that this matrix is identical with `t`.
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.AffineMatrix2D(AffineMatrix2DBase)
**Possible constructors**::
AffineMatrix2D() -> None
A 3x2 matrix representing an affine ``2D`` transformation.
.. method:: __init__(self)
Default constructor.
The matrix elements are initialize to the identity matrix.
:rtype: `None`
.. method:: Concat(self, t : AffineMatrix2DBase)
Concatenate this matrix with another one.
The parameter matrix is the multiplicand.
:param `t`: The multiplicand.
:type `t`: wx.AffineMatrix2DBase
:rtype: `None`
::
# | 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 |
.. method:: Get(self)
Get the component values of the matrix.
:rtype: :ref:`Tuple[Matrix2D, Point2DDouble]`
.. method:: Invert(self)
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 |
:rtype: `bool`
.. method:: IsEqual(self, t : AffineMatrix2DBase)
Check that this matrix is identical with `t`.
:param `t`: The matrix compared with this.
:type `t`: wx.AffineMatrix2DBase
:rtype: `None`
.. method:: IsIdentity(self)
Check if this is the identity matrix.
:rtype: `bool`
.. method:: Mirror(self, direction: int=HORIZONTAL)
Add mirroring to this matrix.
:param `direction`: The direction(s) used for mirroring. One of ``wx.HORIZONTAL``, ``wx.VERTICAL`` or their combination ``wx.BOTH``.
:type `direction`: int
:rtype: `None`
.. method:: Rotate(self, cRadians : float)
Add clockwise rotation to this matrix.
:param `cRadians`: Rotation angle in radians, clockwise.
:type `cRadians`: wx.Double
:rtype: `None`
::
# | cos sin 0 | | self.11 self.12 0 |
# matrix' = | -sin cos 0 | x | self.21 self.22 0 |
# | 0 0 1 | | self.tx self.ty 1 |
.. method:: Scale(self, xScale : float, yScale : float)
Add scaling to this matrix.
:param `xScale`: Scaling in x direction.
:type `xScale`: wx.Double
:param `yScale`: Scaling in y direction.
:type `yScale`: wx.Double
:rtype: `None`
::
# | xScale 0 0 | | self.11 self.12 0 |
# matrix' = | 0 yScale 0 | x | self.21 self.22 0 |
# | 0 0 1 | | self.tx self.ty 1 |
.. method:: Set(self, mat2D : Matrix2D, tr : Point2DDouble)
Set all elements of this matrix.
:param `mat2D`: The rotational components of the matrix (upper 2 x 2).
:type `mat2D`: wx.Matrix2D
:param `tr`: The translational components of the matrix.
:type `tr`: Point2DDouble
:rtype: `None`
.. method:: TransformDistance(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**TransformDistance** `(self, p : Point2DDouble)`
Applies the linear part of this matrix, i.e. without translation.
:param `p`: The source receiving the transformations.
:type `p`: Point2DDouble
:rtype: `Point2DDouble`
::
# | self.11 self.12 0 |
# dist' = | src.self.x src._my 0 | x | self.21 self.22 0 |
# | self.tx self.ty 1 |
:returns:
The source with the transformations applied.
:html:`
`
**TransformDistance** `(self, dx : float, dy : float)`
:param `dx`:
:type `dx`: wx.Double
:param `dy`:
:type `dy`: wx.Double
:rtype: :ref:`Tuple[float, float]`
:html:`
`
.. method:: TransformPoint(self, *args, **kw)
|overload| **Overloaded Implementations:**
:html:`
`
**TransformPoint** `(self, p : Point2DDouble)`
Applies this matrix to the point.
:param `p`: The point receiving the transformations.
:type `p`: Point2DDouble
:rtype: `Point2DDouble`
::
# | self.11 self.12 0 |
# point' = | src.self.x src._my 1 | x | self.21 self.22 0 |
# | self.tx self.ty 1 |
:returns:
The point with the transformations applied.
:html:`
`
**TransformPoint** `(self, x : float, y : float)`
:param `x`:
:type `x`: wx.Double
:param `y`:
:type `y`: wx.Double
:rtype: :ref:`Tuple[float, float]`
:html:`
`
.. method:: Translate(self, dx : float, dy : float)
Add the translation to this matrix.
:param `dx`: The translation in x direction.
:type `dx`: wx.Double
:param `dy`: The translation in y direction.
:type `dy`: wx.Double
:rtype: `None`
::
# | 1 0 0 | | self.11 self.12 0 |
# matrix' = | 0 1 0 | x | self.21 self.22 0 |
# | dx dy 1 | | self.tx self.ty 1 |
.. method:: __ne__(self)
Check that this matrix differs from `t`.
:param `t`: The matrix compared with this.
:type `t`: wx.AffineMatrix2DBase
.. method:: __eq__(self)
Check that this matrix is identical with `t`.
:param `t`: The matrix compared with this.
:type `t`: wx.AffineMatrix2DBase