+
     ]i/  c                   s    ^ RI t^ RIHtHt ^ RIHtHt R t	 ! R R4      t
 ! R R]4      t ! R	 R
4      t ! R R]P                  4      t ! R R4      t ! R R4      t ! R R4      tR# )i    N)ticker_api)Bbox	Transformc                s   . pV R,          V RR ,
          p\        R4      \        RRR4      3 EFO  pV P                  V,          w  rVVP                  V,          w  rxVP                  V,          w  rVP                  V,          w  rWV	8  3WV8  33 F  w  r. pVRR VR,          ,          P	                  4       w  pV F  pVV,          WV,          ,
          VV,          ,          VV,          ,          ,           pV
Tu;8:  d   V8:  g   M KO  VV3V,          p\
        P                  ! \
        P                  ! VV,          RRR1,          !  4      pVP                  VV34       K  	  VP                  V4       K  	  EKR  	  V# )a  
Find the points where a polyline crosses a bbox, and the crossing angles.

Parameters
----------
xys : (N, 2) array
    The polyline coordinates.
bbox : `.Bbox`
    The bounding box.

Returns
-------
list of ((float, float), float)
    Four separate lists of crossings, for the left, right, bottom, and top
    sides of the bbox, respectively.  For each list, the entries are the
    ``((x, y), ccw_angle_in_degrees)`` of the crossing, where an angle of 0
    means that the polyline is moving to the right at the crossing point.

    The entries are computed by linearly interpolating at each crossing
    between the nearest points on either side of the bbox edges.
:   NNNi)	ZsliceTminmaxZnonzeronpZdegreesZarctan2append)ZxysZbbox	crossingsZdxysZslZusZvsZdusZdvsZuminZvminZumaxZvmaxZu0ZinsideZcrossZidxsidxvcrossingZthetas   &&                   J/usr/lib64/python3.14/site-packages/mpl_toolkits/axisartist/grid_finder.py_find_line_box_crossingsr      sR   , Ir7S"XDT{E$b12r66":XXb\
XXb\
 t),t$Y.?@JBECR[6":-668EDsGrsG|s3x7#c(BBq(D(72;

2::tCy2#?@h./  U# A 3      c                   s6   a  ] tR t^2t o RtR tR tR tRtV t	R# )ExtremeFinderSimplezM
A helper class to figure out the range of grid lines that need to be drawn.
c                s    Wn         W n        R# )zQ
Parameters
----------
nx, ny : int
    The number of samples in each direction.
Nnxny)selfr   r      &&&r   __init__ZExtremeFinderSimple.__init__7   s     r   c                s   \         P                  ! \         P                  ! W$V P                  4      \         P                  ! W5V P                  4      4      w  rgV! \         P
                  ! V4      \         P
                  ! V4      4      w  rV P                  VP                  4       VP                  4       V	P                  4       V	P                  4       4      # )a  
Compute an approximation of the bounding box obtained by applying
*transform_xy* to the box delimited by ``(x1, y1, x2, y2)``.

The intended use is to have ``(x1, y1, x2, y2)`` in axes coordinates,
and have *transform_xy* be the transform from axes coordinates to data
coordinates; this method then returns the range of data coordinates
that span the actual axes.

The computation is done by sampling ``nx * ny`` equispaced points in
the ``(x1, y1, x2, y2)`` box and finding the resulting points with
extremal coordinates; then adding some padding to take into account the
finite sampling.

