
    h                         S r SSKrSSKJr   SS jrS rS rS rS r	S	 r
S
 rS rS rS rS r\R                   " S5      S 5       rS rS rS rg)z,
Various transforms used for by the 3D code
    N)_apic           	          X-
  nX2-
  nXT-
  n	Ub  Uu  pnXz-  nX-  nX-  n	[         R                  " SU-  SSU * U-  /SSU-  SU* U-  /SSSU	-  U* U	-  // SQ/5      $ )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                M/var/www/html/env/lib/python3.13/site-packages/mpl_toolkits/mplot3d/proj3d.pyworld_transformationr   
   s     
B	B	B



88adqQb1AbDQb1q!B$b113 4 4    c                    U [         R                  R                  U 5      -  u  p#n[         R                  " U5      n[         R                  " U5      nS[         R                  " US-  5      S-  -  n[         R
                  " Xr-  U-  U-   Xr-  U-  XE-  -
  Xr-  U-  X5-  -   /Xs-  U-  XE-  -   Xs-  U-  U-   Xs-  U-  X%-  -
  /Xt-  U-  X5-  -
  Xt-  U-  X%-  -   Xt-  U-  U-   //5      nU$ )zC
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     RYY^^A&&JBB
uA
uA	"&&q/1
A
	
b1b24b248	
b24b1b248	
b24b24b157 	8A
 Hr   c                 n   X-
  nU[         R                  R                  U5      -  n[         R                  " X$5      nU[         R                  R                  U5      -  n[         R                  " XE5      nUS:w  a8  [	        XC* 5      n[         R
                  " Xu5      n[         R
                  " Xv5      nXVU4$ )aO  
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 
A	"))..
A
A	"))..
A
A qy&q%0FF5FF57Nr   c                     [         R                  " S5      n[         R                  " S5      nXU/USS2SS24'   U* USS2S4'   [         R                  " XE5      nU$ )al  
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Brr2A2vJBrr2vJ
rAHr   c                     UnSnX-   X-
  -  nSX-  -  X-
  -  n[         R                  " USSS/SX4-  SS/SSXV// SQ/5      nU$ )Nr   r   )r   r   r6   r   r   )zfrontzbackfocal_lengtheabr%   proj_matrixs           r   _persp_transformationrE   o   sk    A	A	%A
FL6<(A((Q!aOaO!aO+- .K r   c           	      `    X-   * nX-
  * n[         R                  " / SQ/ SQ/ SQSSX#//5      nU$ )N)r   r   r   r   )r   r   r   r   )r   r   r=   r   r   r   )r>   r?   rB   rC   rD   s        r   _ortho_transformationrG   {   sB    
.A
.A((M))AM+ ,K r   c                 h   [         R                  " XR                  5      nUS   nUS   U-  US   U-  US   U-  pen[         R                  R	                  U S   5      (       a*  [         R                  R                  X@S   R                  S9n[         R                  R	                  U S   5      (       a*  [         R                  R                  XPS   R                  S9n[         R                  R	                  U S   5      (       a*  [         R                  R                  X`S   R                  S9nXEU4$ )Nr5   r   r   r   )mask)r   r+   datamaisMAr   rI   )vecr:   vecwr/   txstystzss          r   _proj_transform_vecrR      s    66!XXDQAGAItAwqy$q'!)cC	uuzz#a&eekk#FKKk0	uuzz#a&eekk#FKKk0	uuzz#a&eekk#FKKk0S=r   c                 P   [         R                  " XR                  5      nUS   nUS   U-  US   U-  US   U-  pvn[         R                  " U5      (       a$  [         R                  " UR
                  [        S9nOSU:*  US:*  -  SU:*  -  US:*  -  US:*  -  n[         R                  R                  U S   5      (       a  XS   R                  ) -  n[         R                  R                  U S   5      (       a  XS   R                  ) -  n[         R                  R                  U S   5      (       a  XS   R                  ) -  n[         R                  R                  XX) 5      n[         R                  R                  Xh) 5      n[         R                  R                  Xx) 5      nXVXx4$ )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[      sX   66!XXDQAGaKa1d1gkcC	xxggciit,SySAX&")4qASAXN	uuzz#a&V[[L 	uuzz#a&V[[L 	uuzz#a&V[[L 
%%

S$
'C
%%

S$
'C
%%

S$
'CSr   c                 0   [        XU5      n[        R                  " X45      nUR                  S:X  a  UR	                  S5      n[        UR                  S   5       H*  nUS   U   S:w  d  M  USS2U4   US   U   -  USS2U4'   M,     US   US   US   4$ )zG
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     
#C66$DzzT||F#4::a=!71:?add1gaj0DAJ " 7DGT!W$$r   c                    [         R                  R                  U 5      (       dH  [         R                  R                  U5      (       d$  [         R                  R                  U5      (       a6  [         R                  R                  XU[         R                  " U 5      /5      $ [         R                  " XU[         R                  " U 5      /5      $ N)r   rK   rL   r   	ones_like)r`   ra   rb   s      r   r]   r]      su    	uuzz"~~B255::b>>uu{{BBR(89::xxR\\"%5677r   c                 0    [        XU5      n[        XC5      $ )z4
Transform the points by the projection matrix *M*.
)r]   rR   )r`   ra   rb   r:   rM   s        r   proj_transformrk      s     
#Cs&&r   z3.10c                 4    [        XX#[        R                  S9$ )N)r@   )_proj_transform_clipr   inf)r`   ra   rb   r:   s       r   proj_transform_clipro      s    BFFCCr   c                 2    [        XU5      n[        XSU5      $ )zi
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     
#C#CL99r   c                 @    [         R                  " [        X5      5      $ rh   )r   column_stack_proj_trans_points)pointsr:   s     r   _proj_pointsru      s    ??-f899r   c                 z    [         R                  " U 5      n U S S 2S4   U S S 2S4   U S S 2S4   pCn[        X#XA5      $ )Nr   r   r   )r   
asanyarrayrk   )rt   r:   r`   ra   rb   s        r   rs   rs      s@    ]]6"F1vad|VAqD\BB""((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   