Ë
    ÿÿæiÍ  ã                   ó¤   — d Z ddlZddlmZ 	 dd„Zd„ Zd„ Zd„ Zd„ Z	d	„ Z
d
„ Zd„ Zd„ Zd„ Zd„ Z ej                   d«      d„ «       Zd„ Zd„ Zd„ Zy)z,
Various transforms used for by the 3D code
é    N)Ú_apic           	      óÆ   — || z
  }||z
  }||z
  }	|�|\  }
}}||
z  }||z  }|	|z  }	t        j                  d|z  dd|  |z  gdd|z  d| |z  gddd|	z  | |	z  gg d¢g«      S )zŸ
    Produce a matrix that scales homogeneous coords in the specified ranges
    to [0, 1], or [0, pb_aspect[i]] if the plotbox aspect ratio is specified.
    é   r   )r   r   r   r   ©ÚnpÚarray)ÚxminÚxmaxÚyminÚymaxÚzminÚzmaxÚ	pb_aspectÚdxÚdyÚdzÚaxÚayÚazs                úp/Volumes/fast/ai/experiments/voice-extract-mac/.venv/lib/python3.12/site-packages/mpl_toolkits/mplot3d/proj3d.pyÚworld_transformationr   
   s¥   € ð 
�‰€BØ	�‰€BØ	�‰€BØÐØ‰
ˆˆB�Ø
ˆb‰ˆØ
ˆb‰ˆØ
ˆb‰ˆä�8‰8�a˜‘d˜q Q¨¨¨b©Ð1Ø˜A˜b™D Q¨¨¨b©Ð1Ø˜q ! B¡$¨¨¨b©Ð1Ú1ð3ó 4ð 4ó    c                 óê  — | t         j                  j                  | «      z  \  }}}t        j                  |«      }t        j                  |«      }dt        j                  |dz  «      dz  z  }t        j
                  ||z  |z  |z   ||z  |z  ||z  z
  ||z  |z  ||z  z   g||z  |z  ||z  z   ||z  |z  |z   ||z  |z  ||z  z
  g||z  |z  ||z  z
  ||z  |z  ||z  z   ||z  |z  |z   gg«      }|S )zK
    Produce a rotation matrix for an angle in radians about a vector.
    é   )r   ÚlinalgÚnormÚsinÚcosr   )	ÚvÚangleÚvxÚvyÚvzÚsÚcÚtÚRs	            r   Ú_rotation_about_vectorr(       s  € ð ”R—Y‘Y—^‘^ AÓ&Ñ&�J€BˆˆBÜ
�‰ˆu‹€AÜ
�‰ˆu‹€AØ	Œ"�&‰&��q‘‹/˜1Ñ
Ñ€Aä
�‰Ø	
ˆ2‰ˆb‰�1‰˜˜2™˜b™ 2 a¡4™¨¨2©¨b©°2°a±4©Ð8Ø	
ˆ2‰ˆb‰�2�a‘4‰˜˜2™˜b™ 1™¨¨2©¨b©°2°a±4©Ð8Ø	
ˆ2‰ˆb‰�2�a‘4‰˜˜2™˜b™ 2 a¡4™¨¨2©¨b©°1©Ð5ð7ó 	8€Að
 €Hr   c                 ór  — | |z
  }|t         j                  j                  |«      z  }t        j                  ||«      }|t         j                  j                  |«      z  }t        j                  ||«      }|dk7  r9t	        || «      }t        j
                  ||«      }t        j
                  ||«      }|||fS )aŸ  
    Get the unit viewing axes in data coordinates.

    Parameters
    ----------
    E : 3-element numpy array
        The coordinates of the eye/camera.
    R : 3-element numpy array
        The coordinates of the center of the view box.
    V : 3-element numpy array
        Unit vector in the direction of the vertical axis.
    roll : float
        The roll angle in radians.

    Returns
    -------
    u : 3-element numpy array
        Unit vector pointing towards the right of the screen.
    v : 3-element numpy array
        Unit vector pointing towards the top of the screen.
    w : 3-element numpy array
        Unit vector pointing out of the screen.
    r   )r   r   r   Úcrossr(   Údot)ÚEr'   ÚVÚrollÚwÚur   ÚRrolls           r   Ú