As each sampling step covers a relative range of *1/nx* or *1/ny*,
the padding is computed by expanding the span covered by the extremal
coordinates by these fractions.
)	r   Zmeshgridlinspacer   r   Zravel_add_padr   r   )
r   transform_xyx1y1x2y2xyZxtZyts
   &&&&&&    r   __call__ZExtremeFinderSimple.__call__A   s    & {{KK("++bdgg*FHbhhqk288A;7}}RVVXrvvx2668DDr   c                s    W!,
          V P                   ,          pWC,
          V P                  ,          pW,
          W%,           W6,
          WF,           3# )z,Perform the padding mentioned in `__call__`.r   )r   Zx_minZx_maxZy_minZy_maxZdxZdys   &&&&&  r   r   ZExtremeFinderSimple._add_padY   s9    mtww&mtww&z5:uz5:==r   r   N)
__name__
__module____qualname____firstlineno____doc__r   r!   r   __static_attributes____classdictcell____classdict__   @r   r   r   2   s     E0> >r   r   c                   sJ   a a ] tR t^`t oRt^;ttV 3R ltR tR t	Rt
VtV ;t# )_User2DTransformz.A transform defined by two user-set functions.c                <   < \         SV `  4        Wn        W n        R# )z
Parameters
----------
forward, backward : callable
    The forward and backward transforms, taking ``x`` and ``y`` as
    separate arguments and returning ``(tr_x, tr_y)``.
N)superr   _forward	_backward)r   ZforwardZbackward	__class__   &&&r   r   Z_User2DTransform.__init__e   s     	!r   c                sr    \         P                  ! V P                  ! \         P                  ! V4      !  4      # N)r   Z	transposer/   )r   values   &&r   transform_non_affineZ%_User2DTransform.transform_non_affines   s#    ||DMM2<<+?@AAr   c                sN    \        V 4      ! V P                  V P                  4      # r3   )Ztyper0   r/   r      &r   invertedZ_User2DTransform.invertedw   s    Dz$..$--88r   )r0   r/   )r"   r#   r$   r%   r&   Z
input_dimsZoutput_dimsr   r6   r9   r'   r(   __classcell__r1   r*      @@r   r,   r,   `   s'     8  J"B9 9r   r,   c                   sb   a  ] tR t^|t o RtRR ltR tR tR tR t	R t
]	tR	 tR
 tR tRtV tR# )
GridFinderz
Internal helper for `~.grid_helper_curvelinear.GridHelperCurveLinear`, with
the same constructor parameters; should not be directly instantiated.
Nc                s    Vf   \        ^^4      pVf   \        4       pVf   \        4       pVf   \        4       pVf   \        4       pW n        W0n        W@n        WPn        W`n        V P                  V4       R # r3   )	r   MaxNLocatorFormatterPrettyPrintextreme_findergrid_locator1grid_locator2tick_formatter1tick_formatter2set_transform)r   	transformr@   rA   rB   rC   rD   s   &&&&&&&r   r   ZGridFinder.__init__   sx     !0R8N 'MM 'MM"24O"24O,**..9%r   c                s    \         P                  ! ^V P                  ^V P                  /VR7      p\	        V\
        P                  4      '       d   VP                  V4      # V! W#V4      # )ai  
Helper to support both standard formatters (inheriting from
`.mticker.Formatter`) and axisartist-specific ones; should be called instead of
directly calling ``self.tick_formatter1`` and ``self.tick_formatter2``.  This
method should be considered as a temporary workaround which will be removed in
the future at the same time as axisartist-specific formatters.
)r   )r   Zcheck_getitemrC   rD   
isinstancemtickerZ	Formatterformat_ticks)r   r   	directionfactorZlevelsZfmts   &&&&& r   _format_ticksZGridFinder._format_ticks   sc       $$a)=)=>CI,6sG<M<M,N,N  ( 	5F3	5r   c                s&   V P                  V P                  WW44      pVw  rgrV P                  Wg4      w  rp\        P                  ! V
4      p
V P                  W4      w  rp\        P                  ! V4      pV
RV V,          pVRV V,          pV P                  VVWgW4      w  pp\        P                  ! WW44      P                  RR4      pRV/p^RWVV3^RWVV33 EF#  w  ppppppRV Uu. uF  pV.NK  	  upRR. R. R	. R
. //;VV&   p\        VVV4       Fp  w  w  ppp p!\        \        P                  ! VV.4      V4      p"\        . ROV"4       F2  w  p#p$V$ F&  p%VR,          V#,          P                  RV!RV%/4       K(  	  K4  	  Kr  	  VR,           Ff  p#VR,          V#,           U&u. uF  p&V&R,          NK  	  pp&V P                  VV#VV4      p'\        VR,          V#,          V'4       F  w  p&p(V(V&R&   K  	  Kh  	  EK&  	  V# u upi u up&i )z
lon_values, lat_values : list of grid values. if integer is given,
                   rough number of grids in each direction.
NextremeslonlatlinesZticksleftrightbottomtoplevelZloclabelgp   ?)rQ   rR   rS   rT   )r@   inv_transform_xyrA   r   ZasarrayrB   _get_raw_grid_linesr   Zfrom_extentsZexpandedzipr   column_stackr	   rL   ))r   r   r   r   r   rM   lon_minlon_maxlat_minlat_maxZlon_levsZlon_nZ
lon_factorZlat_levsZlat_nZ
lat_factor
lon_values
lat_values	lon_lines	lat_linesZbbZ	grid_infor   Z
lon_or_latZlevsrK   r4   rP   lZgiZlxZlyr   rU   Zall_crossingsZsider
   r   ZtickZlabelsrV   s)   &&&&&                                    r   get_grid_infoZGridFinder.get_grid_info   s`    &&t'<'<bbM
 .6*'&*&8&8&J#::h'&*&8&8&J#::h'fu%
