§
    ÷Ž’j[   ã                   ó´   — 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d„ Zd„ Z ej        d¦  «        d„ ¦   «         Zd„ Zd„ Zd„ ZdS )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.
    Né   r   )r   r   r   r   ©ÚnpÚarray)ÚxminÚxmaxÚyminÚymaxÚzminÚzmaxÚ	pb_aspectÚdxÚdyÚdzÚaxÚayÚazs                úIC:\Projects\DSCons\.venv\Lib\site-packages\mpl_toolkits\mplot3d\proj3d.pyÚworld_transformationr   
   s®   € ð 
�‰€BØ	�‰€BØ	�‰€BØÐØ‰
ˆˆB�Ø
ˆb‰ˆØ
ˆb‰ˆØ
ˆb‰ˆåŒ8�a˜‘d˜q Q¨¨¨b©Ð1Ø˜A˜b™D Q¨¨¨b©Ð1Ø˜q ! B¡$¨¨¨b©Ð1Ø1Ð1Ð1ð3ñ 4ô 4ð 4ó    c                 óâ  — | t           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—^’^ 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ô 	8€Að
 €Hr   c                 ót  — | |z
  }|t           j                             |¦  «        z  }t          j        ||¦  «        }|t           j                             |¦  «        z  }t          j        ||¦  «        }|dk    r;t	          || ¦  «        }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€yå& q¨4¨%Ñ0Ô0ˆÝŒF�5˜!ÑÔˆÝŒ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   s~   € Ø€AØ	€AØ	�‰˜˜u™Ñ%€AØ
ˆF�5‰LÑ˜6 %™<Ñ(€AÝ”(˜Q ! a¨˜OØ  !¡ a¨˜OØ ! a¨˜OØ+˜O˜Oð-ñ .ô .€Kð Ðr   c           	      ób   — | |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   {   sW   € à
�5‰.Ð€AØ
�5‰.Ð€AÝ”(˜M˜M˜MØ)˜M˜MØ)˜M˜MØ  A q˜Mð+ñ ,ô ,€Kð Ðr   c                 ó.  — d„ } || |j         ¦  «        } |||j        ¦  «        } |||j        ¦  «        }d„ | ||fD ¦   «         }t          d„ |D ¦   «         ¦  «        r³t          j                             t          j                             |d         |d         ¦  «        |d         ¦  «        }	t          j                             ||	¬¦  «        }t          j                             ||	¬¦  «        }t          j                             ||	¬¦  «        }|||fS )zÁ
    Apply axis scale transforms to 3D coordinates.

    Transforms data coordinates to transformed coordinates (applying log,
    symlog, etc.) for 3D projection. Preserves masked arrays.
    c                 ó
  — t          j        | ¦  «        } t           j                             | ¦  «                             ¦   «         }|                     ¦   «                              |¦  «                             | j        ¦  «        S ©N)	r   Ú