_view_axesr2   1   s›   € ð0 
ˆQ‰€AØ	Œ"�)‰)�.‰.˜Ó
Ñ€AÜ
�‰��A‹€AØ	Œ"�)‰)�.‰.˜Ó
Ñ€AÜ
�‰��A‹€Að ˆq‚yä& q¨4¨%Ó0ˆÜ�F‰F�5˜!ÓˆÜ�F‰F�5˜!ÓˆØˆa�ˆ7€Nr   c                 ó¶   — t        j                  d«      }t        j                  d«      }| ||g|dd…dd…f<   | |dd…df<   t        j                  ||«      }|S )aœ  
    Return the view transformation matrix.

    Parameters
    ----------
    u : 3-element numpy array
        Unit vector pointing towards the right of the screen.
    v : 3-element numpy array
        Unit vector pointing towards the top of the screen.
    w : 3-element numpy array
        Unit vector pointing out of the screen.
    E : 3-element numpy array
        The coordinates of the eye/camera.
    é   Né   éÿÿÿÿ)r   Úeyer+   )r0   r   r/   r,   ÚMrÚMtÚMs          r   Ú_view_transformation_uvwr;   X   s`   € ô 
�‰�‹€BÜ	�‰�‹€BØ�Q˜�€B€rˆ€rˆ2ˆAˆ2€v�JØ�€B€rˆ€rˆ2€v�JÜ
�‰ˆr�2‹€AØ€Hr   c                 ó”   — |}d}| |z   | |z
  z  }d| |z  z  | |z
  z  }t        j                  |dddgd||z  ddgdd||gg d¢g«      }|S )Nr   éþÿÿÿr   )r   r   r6   r   r   )ÚzfrontÚzbackÚfocal_lengthÚeÚaÚbr%   Úproj_matrixs           r   Ú_persp_transformationrE   o   sw   € Ø€AØ	€AØ	�‰˜˜u™Ñ%€AØ
ˆF�5‰LÑ˜6 %™<Ñ(€AÜ—(‘(˜Q ! a¨˜OØ  !¡ a¨˜OØ ! a¨˜OÚ+ð-ó .€Kð Ðr   c           	      ód   — | |z    }| |z
   }t        j                  g d¢g d¢g d¢dd||gg«      }|S )N)r   r   r   r   )r   r   r   r   )r   r   r=   r   r   r   )r>   r?   rB   rC   rD   s        r   Ú_ortho_transformationrG   {   sH   € à
�5‰.Ð€AØ
�5‰.Ð€AÜ—(‘(šMÚ)Ú)Ø  A q˜Mð+ó ,€Kð Ðr   c                 óf  — t        j                  || j                  «      }|d   }|d   |z  |d   |z  |d   |z  }}}t         j                  j	                  | d   «      r.t         j                  j                  || d   j                  ¬«      }t         j                  j	                  | d   «      r.t         j                  j                  || d   j                  ¬«      }t         j                  j	                  | d   «      r.t         j                  j                  || d   j                  ¬«      }|||fS )Nr5   r   r   r   )Úmask)r   r+   ÚdataÚmaÚisMAr   rI   )Úvecr:   Úvecwr/   ÚtxsÚtysÚtzss          r   Ú_proj_transform_vecrR   †   sæ   € Ü�6‰6�!�S—X‘XÓ€DØˆQ‰€AØ˜‘G˜A‘I˜t A™w q™y¨$¨q©'°!©)ˆcˆ€CÜ	‡u�u‡z�z�#�a‘&ÔÜ�e‰e�k‰k˜# C¨¡F§K¡KˆkÓ0ˆÜ	‡u�u‡z�z�#�a‘&ÔÜ�e‰e�k‰k˜# C¨¡F§K¡KˆkÓ0ˆÜ	‡u�u‡z�z�#�a‘&ÔÜ�e‰e�k‰k˜# C¨¡F§K¡KˆkÓ0ˆØ��Sˆ=Ðr   c                 ó<  — t        j                  || j                  «      }|d   }|d   |z  |d   |z  |d   |z  }}}t        j                  |«      r&t        j                  |j
                  t        ¬«      }nd|k  |dk  z  d|k  z  |dk  z  |dk  z  }t         j                  j                  | d   «      r|| d   j                   z  }t         j                  j                  | d   «      r|| d   j                   z  }t         j                  j                  | d   «      r|| d   j                   z  }t         j                  j                  || «      }t         j                  j                  || «      }t         j                  j                  || «      }||||fS )Nr5   r   r   r   )Údtyper6   )r   r+   rJ   ÚisinfÚonesÚshapeÚboolrK   rL   rI   Úmasked_array)	rM   r:   r@   rN   r/   rO   rP   rQ   Útiss	            r   Ú_proj_transform_vec_clipr[   “   s`  € Ü�6‰6�!�S—X‘XÓ€DØˆQ‰€AØ˜‘G˜a‘K  a¡¨1¡¨d°1©g¸©kˆcˆ€CÜ	‡x�x�ÔÜ�g‰g�c—i‘i¤tÔ,‰à�S‰y˜S A™XÑ&¨"°©)Ñ4¸¸q¹ÑAÀSÈAÁXÑNˆÜ	‡u�u‡z�z�#�a‘&ÔØ�S˜‘V—[‘[�LÑ ˆÜ	‡u�u‡z�z�#�a‘&ÔØ�S˜‘V—[‘[�LÑ ˆÜ	‡u�u‡z�z�#�a‘&ÔØ�S˜‘V—[‘[�LÑ ˆä