2
fu%
2
#77
8B8?8? J	9
 rr.77	9M 
	 E8YGE8YG=
8CT665
 u-u!1#u-&"gr8RK* Ij!B '*%&>"R!U 8"b9RTV W'*:M(KOD)$-7D)00'5%1RS %.(K '? 724W+d2CD2C$W2CD++CvtD#&r'{4'8&#AKD%$)DM $B $=
(  . Es   /H	-Hc           
     sL   \         P                  ! W4^d4      p\         P                  ! WV^d4      pV U	u. uF)  p	V P                  \         P                  ! W4      V4      NK+  	  p
p	V Uu. uF)  pV P                  V\         P                  ! W{4      4      NK+  	  ppW3# u up	i u upi )id   )r   r   r   Z	full_like)r   r_   r`   r[   r\   r]   r^   Zlons_iZlats_irN   ra   rO   rb   s   &&&&&&&      r   rX   ZGridFinder._get_raw_grid_lines   s     Ws3Ws3 !+, * &&r||F'@&I * 	 , !+, * &&vr||F/HI * 	 , ##,,s   /B(/B!c                s    \        V\        4      '       d	   Wn        R# \        V4      ^8X  d0   \	        \        \        V4      4      '       d   \        V!  V n        R# \        R4      h)i   zF'aux_trans' must be either a Transform instance or a pair of callablesN)	rG   r   _aux_transformlenZallZmapZcallabler,   Z	TypeError)r   Z	aux_transr5   r   rE   ZGridFinder.set_transform   sQ    i++"+^q SXy)A%B%B"2I">D > ? ?r   c                s    V P                   # r3   )re   r7   r8   r   get_transformZGridFinder.get_transform   s    """r   c                sv    V P                   P                  \        P                  ! W.4      4      P                  # r3   )re   rF   r   rZ   r   r   r   r    r   r   r   ZGridFinder.transform_xy   s*    "",,R__aV-DEGGGr   c                s    V P                   P                  4       P                  \        P                  ! W.4      4      P
                  # r3   )re   r9   rF   r   rZ   r   rh   r   r   rW   ZGridFinder.inv_transform_xy   s7    ""++-77OOQF#%%&Q	'r   c                s|    VP                  4        F'  w  r#VR9   d   \        WV4       K  \        RV: 24      h	  R# )r@   zUnknown update property N)r@   rA   rB   rC   rD   )ZitemsZsetattrZ
ValueError)r   Zkwargskr   s   &,  r   updateZGridFinder.update   s@    LLNDA ( (
 # #;A5!ABB #r   )re   r@   rA   rB   rC   rD   )NNNNN)r"   r#   r$   r%   r&   r   rL   rd   rX   rE   rg   Zupdate_transformr   rW   rj   r'   r(   r)   r+   r   r=   r=   |   sH     
&054l$?# %H'	C 	Cr   r=   c                   sB   a a ] tR tRt oRV 3R lltV 3R ltRtVtV ;t# )r>   i  c                sL   < \         SV `  WVWVR 7       V P                  4        R# ))stepsinteger	symmetricpruneN)r.   r   create_dummy_axis)r   Znbinsrk   Ztrimrl   rm   rn   r1   s   &&&&&&&r   r   ZMaxNLocator.__init__  s*     	W#, 	 	; r   c                sf   < \         SV `  W4      p\        P                  ! V4      \	        V4      ^3# r   )r.   Ztick_valuesr   arrayrf   )r   v1v2locsr1   s   &&& r   r!   ZMaxNLocator.__call__  s+    w"2*xx~s4y!++r    )i
   NTFFN	r"   r#   r$   r%   r   r!   r'   r(   r:   r;   r<   r   r>   r>     s     !, ,r   r>   c                   s,   a  ] tR tRt o R tR tRtV tR# )FixedLocatori  c                s    Wn         R # r3   _locs)r   rt   r5   r   r   ZFixedLocator.__init__  s    
r   c                s    \        W.4      w  r\        P                  ! V P                   Uu. uF  q1Tu;8:  d
   V8:  g   K  M K  VNK  	  up4      pV\	        V4      ^3# u upi rp   )Zsortedr   rq   ry   rf   )r   rr   rs   rc   rt   s   &&&  r   r!   ZFixedLocator.__call__   sT    !xxDJJ@Jq-R--J@ASY!! As   A!A!A!rx   Nr"   r#   r$   r%   r   r!   r'   r(   r)   r+   r   rw   rw     s     " "r   rw   c                   s0   a  ] tR tRt o RR ltR tRtV tR# )r?   i(  c                st    \         P                  ! VR R7      V n        V P                  P                  4        R# )F)useMathTextZ	useOffsetN)rH   ZScalarFormatter_fmtro   )r   r{   r5   r   r   ZFormatterPrettyPrint.__init__)  s)    ++#u6			##%r   c                s8    V P                   P                  V4      # r3   )r|   rI   )r   rJ   rK   r4   s   &&&&r   r!   ZFormatterPrettyPrint.__call__.  s    yy%%f--r   )r|   N)Trz   r)   r+   r   r?   r?   (  s     &
. .r   r?   c                   s<   a a ] tR tRt oRV 3R lltR tRtVtV ;t# )DictFormatteri2  c                r-   )zY
format_dict : dictionary for format strings to be used.
formatter : fall-back formatter
N)r.   r   _format_dict_fallback_formatter)r   Zformat_dictZ	formatterr1   r2   r   r   ZDictFormatter.__init__3  s    
 	'#, r   c                s    V P                   '       d   V P                  WV4      pMR.\        V4      ,          p\        W44       UUu. uF   w  rVV P                  P	                  WV4      NK"  	  upp# u uppi )z7
factor is ignored if value is found in the dictionary
Z )r   rf   rY   r~   Zget)r   rJ   rK   r4   Zfallback_stringsri   r   s   &&&&   r   r!   ZDictFormatter.__call__<  sv     ####776 + !#tc&k19;9DA !!%%a+9; 	; ;s   &A1)r   r~   r3   rv   r;   r<   r   r}   r}   2  s     -
; 
;r   r}   )Znumpyr   Z
matplotlibr    rH   r   Zmatplotlib.transformsr   r   r   r   r,   r=   r>   rw   r?   r}   ru   r   r   <module>r      sj     . 1(V+> +>\9y 98MC MC`,'%% , " ". .; ;r   