.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2018 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

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>AffineMatrix2D</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.AffineMatrix2D_inheritance.png" alt="Inheritance diagram of AffineMatrix2D" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.AffineMatrix2D.html" title="A 3x2 matrix representing an affine ``2D`` transformation." alt="" coords="22,83,166,112"/> <area shape="rect" id="node2" href="wx.AffineMatrix2DBase.html" title="A 2x3 matrix representing an affine ``2D`` transformation." alt="" coords="5,5,183,35"/> </map> 
   </p>
   </div>

|


|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()
       
   
   A 3x2 matrix representing an affine ``2D`` transformation.



   .. method:: __init__(self)

      Default constructor.                  

      The matrix elements are initialize to the identity matrix.                   





   .. method:: Concat(self, t)

      Concatenate this matrix with another one.                  

      The parameter matrix is the multiplicand. 




      :param `t`: The multiplicand.  
      :type `t`: wx.AffineMatrix2DBase




      ::

                  #           | 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: `tuple`



                  



      :returns: 

         ( `mat2D`, `tr` ) 








   .. 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)

      Check that this matrix is identical with `t`.                  




      :param `t`: The matrix compared with this.   
      :type `t`: wx.AffineMatrix2DBase




                  





   .. method:: IsIdentity(self)

      Check if this is the identity matrix.                  

      :rtype: `bool`








   .. method:: Mirror(self, direction=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




                  





   .. method:: Rotate(self, cRadians)

      Add clockwise rotation to this matrix.                  




      :param `cRadians`: Rotation angle in radians, clockwise.  
      :type `cRadians`: wx.Double




      ::

                  #           | 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, yScale)

      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






      ::

                  #           | 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, tr)

      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






                  





   .. method:: TransformDistance(self, *args, **kw)



      |overload| Overloaded Implementations:

      :html:`<hr class="overloadsep" /><br />`

      
      **TransformDistance** `(self, p)`
      
      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:`<hr class="overloadsep" /><br />`

      
      **TransformDistance** `(self, dx, dy)`
      
      
      
      
      :param `dx`: 
      :type `dx`: wx.Double
      :param `dy`: 
      :type `dy`: wx.Double
      
      
      
      
      :rtype: `tuple`
      
      
      
      
      
      
      
      :returns: 
      
         ( `dx`, `dy` ) 
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: TransformPoint(self, *args, **kw)



      |overload| Overloaded Implementations:

      :html:`<hr class="overloadsep" /><br />`

      
      **TransformPoint** `(self, p)`
      
      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:`<hr class="overloadsep" /><br />`

      
      **TransformPoint** `(self, x, y)`
      
      
      
      
      :param `x`: 
      :type `x`: wx.Double
      :param `y`: 
      :type `y`: wx.Double
      
      
      
      
      :rtype: `tuple`
      
      
      
      
      
      
      
      :returns: 
      
         ( `x`, `y` ) 
      
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: Translate(self, dx, dy)

      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






      ::

                  #           |  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