asanyarrayÚmaÚgetdataÚravelÚget_transformÚ	transformÚreshapeÚshape)ÚcoordÚaxisÚdatas      r   Útransform_coordz0_apply_scale_transforms.<locals>.transform_coord�   s`   € Ý”˜eÑ$Ô$ˆÝŒu�}Š}˜UÑ#Ô#×)Ò)Ñ+Ô+ˆØ×!Ò!Ñ#Ô#×-Ò-¨dÑ3Ô3×;Ò;¸E¼KÑHÔHÐHr   c                 óL   — g | ]!}t           j                             |¦  «        ‘Œ"S © )r   rL   Úgetmask)Ú.0rB   s     r   ú
<listcomp>z+_apply_scale_transforms.<locals>.<listcomp>—   s&   € Ð4Ð4Ð4 !�RŒU�]Š]˜1ÑÔÐ4Ð4Ð4r   c              3   ó<   K  — | ]}|t           j        j        uV — Œd S rJ   )r   rL   Únomask)rZ   Úms     r   ú	<genexpr>z*_apply_scale_transforms.<locals>.<genexpr>˜   s+   è è € Ð
0Ð
0 Qˆ1•B”E”LÐ Ð
0Ð
0Ð
0Ð
0Ð
0Ð
0r   r   r   r   ©Úmask)ÚxaxisÚyaxisÚzaxisÚanyr   rL   Úmask_orr   )
ÚxsÚysÚzsÚaxesrV   Ú	xs_scaledÚ	ys_scaledÚ	zs_scaledÚmasksÚcombineds
             r   Ú_apply_scale_transformsrp   †   s  € ðIð Ið Ið
  �  D¤JÑ/Ô/€IØ�  D¤JÑ/Ô/€IØ�  D¤JÑ/Ô/€Ið 5Ð4¨¨B° |Ð4Ñ4Ô4€EÝ
Ð
0Ð
0¨%Ð
0Ñ
0Ô
0Ñ0Ô0ð :Ý”5—=’=¥¤§¢¨u°Q¬x¸¸q¼Ñ!BÔ!BÀEÈ!ÄHÑMÔMˆÝ”E—K’K 	°�KÑ9Ô9ˆ	Ý”E—K’K 	°�KÑ9Ô9ˆ	Ý”E—K’K 	°�KÑ9Ô9ˆ	à�i Ð*Ð*r   c                 ó  — t          j        || j        ¦  «        }|dd…         |d         z  }t           j                             | ¦  «        r&t           j                             || j        ¬¦  «        }|d         |d         |d         fS )Nr   r5   r`   r   r   )r   r+   rU   rL   ÚisMAr   ra   )Úvecr:   ÚvecwÚtss       r   Ú_proj_transform_vecrv   ¡   sq   € ÝŒ6�!�S”XÑÔ€DØ	ˆa�ˆcŒ�4˜”7Ñ	€BÝ	„u‡z‚z�#�„ð ,ÝŒU�[Š[˜ #¤(ˆ[Ñ+Ô+ˆØˆaŒ5�"�Q”%˜˜AœÐÐr   c                 ó|  — | j         }t          | d         | d         | d         |¦  «        \  }}}t          |                     ¦   «         |                     ¦   «         |                     ¦   «         ¦  «        }t	          j        |j        |¦  «        }|dd…         |d         z  }|j                             |¦  «        S )zâ
    Apply scale transforms and project vectors.

    Parameters
    ----------
    vecs : ... x 3 np.ndarray
        Input vectors.
    axes : Axes3D
        The 3D axes (used for scale transforms and projection matrix).
    ).r   ).r   ).r   Nr5   )	rR   rp   Ú_vec_pad_onesrN   r   r+   r:   ÚTrQ   )	Úvecsrj   Úresult_shaperg   rh   ri   rs   ÚproductÚtvecss	            r   Ú_scale_proj_transform_vectorsr~   ©   s›   € ð ”:€LÝ(ØˆVŒ�d˜6”l D¨¤L°$ñ8ô 8�J€BˆˆBå
˜Ÿš™
œ
 B§H¢H¡J¤J°·²±
´
Ñ
;Ô
;€CÝŒf�T”V˜SÑ!Ô!€GØ�B�Q�BŒK˜' !œ*Ñ$€EØŒ7�?Š?˜<Ñ(Ô(Ð(r   c                 ó(  — t          j        || j        ¦  «        }|dd…         |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                             | d         ¦  «        r|| d         j	         z  }t           j                             | d         ¦  «        r|| d         j	         z  }t           j                             | d         ¦  «        r|| d         j	         z  }t           j         
                    || ¦  «        }t           j         
                    || ¦  «        }t           j         
                    || ¦  «        }||||fS )Nr   r5   )Údtyper6   r   r   )r   r+   rU   ÚisinfÚonesrR   ÚboolrL   rr   ra   Úmasked_array)rs   r:   r@   rt   ÚtxsÚtysÚtzsÚtiss           r   Ú_proj_transform_vec_clipr‰   ½   sg  € ÝŒ6�!�S”XÑÔ€DØ˜˜1˜”I  Q¤Ñ'�M€CˆˆcÝ	„x�ÑÔð OÝŒg�c”i¥tÐ,Ñ,Ô,ˆˆà�SŠy˜S AšXÑ&¨"°ª)Ñ4¸¸qºÑAÀSÈAÂXÑNˆÝ	„u‡z‚z�#�a”&ÑÔð !Ø�S˜”V”[�LÑ ˆÝ	„u‡z‚z�#�a”&ÑÔð !Ø�S˜”V”[�LÑ ˆÝ	„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|                     d¦  «        }t          |j        d         ¦  «        D ]6}|d         |         dk    r"|dd…|f         |d         |         z  |dd…|f<   Œ7|d         |d         |d         fS )zO
    Transform the points by the inverse of the projection matrix, *invM*.
    )r4   )r4   r   r   r5   r   Nr   )rx   r   r+   rR   rQ   Úrange)rg   rh   ri   ÚinvMrs   ÚvecrÚis          r   Úinv_transformr�   Ñ   s¶   € õ ˜˜B Ñ