�%‰%×
Ñ
˜S 3 $Ó
'€CÜ
�%‰%×
Ñ
˜S 3 $Ó
'€CÜ
�%‰%×
Ñ
˜S 3 $Ó
'€CØ��S˜#ÐÐr   c                 ó(  — t        | ||«      }t        j                  ||«      }|j                  dk(  r|j	                  d«      }t        |j                  d   «      D ]'  }|d   |   dk7  sŒ|dd…|f   |d   |   z  |dd…|f<   Œ) |d   |d   |d   fS )zO
    Transform the points by the inverse of the projection matrix, *invM*.
    )r4   )r4   r   r   r5   r   Nr   )Ú_vec_pad_onesr   r+   rW   ÚreshapeÚrange)ÚxsÚysÚzsÚinvMrM   ÚvecrÚis          r   Úinv_transformrf   ¨   sŸ   € ô ˜˜B Ó
#€CÜ�6‰6�$˜Ó€DØ‡z�z�TÒØ�|‰|˜FÓ#ˆÜ�4—:‘:˜a‘=Ö!ˆØ�‰7�1‰:˜‹?Øša ˜d™ d¨1¡g¨a¡jÑ0ˆD’�A�ŠJð "ð �‰7�D˜‘G˜T !™WÐ$Ð$r   c                 ó€  — t         j                  j                  | «      s>t         j                  j                  |«      st         j                  j                  |«      r6t         j                  j                  | ||t        j                  | «      g«      S t        j                  | ||t        j                  | «      g«      S ©N)r   rK   rL   r   Ú	ones_like)r`   ra   rb   s      r   r]   r]   ¶   ss   € Ü	‡u�u‡z�z�"„~œŸ™Ÿ™ Bœ¬2¯5©5¯:©:°b¬>Ü�u‰u�{‰{˜B  B¬¯©°RÓ(8Ð9Ó:Ð:ä�x‰x˜˜R ¤R§\¡\°"Ó%5Ð6Ó7Ð7r   c                 ó4   — t        | ||«      }t        ||«      S )z<
    Transform the points by the projection matrix *M*.
    )r]   rR   )r`   ra   rb   r:   rM   s        r   Úproj_transformrk   ½   s   € ô ˜˜B Ó
#€CÜ˜s AÓ&Ð&r   z3.10c                 ó>   — t        | |||t        j                  ¬«      S )N)r@   )Ú_proj_transform_clipr   Úinf)r`   ra   rb   r:   s       r   Úproj_transform_clipro   Å   s   € ä  B¨¨A¼B¿F¹FÔCÐCr   c                 ó6   — t        | ||«      }t        |||«      S )zy
    Transform the points by the projection matrix
    and return the clipping result
    returns txs, tys, tzs, tis
    )r]   r[   )r`   ra   rb   r:   r@   rM   s         r   rm   rm   Ê   s!   € ô ˜˜B Ó
#€CÜ# C¨¨LÓ9Ð9r   c                 ó@   — t        j                  t        | |«      «      S rh   )r   Úcolumn_stackÚ_proj_trans_points)Úpointsr:   s     r   Ú_proj_pointsru   Ô   s   € Ü�?‰?Ô-¨f°aÓ8Ó9Ð9r   c                 ó~   — t        j                  | «      } | d d …df   | d d …df   | d d …df   }}}t        ||||«      S )Nr   r   r   )r   Ú
asanyarrayrk   )rt   r:   r`   ra   rb   s        r   rs   rs   Ø   sF   € Ü�]‰]˜6Ó"€FØš˜1˜‘˜v¢a¨ d™|¨V²A°q°D©\ˆBˆ€BÜ˜"˜b " aÓ(Ð(r   rh   )Ú__doc__Únumpyr   Ú
matplotlibr   r   r(   r2   r;   rE   rG   rR   r[   rf   r]   rk   Ú
deprecatedro   rm   ru   rs   © r   r   Ú<module>r}      s   ðñó å ð
 04ó4ò,ò"$òNò.	òò
òò*%ò8ò'ð €‡��ÓñDó ðDò:ò:ó)r   