
    e,                     Z    d dl ZddlmZ ddlmZ ddlmZ  G d dej                        Z	y)    N   )	functions)QtGui)Vectorc                   *    e Zd ZdZd ZddZd Zd Zy)Transform3DzB
    Extension of QMatrix4x4 with some helpful methods added.
    c                    t        |      dk(  rt        |d   t        t        t        j
                  f      r4|d   D cg c]  }|D ]  }|  }}}t        |      dk7  rDt        d      t        |d   t        j                        rt        |d   j                               }t        j                  j                  | g|  y c c}}w )Nr   r      z5Single argument to Transform3D must have 16 elements.)len
isinstancelisttuplenpndarray	TypeErrorr   
QMatrix4x4
copyDataTo__init__)selfargsyxs       7/usr/lib/python3/dist-packages/pyqtgraph/Transform3D.pyr   zTransform3D.__init__   s    t9>$q'D%#<=#'76aA6q666t9?#$[\\DGU%5%56DG..01!!$.. 7s   Cc                 >   |dk(  r3t        j                  | j                               j                  dd      S |dk(  rVt        j                  | j                               j                  dd      }|d   |d<   |d d df   |d d df<   |d dd df   S t	        d      )N         zArgument 'nd' must be 2 or 3)r   arrayr   reshape	Exception)r   ndms      r   matrixzTransform3D.matrix   s    788DOO-.66q;;1W*+33Aa8AQ4AaDqsVAacFRaRU8O:;;    c                 
   t        |t        j                        r|j                  d   dv r|j                  dk\  rt        j                  | |      S |j                  dk(  r{t        j                  j                  | t        |            }t        j                  |j                         |j                         |j                         g      d|j                  d    S yt        |t        t         f      rst        j                  j                  | t        |            } t#        |      |j                         |j                         |j                         g      dt%        |       S t        j                  j                  | |      S )zZ
        Extends QMatrix4x4.map() to allow mapping (3, ...) arrays of coordinates
        r   )r   r   r   r   N)r   r   r   shapendimfntransformCoordinatesr   r   mapr   r   r   r   zr   r   typer   )r   objvs      r   r*   zTransform3D.map"   s    c2::&399Q<5+@xx1}..tS99Q$$((vc{;xxqssu 56}		!EE  dE]+  $$T6#;7A49acceQSSUACCE23ISX>>##''c22r$   c                 `    t         j                  j                  |       \  }}t        |      |fS )N)r   r   invertedr   )r   invbs      r   r0   zTransform3D.inverted2   s,    !!**40Q3""r$   N)r   )__name__
__module____qualname____doc__r   r#   r*   r0    r$   r   r   r      s    	/	<3 #r$   r   )
numpyr    r   r(   Qtr   r   r   r   r7   r$   r   <module>r;      s#       ,#%"" ,#r$   