#Ô
#€CÝŒ6�$˜ÑÔ€DØ„z�TÒÐØ�|Š|˜FÑ#Ô#ˆÝ�4”:˜a”=Ñ!Ô!ð 1ð 1ˆØ�Œ7�1Œ:˜Š?ˆ?Ø˜a˜a˜a ˜dœ d¨1¤g¨a¤jÑ0ˆD����A�‰JøØ�Œ7�D˜”G˜T !œWÐ$Ð$r   c                 óz  — t           j                             | ¦  «        s>t           j                             |¦  «        st           j                             |¦  «        r5t           j                             | ||t          j        | ¦  «        g¦  «        S t          j        | ||t          j        | ¦  «        g¦  «        S rJ   )r   rL   rr   r   Ú	ones_like)rg   rh   ri   s      r   rx   rx   ß   s†   € Ý	„u‡z‚z�"�~„~ð 8�œŸš B™œð 8­2¬5¯:ª:°b©>¬>ð 8ÝŒu�{Š{˜B  B­¬°RÑ(8Ô(8Ð9Ñ:Ô:Ð:åŒx˜˜R ¥R¤\°"Ñ%5Ô%5Ð6Ñ7Ô7Ð7r   c                 óD   — t          | ||¦  «        }t          ||¦  «        S )z<
    Transform the points by the projection matrix *M*.
    )rx   rv   ©rg   rh   ri   r:   rs   s        r   Úproj_transformr”   æ   s%   € õ ˜˜B Ñ
#Ô
#€CÝ˜s AÑ&Ô&Ð&r   z3.10c                 ó\   — t          | ||¦  «        }t          ||t          j        ¬¦  «        S )N)r@   )rx   r‰   r   Úinfr“   s        r   Úproj_transform_clipr—   î   s*   € å
˜˜B Ñ
#Ô
#€CÝ# C¨½¼Ð@Ñ@Ô@Ð@r   c                 ó†   — t          | |||¦  «        \  } }}t          | ||¦  «        }t          ||j        |j        ¦  «        S )zg
    Apply scale transforms, project, and return clipping result.

    Returns txs, tys, tzs, tis.
    )rp   rx   r‰   r:   Ú_focal_length)rg   rh   ri   rj   rs   s        r   Ú_scale_proj_transform_cliprš   ô   sE   € õ )¨¨R°°TÑ:Ô:�J€BˆˆBÝ
˜˜B Ñ
#Ô
#€CÝ# C¨¬°Ô1CÑDÔDÐDr   c                 ó–   — t          j        | ¦  «        } | d d …df         | d d …df         | d d …df         }}}t          ||||¦  «        S )Nr   r   r   )r   rK   r”   )Úpointsr:   rg   rh   ri   s        r   Ú_proj_trans_pointsr�   ÿ   sV   € ÝŒ]˜6Ñ"Ô"€FØ˜˜˜˜1˜”˜v a a a¨ dœ|¨V°A°A°A°q°D¬\ˆBˆ€BÝ˜"˜b " aÑ(Ô(Ð(r   c                 ó\   — t          | |||¦  «        \  } }}t          | |||j        ¦  «        S )z™
    Apply scale transforms and project.

    Combines `_apply_scale_transforms` and `proj_transform` into a single
    call. Returns txs, tys, tzs.
    )rp   r”   r:   )rg   rh   ri   rj   s       r   Ú_scale_proj_transformrŸ     s3   € õ )¨¨R°°TÑ:Ô:�J€BˆˆBÝ˜"˜b " d¤fÑ-Ô-Ð-r   rJ   )Ú__doc__Únumpyr   Ú
matplotlibr   r   r(   r2   r;   rE   rG   rp   rv   r~   r‰   r�   rx   r”   Ú
deprecatedr—   rš   r�   rŸ   rX   r   r   ú<module>r¤      sb  ððð ð Ð Ð Ð à Ð Ð Ð Ð Ð ð
 04ð4ð 4ð 4ð 4ð,ð ð ð"$ð $ð $ðNð ð ð.	ð 	ð 	ðð ð ð+ð +ð +ð6ð ð ð)ð )ð )ð(ð ð ð(%ð %ð %ð8ð 8ð 8ð'ð 'ð 'ð €„�ÑÔðAð Añ ÔðAð
Eð Eð Eð)ð )ð )ð.ð .ð .ð .ð .r   