
    h{                    X   S r SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	J
r
  SSKJr  SSKJrJrJr  SSKJr  SrS	 r " S
 S5      r " S S\5      r\R.                  " \R0                  \R0                  /5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r  " S S\ 5      r! " S S\ 5      r" " S  S!5      r# " S" S#\#\5      r$ " S$ S%\#\ 5      r%S& r& " S' S(\5      r' " S) S*\ 5      r(S+ r) " S, S-\ 5      r* " S. S/\ 5      r+\RX                  " S05       " S1 S2\+5      5       r- " S3 S4\ 5      r. " S5 S6\ 5      r/ " S7 S8\ 5      r0 " S9 S:\ 5      r1 " S; S<\5      r2 " S= S>\25      r3SDS? jr4S@ r5SESA jr6SB r7SFSC jr8g)GaT  
Matplotlib includes a framework for arbitrary geometric transformations that is used to
determine the final position of all elements drawn on the canvas.

Transforms are composed into trees of `TransformNode` objects
whose actual value depends on their children.  When the contents of
children change, their parents are automatically invalidated.  The
next time an invalidated transform is accessed, it is recomputed to
reflect those changes.  This invalidation/caching approach prevents
unnecessary recomputations of transforms, and contributes to better
interactive performance.

For example, here is a graph of the transform tree used to plot data to the figure:

.. graphviz:: /api/transforms.dot
    :alt: Diagram of transform tree from data to figure coordinates.

The framework can be used for both affine and non-affine
transformations.  However, for speed, we want to use the backend
renderers to perform affine transformations whenever possible.
Therefore, it is possible to perform just the affine or non-affine
part of a transformation on a set of data.  The affine is always
assumed to occur after the non-affine.  For any transform::

  full transform == non-affine part + affine part

The backends are not expected to handle non-affine transformations
themselves.

See the tutorial :ref:`transforms_tutorial` for examples
of how to use transforms.
    N)inv)_api)affine_transformcount_bboxes_overlapping_bboxupdate_path_extents   )PathFc                  h   ^ ^^^ [         R                  " [        R                  SS9mS mU UUU4S j$ )a  
Generate a ``__str__`` method for a `.Transform` subclass.

After ::

    class T:
        __str__ = _make_str_method("attr", key="other")

``str(T(...))`` will be

.. code-block:: text

    {type(T).__name__}(
        {self.attr},
        key={self.other})
z    )prefixc                 X    [        U [        5      (       a  [        U 5      $ [        U 5      $ N)
isinstancestrrepr)xs    G/var/www/html/env/lib/python3.13/site-packages/matplotlib/transforms.pystrrepr!_make_str_method.<locals>.strreprJ   s     jC&8&847Dc!fD    c                    >^  [        T 5      R                  S-   SR                  / UU U4S jT 5       QUU U4S jTR                  5        5       Q5      -   S-   $ )N(,c           
   3   Z   >#    U  H   nT" S T" [        TU5      5      -   5      v   M"     g7f)
Ngetattr).0argindentselfr   s     r   	<genexpr>5_make_str_method.<locals>.<lambda>.<locals>.<genexpr>M   s1      '!%# TGGD#,>$??@@!%s   (+c           
   3   j   >#    U  H(  u  pT" S U-   S-   T" [        TU5      5      -   5      v   M*     g7f)r   =Nr   )r   kr   r   r    r   s      r   r!   r"   O   s;      4$2&! TAX^ggdC6H.IIJJ$2s   03))type__name__joinitems)r    argsr   kwargsr   s   `r   <lambda>"_make_str_method.<locals>.<lambda>K   s_    T
c!
(( 5 '!%' 54$*LLN45 6	6
 	r   )	functoolspartialtextwrapr   )r+   r,   r   r   s   ``@@r   _make_str_methodr2   8   s(    " xw?FD r   c                      ^  \ rS rSrSr\" S5      u  rrrSr	\
R                  " S5      " \
R                  " S 5      5      rSr SS jr\(       a  S rS	 rS
 rU 4S jrS rS rS rS rSrU =r$ )TransformNodeT   a  
The base class for anything that participates in the transform tree
and needs to invalidate its parents or be invalidated.  This includes
classes that are not really transforms, such as bounding boxes, since some
transforms depend on bounding boxes to compute their values.
   F3.9c                     gNF clss    r   r-   TransformNode.<lambda>f   s    Er   c                 T    0 U l         U R                  U l        U=(       d    SU l        g)z
Parameters
----------
shorthand_name : str
    A string representing the "name" of the transform. The name carries
    no significance other than to improve the readability of
    ``str(transform)`` when DEBUG=True.
 N)_parents_INVALID_FULL_invalid_shorthand_name)r    shorthand_names     r   __init__TransformNode.__init__n   s%     **-3r   c                 >    U R                   =(       d    [        U 5      $ r   )rC   r   r    s    r   __str__TransformNode.__str__}   s    ''54:5r   c           	          0 U R                   ESU R                  R                  5        VVs0 s H  u  pX" 5       _M     snn0E$ s  snnf )Nr@   )__dict__r@   r*   )r    r%   vs      r   __getstate__TransformNode.__getstate__   sN    H$-- H0C0C0EF0EQV0EFH 	HFs   A
c           
          Xl         U R                  R                  5        VVs0 s H:  u  p#Uc  M
  U[        R                  " X0R                  R
                  U4S j5      _M<     snnU l        g s  snnf )Nc                     U" U5      $ r   r:   _popr%   s      r   r-   ,TransformNode.__setstate__.<locals>.<lambda>   s    CFr   )rL   r@   r*   weakrefrefrT   )r    	data_dictr%   rM   s       r   __setstate__TransformNode.__setstate__   sa    ! ++-@- LAw{{1MM,=,=JKK-@ @s
   	A/4A/c                   > [         R                   " [        5       5      n0 Ul        [        U 5      R	                  5        HH  u  p#[        U[        5      (       d  M  [        U 5      UR                  ;   d  M7  UR                  U5        MJ     U$ r   )	copysuperr@   varsr*   r   r4   idset_children)r    otherkeyval	__class__s       r   __copy__TransformNode.__copy__   sh    		%'"  T
((*HC#}--"T(cll2J""3' + r   c                 v    U R                  U R                  (       a  U R                  U S9$ U R                  U S9$ )z
Invalidate this `TransformNode` and triggers an invalidation of its
ancestors.  Should be called any time the transform changes.
levelinvalidating_node)_invalidate_internal	is_affine_INVALID_AFFINE_ONLYrA   rH   s    r   
invalidateTransformNode.invalidate   sI    
 ((/3~~$++" ) $ 	$CGCUCU" ) $ 	$r   c                     XR                   ::  a  U R                  (       d  gXl         [        U R                  R	                  5       5       H  nU" 5       nUc  M  UR                  XS9  M      g)z
Called by :meth:`invalidate` and subsequently ascends the transform
stack calling each TransformNode's _invalidate_internal method.
Nrh   )rB   pass_throughlistr@   valuesrk   )r    ri   rj   parents       r   rk   "TransformNode._invalidate_internal   sX     MM!$*;*;4==//12FXF!++%+P 3r   c                     [        U 5      nU H@  n[        R                  " XR                  R                  U4S j5      nXCR                  U'   MB     g)z
Set the children of the transform, to let the invalidation
system know which transforms can invalidate this transform.
Should be called from the constructor of any transforms that
depend on other transforms.
c                     U" U5      $ r   r:   rR   s      r   r-   ,TransformNode.set_children.<locals>.<lambda>   s    3q6r   N)r_   rV   rW   r@   rT   )r    childrenid_selfchildrW   s        r   r`   TransformNode.set_children   sF     T(E ++NN$6$6'IKC&)NN7# r   c                     U $ )z
Return a frozen copy of this transform node.  The frozen copy will not
be updated when its children change.  Useful for storing a previously
known state of a transform where ``copy.deepcopy()`` might normally be
used.
r:   rH   s    r   frozenTransformNode.frozen   s	     r   )rL   rB   r@   rC   r   )r(   
__module____qualname____firstlineno____doc__range_VALIDrm   rA   rl   r   
deprecatedclasspropertyis_bboxrq   rE   DEBUGrI   rN   rY   re   rn   rk   r`   r~   __static_attributes____classcell__rd   s   @r   r4   r4   T   s     38(/F - Iooe$T%7%78I%JKGL
4 	6H
@
$Q*& r   r4   c            
          \ rS rSrSr\R                  " S5      " \R                  " S 5      5      rSr	\
(       a  \S 5       rS r\R                  \l        S r\S	 5       r\S
 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r \S 5       r!\S 5       r"\S 5       r#S r$S r%S r&S r'S  r(S! r)S" r*S# r+S$ r,S% r-S&S'S(S)S*S+S,S-S.S/.	r.S0 r/S1 r0S@S3 jr1S4 r2S5 r3S6 r4S7 r5S8 r6SAS9 jr7S: r8S; r9S< r:\S= 5       r;\S> 5       r<S?r=g2)BBboxBase   aD  
The base class of all bounding boxes.

This class is immutable; `Bbox` is a mutable subclass.

The canonical representation is as two points, with no
restrictions on their ordering.  Convenience properties are
provided to get the left, bottom, right and top edges and width
and height, but these are not stored explicitly.
r7   c                     g)NTr:   r;   s    r   r-   BboxBase.<lambda>   s    Dr   Tc                 $   [        U [        R                  R                  5      (       a  [        R
                  " S5        [        R                  " U 5      n [        U SS S 24   U SS S 24   -
  S:H  5      (       a  [        R
                  " S5        g g )NzBbox bounds are a masked array.r   r   zSingular Bbox.)r   npmaMaskedArrayr   warn_externalasarrayany)pointss    r   _checkBboxBase._check   so    &"%%"3"344""#DEZZ'FF1a4L6!Q$</A566""#34 7r   c                 P    [        U R                  5       R                  5       5      $ r   )Bbox
get_pointsr\   rH   s    r   r~   BboxBase.frozen   s    DOO%**,--r   c                 "    U R                  5       $ r   r   r    r+   r,   s      r   	__array__BboxBase.__array__   s      r   c                 (    U R                  5       S   $ )z
The first of the pair of *x* coordinates that define the bounding box.

This is not guaranteed to be less than :attr:`x1` (for that, use
:attr:`xmin`).
r   r   r   rH   s    r   x0BboxBase.x0         &&r   c                 (    U R                  5       S   $ )z
The first of the pair of *y* coordinates that define the bounding box.

This is not guaranteed to be less than :attr:`y1` (for that, use
:attr:`ymin`).
r   r   r   rH   s    r   y0BboxBase.y0   r   r   c                 (    U R                  5       S   $ )z
The second of the pair of *x* coordinates that define the bounding box.

This is not guaranteed to be greater than :attr:`x0` (for that, use
:attr:`xmax`).
r   r   r   rH   s    r   x1BboxBase.x1  r   r   c                 (    U R                  5       S   $ )z
The second of the pair of *y* coordinates that define the bounding box.

This is not guaranteed to be greater than :attr:`y0` (for that, use
:attr:`ymax`).
r   r   r   rH   s    r   y1BboxBase.y1  r   r   c                 (    U R                  5       S   $ )z
The first pair of (*x*, *y*) coordinates that define the bounding box.

This is not guaranteed to be the bottom-left corner (for that, use
:attr:`min`).
r   r   rH   s    r   p0BboxBase.p0        ##r   c                 (    U R                  5       S   $ )z
The second pair of (*x*, *y*) coordinates that define the bounding box.

This is not guaranteed to be the top-right corner (for that, use
:attr:`max`).
r   r   rH   s    r   p1BboxBase.p1!  r   r   c                 X    [         R                  " U R                  5       SS2S4   5      $ )z"The left edge of the bounding box.Nr   r   minr   rH   s    r   xminBboxBase.xmin+  #     vvdoo'1-..r   c                 X    [         R                  " U R                  5       SS2S4   5      $ )z$The bottom edge of the bounding box.Nr   r   rH   s    r   yminBboxBase.ymin0  r   r   c                 X    [         R                  " U R                  5       SS2S4   5      $ )z#The right edge of the bounding box.Nr   r   maxr   rH   s    r   xmaxBboxBase.xmax5  r   r   c                 X    [         R                  " U R                  5       SS2S4   5      $ )z!The top edge of the bounding box.Nr   r   rH   s    r   ymaxBboxBase.ymax:  r   r   c                 H    [         R                  " U R                  5       SS9$ )z+The bottom-left corner of the bounding box.r   axisr   rH   s    r   r   BboxBase.min?       vvdoo'a00r   c                 H    [         R                  " U R                  5       SS9$ )z)The top-right corner of the bounding box.r   r   r   rH   s    r   r   BboxBase.maxD  r   r   c                 0    U R                  5       SS2S4   $ )zt
The pair of *x* coordinates that define the bounding box.

This is not guaranteed to be sorted from left to right.
Nr   r   rH   s    r   	intervalxBboxBase.intervalxI        A&&r   c                 0    U R                  5       SS2S4   $ )zt
The pair of *y* coordinates that define the bounding box.

This is not guaranteed to be sorted from bottom to top.
Nr   r   rH   s    r   	intervalyBboxBase.intervalyR  r   r   c                 8    U R                  5       nUS   US   -
  $ )z'The (signed) width of the bounding box.r   r   r   r    r   s     r   widthBboxBase.width[  #     "d|fTl**r   c                 8    U R                  5       nUS   US   -
  $ )z(The (signed) height of the bounding box.r   r   r   r   s     r   heightBboxBase.heighta  r   r   c                 8    U R                  5       nUS   US   -
  $ )z2The (signed) width and height of the bounding box.r   r   r   r   s     r   sizeBboxBase.sizeg  s#     "ay6!9$$r   c                 B    U R                  5       u  u  pu  p4XX1-
  XB-
  4$ )z?Return (:attr:`x0`, :attr:`y0`, :attr:`width`, :attr:`height`).r   r    r   r   r   r   s        r   boundsBboxBase.boundsm  s*     "__.(2))r   c                 >    U R                  5       R                  5       $ )z8Return (:attr:`x0`, :attr:`y0`, :attr:`x1`, :attr:`y1`).)r   flattenrH   s    r   extentsBboxBase.extentss  s      ((**r   c                     [         er   NotImplementedErrorrH   s    r   r   BboxBase.get_pointsx  s    !!r   c                 |    U R                   u  p#X!s=:*  =(       a    U:*  Os  =(       d    X!s=:  =(       a    U:  $ s  $ )zH
Return whether *x* is in the closed (:attr:`x0`, :attr:`x1`) interval.
r   r    r   r   r   s       r   	containsxBboxBase.containsx{  /     }}"}-2--r   c                 |    U R                   u  p#X!s=:*  =(       a    U:*  Os  =(       d    X!s=:  =(       a    U:  $ s  $ )zH
Return whether *y* is in the closed (:attr:`y0`, :attr:`y1`) interval.
r   r    yr   r   s       r   	containsyBboxBase.containsy  r   r   c                 T    U R                  U5      =(       a    U R                  U5      $ )zB
Return whether ``(x, y)`` is in the bounding box or on its edge.
)r   r   r    r   r   s      r   containsBboxBase.contains  s!     ~~a 6T^^A%66r   c                     U R                   u  p#pEUR                   u  pgpXB:  a  X$p$XS:  a  X5p5X:  a  XhphX:  a  XypyX(:*  =(       a    Xd:*  =(       a    X9:*  =(       a    Xu:*  $ )zs
Return whether this bounding box overlaps with the other bounding box.

Parameters
----------
other : `.BboxBase`
r   
r    ra   ax1ay1ax2ay2bx1by1bx2by2s
             r   overlapsBboxBase.overlaps  se     "\\#"]]#9999zFcjFSZFCJFr   c                 |    U R                   u  p#X!s=:  =(       a    U:  Os  =(       d    X!s=:  =(       a    U:  $ s  $ )zF
Return whether *x* is in the open (:attr:`x0`, :attr:`x1`) interval.
r   r   s       r   fully_containsxBboxBase.fully_containsx  /     {{{)bkkrk)k)r   c                 |    U R                   u  p#X!s=:  =(       a    U:  Os  =(       d    X!s=:  =(       a    U:  $ s  $ )zF
Return whether *y* is in the open (:attr:`y0`, :attr:`y1`) interval.
r   r   s       r   fully_containsyBboxBase.fully_containsy  r  r   c                 T    U R                  U5      =(       a    U R                  U5      $ )zF
Return whether ``x, y`` is in the bounding box, but not on its edge.
)r  r  r   s      r   fully_containsBboxBase.fully_contains  s%     ##A&B4+?+?+BBr   c                     U R                   u  p#pEUR                   u  pgpXB:  a  X$p$XS:  a  X5p5X:  a  XhphX:  a  XypyX(:  =(       a    Xd:  =(       a    X9:  =(       a    Xu:  $ )z
Return whether this bounding box overlaps with the other bounding box,
not including the edges.

Parameters
----------
other : `.BboxBase`
r  r  s
             r   fully_overlapsBboxBase.fully_overlaps  se     "\\#"]]#9999yBSYB39BBr   c           	          U R                  5       nUR                  [        R                  " US   US   US   /US   US   //5      5      u  p4n[	        X5S   US   //5      $ )zH
Construct a `Bbox` by statically transforming this one by *transform*.
r   r   r   r   r   r   )r   	transformr   arrayr   )r    r  ptsllullrs         r   transformedBboxBase.transformed  ss     oo((Vc$iT+c$iT-CD*F G
RQ%A())r   )      ?r&  r   )r&  r   )      ?r   )r'  r&  )r'  r'  )r&  r'  )r   r'  )r   r&  )	CSWSSEENENNWWc                     UR                   u  p4pVU R                   u  pxp[        U[        5      (       a  U R                  U   OUu  p[	        U R
                  X;XY-
  -  -   U-
  XLXj-
  -  -   U-
  /-   5      $ )a  
Return a copy of the `Bbox` anchored to *c* within *container*.

Parameters
----------
c : (float, float) or {'C', 'SW', 'S', 'SE', 'E', 'NE', ...}
    Either an (*x*, *y*) pair of relative coordinates (0 is left or
    bottom, 1 is right or top), 'C' (center), or a cardinal direction
    ('SW', southwest, is bottom left, etc.).
container : `Bbox`
    The box within which the `Bbox` is positioned.

See Also
--------
.Axes.set_anchor
)r   r   r   coefsr   _points)r    c	containerlbwhLBr0  Hcxcys                r   anchoredBboxBase.anchored  s|    " %%
a[[
a",Q"4"4A!DLL,&!+,&!+-- . 	.r   c                 ~    U R                   u  p4[        U R                  S   U R                  S   X-  X$-  /-   /5      $ )z
Return a copy of the `Bbox`, shrunk by the factor *mx*
in the *x* direction and the factor *my* in the *y* direction.
The lower left corner of the box remains unchanged.  Normally
*mx* and *my* will be less than 1, but this is not enforced.
r   )r   r   r3  )r    mxmyr8  r9  s        r   shrunkBboxBase.shrunk  sD     yyT\\!_\\!_'779 : 	:r   Nc                     US::  d  US::  a  [        S5      eUc  U nUR                  u  pEXA-  U-  nXe::  a  UnO	XS-  U-  nUn[        U R                  S   U R                  S   Xv4-   /5      $ )a  
Return a copy of the `Bbox`, shrunk so that it is as
large as it can be while having the desired aspect ratio,
*box_aspect*.  If the box coordinates are relative (i.e.
fractions of a larger box such as a figure) then the
physical aspect ratio of that figure is specified with
*fig_aspect*, so that *box_aspect* can also be given as a
ratio of the absolute dimensions, not the relative dimensions.
r   z.'box_aspect' and 'fig_aspect' must be positive)
ValueErrorr   r   r3  )r    
box_aspectr5  
fig_aspectr8  r9  r<  r0  s           r   shrunk_to_aspectBboxBase.shrunk_to_aspect  s     ?jAoMNNI~~NZ'6A+AAT\\!_\\!_v-/ 0 	0r   c           
          S/UQSPnU R                   u  p4pVXS-
  n[        R                  " U5       VV	s/ s H   u  p[        X8U-  -   U/X9U-  -   U//5      PM"     sn	n$ s  sn	nf )z
Return a list of new `Bbox` objects formed by splitting the original
one with vertical lines at fractional positions given by *args*.
r   r   r   	itertoolspairwiser   )
r    r+   xfr   r   r   r   r8  xf0xf1s
             r   splitxBboxBase.splitx  sy    
 ]$]]G ) 2 22 68 6HC r!G|R(2a<*<=> 68 	8 8s   'Ac                     S/UQSPnU R                   u  p4pVXd-
  n[        R                  " U5       VV	s/ s H  u  p[        X4X-  -   /XTX-  -   //5      PM      sn	n$ s  sn	nf )z
Return a list of new `Bbox` objects formed by splitting the original
one with horizontal lines at fractional positions given by *args*.
r   r   rM  )
r    r+   yfr   r   r   r   r9  yf0yf1s
             r   splityBboxBase.splity%  su    
 ]$]]G ) 2 22 68 6HC r<(2CG|*<=> 68 	8 8s   %Ac                    [        U5      S:X  a  g[        R                  " U5      n[        R                  " SS9   U R                  U:  XR
                  :  -  R                  SS9R                  5       sSSS5        $ ! , (       d  f       g= f)z
Count the number of vertices contained in the `Bbox`.
Any vertices with a non-finite x or y value are ignored.

Parameters
----------
vertices : (N, 2) array
r   ignore)invalidr   r   N)lenr   r   errstater   r   allsum)r    verticess     r   count_containsBboxBase.count_contains0  se     x=A::h'[[*hh))+,/CQCK +**s   9A>>
Bc                     [        U [        R                  " U Vs/ s H  n[        R                  " U5      PM     sn5      5      $ s  snf )zs
Count the number of bounding boxes that overlap this one.

Parameters
----------
bboxes : sequence of `.BboxBase`
)r   r   
atleast_3dr  )r    bboxesr   s      r   count_overlapsBboxBase.count_overlaps@  s;     -"--f =f!f =>@ 	@ =s    Ac                     U R                   nU R                  nX-  U-
  S-  nX$-  U-
  S-  n[        R                  " U* U* /XV//5      n[	        U R
                  U-   5      $ )zZ
Construct a `Bbox` by expanding this one around its center by the
factors *sw* and *sh*.
g       @)r   r   r   r  r   r3  )r    swshr   r   deltawdeltahas           r   expandedBboxBase.expandedK  sk    
 

*u$++&#-HHw(6*:;<DLL1$%%r   c                 T    U R                  5       nUc  Un[        X1* U* /X//-   5      $ )z
Construct a `Bbox` by padding this one on all four sides.

Parameters
----------
w_pad : float
    Width pad
h_pad : float, optional
    Height pad.  Defaults to *w_pad*.

)r   r   )r    w_padh_padr   s       r   paddedBboxBase.paddedW  s8     "=EFvv.??@@r   c                 4    [        U R                  X4-   5      $ )z<Construct a `Bbox` by translating this one by *tx* and *ty*.)r   r3  r    txtys      r   
translatedBboxBase.translatedh  s    DLLB8+,,r   c                 l    U R                  5       u  u  pu  p4[        R                  " X/X/X2/X4//5      $ )z
Return the corners of this rectangle as an array of points.

Specifically, this returns the array
``[[x0, y0], [x0, y1], [x1, y0], [x1, y1]]``.
)r   r   r  r   s        r   cornersBboxBase.cornersl  s9     "__.(2xx"B8bXx@AAr   c                     U R                  5       n[        5       R                  U5      R                  U5      n[        R                  5       nUR                  USS9  U$ )zo
Return the axes-aligned bounding box that bounds the result of rotating
this `Bbox` by an angle of *radians*.
T)r\  )r~  Affine2Drotater  r   unitupdate_from_data_xy)r    radiansr~  corners_rotatedbboxs        r   rotatedBboxBase.rotatedv  sO    
 ,,."*++G4>>wGyy{   >r   c                    [        U 5      (       d  [        S5      e[        R                  " U  Vs/ s H  oR                  PM     sn5      n[        R
                  " U  Vs/ s H  oR                  PM     sn5      n[        R                  " U  Vs/ s H  oR                  PM     sn5      n[        R
                  " U  Vs/ s H  oR                  PM     sn5      n[        X$/X5//5      $ s  snf s  snf s  snf s  snf )z8Return a `Bbox` that contains all of the given *bboxes*.z'bboxes' cannot be empty)
r^  rG  r   r   r   r   r   r   r   r   )rg  r  r   r   r   r   s         r   unionBboxBase.union  s     6{{788VV6264YY623VV6264YY623VV6264YY623VV6264YY623bXx())	 3222s   C+ C0C5 C:c                    [         R                  " U R                  UR                  5      n[         R                  " U R                  UR                  5      n[         R                  " U R
                  UR
                  5      n[         R                  " U R                  UR                  5      nX#::  a  XE::  a  [        X$/X5//5      $ S$ )zZ
Return the intersection of *bbox1* and *bbox2* if they intersect, or
None if they don't.
N)r   maximumr   minimumr   r   r   r   )bbox1bbox2r   r   r   r   s         r   intersectionBboxBase.intersection  s     ZZ

EJJ/ZZ

EJJ/ZZ

EJJ/ZZ

EJJ/-/X"(tbXx()LLr   r:   )Nr'  r   )>r(   r   r   r   r   r   r   r   r   rl   r   staticmethodr   r~   r4   r   propertyr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r$  r2  r?  rD  rJ  rS  rY  rc  rh  rp  ru  r{  r~  r  r  r  r   r:   r   r   r   r      s   	 ooe$T%7%78H%IJGI		5 
	5."**FN! ' ' ' ' ' ' ' ' $ $ $ $ / / / / / / / / 1 1 1 1 ' ' ' ' + +
 + +
 % %
 * *
 + +"..7G(**CC** E.0	:00	8	8? 	@
&A"-B	 * * 	M 	Mr   r   c                     ^  \ rS rSrSrU 4S jr\(       a  \rS rU 4S jrU 4S jr	\
S 5       r\
S 5       r\
S	 5       r\
S
S.S j5       rS rS rS rS rS+S jrS,S jrS,S jrS+S jr\R0                  R2                  S 5       r\R4                  R2                  S 5       r\R6                  R2                  S 5       r\R8                  R2                  S 5       r\R:                  R2                  S 5       r\R<                  R2                  S 5       r\R>                  R2                  S 5       r\R@                  R2                  S 5       r \RB                  R2                  S 5       r!\"S 5       r#\#R2                  S 5       r#\"S  5       r$\$R2                  S! 5       r$\"S" 5       r%\%R2                  S# 5       r%S$ r&S% r'S& r(S' r)S( r*S) r+S*r,U =r-$ )-r   i  a  
A mutable bounding box.

Examples
--------
**Create from known bounds**

The default constructor takes the boundary "points" ``[[xmin, ymin],
[xmax, ymax]]``.

    >>> Bbox([[1, 1], [3, 7]])
    Bbox([[1.0, 1.0], [3.0, 7.0]])

Alternatively, a Bbox can be created from the flattened points array, the
so-called "extents" ``(xmin, ymin, xmax, ymax)``

    >>> Bbox.from_extents(1, 1, 3, 7)
    Bbox([[1.0, 1.0], [3.0, 7.0]])

or from the "bounds" ``(xmin, ymin, width, height)``.

    >>> Bbox.from_bounds(1, 1, 2, 6)
    Bbox([[1.0, 1.0], [3.0, 7.0]])

**Create from collections of points**

The "empty" object for accumulating Bboxs is the null bbox, which is a
stand-in for the empty set.

    >>> Bbox.null()
    Bbox([[inf, inf], [-inf, -inf]])

Adding points to the null bbox will give you the bbox of those points.

    >>> box = Bbox.null()
    >>> box.update_from_data_xy([[1, 1]])
    >>> box
    Bbox([[1.0, 1.0], [1.0, 1.0]])
    >>> box.update_from_data_xy([[2, 3], [3, 2]], ignore=False)
    >>> box
    Bbox([[1.0, 1.0], [3.0, 3.0]])

Setting ``ignore=True`` is equivalent to starting over from a null bbox.

    >>> box.update_from_data_xy([[1, 1]], ignore=True)
    >>> box
    Bbox([[1.0, 1.0], [1.0, 1.0]])

.. warning::

    It is recommended to always specify ``ignore`` explicitly.  If not, the
    default value of ``ignore`` can be changed at any time by code with
    access to your Bbox, for example using the method `~.Bbox.ignore`.

**Properties of the ``null`` bbox**

.. note::

    The current behavior of `Bbox.null()` may be surprising as it does
    not have all of the properties of the "empty set", and as such does
    not behave like a "zero" object in the mathematical sense. We may
    change that in the future (with a deprecation period).

The null bbox is the identity for intersections

    >>> Bbox.intersection(Bbox([[1, 1], [3, 7]]), Bbox.null())
    Bbox([[1.0, 1.0], [3.0, 7.0]])

except with itself, where it returns the full space.

    >>> Bbox.intersection(Bbox.null(), Bbox.null())
    Bbox([[-inf, -inf], [inf, inf]])

A union containing null will always return the full space (not the other
set!)

    >>> Bbox.union([Bbox([[0, 0], [0, 0]]), Bbox.null()])
    Bbox([[-inf, -inf], [inf, inf]])
c                   > [         TU ]  " S0 UD6  [        R                  " U[        5      nUR
                  S:w  a  [        S5      eXl        [        R                  5       U l
        SU l        U R                  R                  5       U l        g)zj
Parameters
----------
points : `~numpy.ndarray`
    A (2, 2) array of the form ``[[x0, y0], [x1, y1]]``.
   r  z7Bbox points must be of the form "[[x0, y0], [x1, y1]]".TNr:   )r]   rE   r   r   floatshaperG  r3  _default_minposr\   _minpos_ignore_points_orig)r    r   r,   rd   s      r   rE   Bbox.__init__  sv     	"6"FE*<<6! 7 8 8&++- !LL--/r   c                 L    U R                  U5        U R                  " U40 UD6  g r   )r   	___init__)r    r   r,   s      r   rE   r    s    KKNN6,V,r   c                 X   > U R                  U R                  5        [        TU ]  5         g r   )r   r3  r]   rn   )r    rd   s    r   rn   Bbox.invalidate  s    KK%G r   c                 b   > [         TU ]  5       nU R                  R                  5       Ul        U$ r   )r]   r~   minposr\   r  )r    frozen_bboxrd   s     r   r~   Bbox.frozen  s*    gn&"kk..0r   c                  $    [        SS/SS//5      $ )z/Create a new unit `Bbox` from (0, 0) to (1, 1).r   r   )r   r:   r   r   r  	Bbox.unit  s     aVaV$%%r   c                      [        [        R                  [        R                  /[        R                  * [        R                  * //5      $ )z9Create a new null `Bbox` from (inf, inf) to (-inf, -inf).)r   r   infr:   r   r   null	Bbox.null  s2     bffbff%"&&'9:;;r   c                 8    [         R                  XX-   X-   5      $ )zc
Create a new `Bbox` from *x0*, *y0*, *width* and *height*.

*width* and *height* may be negative.
)r   from_extents)r   r   r   r   s       r   from_boundsBbox.from_bounds  s       R[AAr   N)r  c                 h    [        [        R                  " US5      5      nU b  XR                  SS& U$ )a  
Create a new Bbox from *left*, *bottom*, *right* and *top*.

The *y*-axis increases upwards.

Parameters
----------
left, bottom, right, top : float
    The four extents of the bounding box.
minpos : float or None
    If this is supplied, the Bbox will have a minimum positive value
    set. This is useful when dealing with logarithmic scales and other
    scales where negative bounds result in floating point errors.
r  N)r   r   reshaper  )r  r+   r  s      r   r  Bbox.from_extents$  s/      BJJtV,-$LLOr   c                 $    SR                  X5      $ )Nz@Bbox(x0={0.x0:{1}}, y0={0.y0:{1}}, x1={0.x1:{1}}, y1={0.y1:{1}})format)r    fmts     r   
__format__Bbox.__format__9  s    NF4	r   c                     [        U S5      $ )Nr?   r  rH   s    r   rI   Bbox.__str__>  s    dBr   c                 $    SR                  U 5      $ )Nz*Bbox([[{0.x0}, {0.y0}], [{0.x1}, {0.y1}]])r  rH   s    r   __repr__Bbox.__repr__A  s    ;BB4HHr   c                     Xl         g)aj  
Set whether the existing bounds of the box should be ignored
by subsequent calls to :meth:`update_from_data_xy`.

value : bool
    - When ``True``, subsequent calls to `update_from_data_xy` will
      ignore the existing bounds of the `Bbox`.
    - When ``False``, subsequent calls to `update_from_data_xy` will
      include the existing bounds of the `Bbox`.
N)r  )r    values     r   r\  Bbox.ignoreD  s	     r   c                    Uc  U R                   nUR                  R                  S:X  a  g[        USU R                  U R
                  U5      u  pVnU(       ax  U R                  5         U(       a,  USS2S4   U R                  SS2S4'   US   U R
                  S'   U(       a-  USS2S4   U R                  SS2S4'   US   U R
                  S'   ggg)a  
Update the bounds of the `Bbox` to contain the vertices of the
provided path. After updating, the bounds will have positive *width*
and *height*; *x0* and *y0* will be the minimal values.

Parameters
----------
path : `~matplotlib.path.Path`
ignore : bool, optional
   - When ``True``, ignore the existing bounds of the `Bbox`.
   - When ``False``, include the existing bounds of the `Bbox`.
   - When ``None``, use the last value passed to :meth:`ignore`.
updatex, updatey : bool, default: True
    When ``True``, update the x/y values.
Nr   r   )r  rb  r   r   r3  r  rn   )r    pathr\  updatexupdateyr   r  changeds           r   update_from_pathBbox.update_from_pathQ  s      >\\F==""5$dllF#< OO%+AqD\QT""()Q%+AqD\QT""()Q  r   c                     [         R                  " U5      nU R                  [         R                  " U[         R                  " UR
                  5      /5      USS9  g)a  
Update the x-bounds of the `Bbox` based on the passed in data. After
updating, the bounds will have positive *width*, and *x0* will be the
minimal value.

Parameters
----------
x : `~numpy.ndarray`
    Array of x-values.
ignore : bool, optional
   - When ``True``, ignore the existing bounds of the `Bbox`.
   - When ``False``, include the existing bounds of the `Bbox`.
   - When ``None``, use the last value passed to :meth:`ignore`.
F)r\  r  Nr   ravelr  column_stackonesr   )r    r   r\  s      r   update_from_data_xBbox.update_from_data_xs  sE     HHQK  !RWWQVV_1E!F(. 	! 	?r   c                     [         R                  " U5      nU R                  [         R                  " [         R                  " UR
                  5      U/5      USS9  g)a  
Update the y-bounds of the `Bbox` based on the passed in data. After
updating, the bounds will have positive *height*, and *y0* will be the
minimal value.

Parameters
----------
y : `~numpy.ndarray`
    Array of y-values.
ignore : bool, optional
    - When ``True``, ignore the existing bounds of the `Bbox`.
    - When ``False``, include the existing bounds of the `Bbox`.
    - When ``None``, use the last value passed to :meth:`ignore`.
F)r\  r  Nr  )r    r   r\  s      r   update_from_data_yBbox.update_from_data_y  sE     HHQK  "''!&&/11E!F(. 	! 	?r   c                 Z    [        U5      S:X  a  g[        U5      nU R                  XRX4S9  g)a(  
Update the `Bbox` bounds based on the passed in *xy* coordinates.

After updating, the bounds will have positive *width* and *height*;
*x0* and *y0* will be the minimal values.

Parameters
----------
xy : (N, 2) array-like
    The (x, y) coordinates.
ignore : bool, optional
    - When ``True``, ignore the existing bounds of the `Bbox`.
    - When ``False``, include the existing bounds of the `Bbox`.
    - When ``None``, use the last value passed to :meth:`ignore`.
updatex, updatey : bool, default: True
     When ``True``, update the x/y values.
r   N)r\  r  r  )r^  r	   r  )r    xyr\  r  r  r  s         r   r  Bbox.update_from_data_xy  s4    $ r7a<Bxd&- 	 	@r   c                 @    XR                   S'   U R                  5         g Nr   r3  rn   r    rc   s     r   r   Bbox.x0       Tr   c                 @    XR                   S'   U R                  5         g Nr   r  r  s     r   r   Bbox.y0  r  r   c                 @    XR                   S'   U R                  5         g Nr   r  r  s     r   r   Bbox.x1  r  r   c                 @    XR                   S'   U R                  5         g Nr   r  r  s     r   r   Bbox.y1  r  r   c                 @    XR                   S'   U R                  5         g Nr   r  r  s     r   r   Bbox.p0      Qr   c                 @    XR                   S'   U R                  5         g Nr   r  r  s     r   r   Bbox.p1  r  r   c                 H    XR                   S S 2S4'   U R                  5         g r  r  r    intervals     r   r   Bbox.intervalx      %QTr   c                 H    XR                   S S 2S4'   U R                  5         g r  r  r  s     r   r   Bbox.intervaly  r  r   c                     Uu  p#pE[         R                  " X#/X$-   X5-   //[        5      n[         R                  " U R                  U:g  5      (       a  X`l        U R                  5         g g r   )r   r  r  r   r3  rn   )r    r   r6  r7  r8  r9  r   s          r   r   Bbox.bounds  sV    
aA6AE15>2E:66$,,&())!LOO *r   c                     U R                   $ )z
The minimum positive value in both directions within the Bbox.

This is useful when dealing with logarithmic scales and other scales
where negative bounds result in floating point errors, and will be used
as the minimum extent instead of *p0*.
r  rH   s    r   r  Bbox.minpos  s     ||r   c                      XR                   S S & g r   r  r  s     r   r  r    s    Qr   c                      U R                   S   $ )z
The minimum positive value in the *x*-direction within the Bbox.

This is useful when dealing with logarithmic scales and other scales
where negative bounds result in floating point errors, and will be used
as the minimum *x*-extent instead of *x0*.
r   r  rH   s    r   minposxBbox.minposx       ||Ar   c                      XR                   S'   g r  r  r  s     r   r  r        Qr   c                      U R                   S   $ )z
The minimum positive value in the *y*-direction within the Bbox.

This is useful when dealing with logarithmic scales and other scales
where negative bounds result in floating point errors, and will be used
as the minimum *y*-extent instead of *y0*.
r   r  rH   s    r   minposyBbox.minposy   r  r   c                      XR                   S'   g r  r  r  s     r   r  r    r   r   c                 (    SU l         U R                  $ )zV
Get the points of the bounding box as an array of the form
``[[x0, y0], [x1, y1]]``.
r   )rB   r3  rH   s    r   r   Bbox.get_points  s    
 ||r   c                     [         R                  " U R                  U:g  5      (       a  Xl        U R                  5         gg)z
Set the points of the bounding box directly from an array of the form
``[[x0, y0], [x1, y1]]``.  No error checking is performed, as this
method is mainly for internal use.
N)r   r   r3  rn   r   s     r   
set_pointsBbox.set_points  s0     66$,,&())!LOO *r   c                     [         R                  " U R                  UR                  5       :g  5      (       a&  UR                  5       U l        U R	                  5         gg)zC
Set this bounding box from the "frozen" bounds of another `Bbox`.
N)r   r   r3  r   rn   r    ra   s     r   setBbox.set!  sD     66$,,%"2"2"4455 ++-DLOO 6r   c                 P    U R                  5       =(       d    U R                  5       $ )z/Return whether the bbox has changed since init.)mutatedxmutatedyrH   s    r   mutatedBbox.mutated)  s    }}1$--/1r   c                     U R                   S   U R                  S   :g  =(       d    U R                   S   U R                  S   :g  $ )z4Return whether the x-limits have changed since init.r   r   r3  r  rH   s    r   r  Bbox.mutatedx-  D    T"d&7&7&== >T"d&7&7&==	?r   c                     U R                   S   U R                  S   :g  =(       d    U R                   S   U R                  S   :g  $ )z4Return whether the y-limits have changed since init.r   r   r  rH   s    r   r  Bbox.mutatedy2  r  r   )r  rB   r  r3  r  )NTTr   ).r(   r   r   r   r   rE   r   r  rn   r~   r  r  r  r  r  r  rI   r  r\  r  r  r  r  r   r   setterr   r   r   r   r   r   r   r   r  r  r  r  r   r  r  r  r  r  r   r   r   s   @r   r   r     sa   N`0& 		-	! & & < < B B #'  (
 I ,D?&?&@2 [[  [[  [[  [[  [[  [[      __    ]]    ^^    ^^ 2?
? ?r   r   c                   h   ^  \ rS rSrSrU 4S jr\" SS5      rS r\	(       a  \r
S rS rS	 rS
rU =r$ )TransformedBboxi8  z
A `Bbox` that is automatically transformed by a given
transform.  When either the child bounding box or transform
changes, the bounds of this bbox will update accordingly.
c                 (  > [         R                  " [        US9  [         R                  " [        US9  UR                  S:w  d  UR
                  S:w  a  [        S5      e[        TU ]   " S0 UD6  Xl	        X l
        U R                  X5        SU l        g)z=
Parameters
----------
bbox : `Bbox`
transform : `Transform`
r  r  r  z8The input and output dimensions of 'transform' must be 2Nr:   )r   check_isinstancer   	Transform
input_dimsoutput_dimsrG  r]   rE   _bbox
_transformr`   r3  )r    r  r  r,   rd   s       r   rE   TransformedBbox.__init__?  s     	hT2i9=1$	(=(=(BJL L 	"6"
#$*r   r#  r$  c                 x   U R                   (       Ga  U R                  R                  5       nU R                  R	                  US   US   /US   US   /US   US   /US   US   //5      n[
        R                  R                  US5      n[        US S 2S4   5      [        US S 2S4   5      4nUS   US   :  a  US S S2   n[        US S 2S4   5      [        US S 2S4   5      4nUS   US   :  a  US S S2   n[
        R                  " US   US   /US   US   //5      U l        SU l         U R                  $ )	Nr   r   r   r           r   r   )rB   r#  r   r$  r  r   r   filledr   r   r  r3  )r    pr   xsyss        r   r   TransformedBbox.get_pointsT  sV   ===

%%'A __..D'1T7#D'1T7#D'1T7#D'1T7#%&F
 UU\\&#.FVAqD\"Cq!t$55Bw4 "XVAqD\"Cq!t$55Bw4 "X88A1A1% DL
 DM||r   c                 H    U R                  5       nU R                  U5        U$ r   _get_pointsr   r   s     r   r   r-  u  !    %%'FKKMr   c                     U R                   R                  " U R                  R                  5       R	                  X45      6 $ r   )r#  r  r$  invertedr  r   s      r   r  TransformedBbox.containsz  s1    zz""DOO$<$<$>$H$H!$PQQr   c                     U R                   R                  " U R                  R                  5       R	                  X45      6 $ r   )r#  r  r$  r3  r  r   s      r   r  TransformedBbox.fully_contains~  s2    zz(($//*B*B*D*N*NPQv*VWWr   )r#  rB   r3  r$  )r(   r   r   r   r   rE   r2   rI   r   r   r0  r  r  r   r   r   s   @r   r  r  8  sA    & w5G<  	
RX Xr   r  c                   0  ^  \ rS rSrSrSU 4S jjr\" SS5      rS r\	(       a  \r
S r\S 5       r\R                  S	 5       r\S
 5       r\R                  S 5       r\S 5       r\R                  S 5       r\S 5       r\R                  S 5       rSrU =r$ )LockableBboxi  z
A `Bbox` where some elements may be locked at certain values.

When the child bounding box changes, the bounds of this bbox will update
accordingly with the exception of the locked elements.
c                 :  > [         R                  " [        US9  [        T
U ]  " S0 UD6  Xl        U R                  U5        SU l        X#XE/nU Vs/ s H  oSL PM     n	n[        R                  R                  U[        U	S9R                  S5      U l        gs  snf )az  
Parameters
----------
bbox : `Bbox`
    The child bounding box to wrap.

x0 : float or None
    The locked value for x0, or None to leave unlocked.

y0 : float or None
    The locked value for y0, or None to leave unlocked.

x1 : float or None
    The locked value for x1, or None to leave unlocked.

y1 : float or None
    The locked value for y1, or None to leave unlocked.

r  Nmaskr  r:   )r   r  r   r]   rE   r#  r`   r3  r   r   r  r  r  _locked_points)r    r  r   r   r   r   r,   fprc   r;  rd   s             r   rE   LockableBbox.__init__  s    ( 	hT2"6"
$b')*rtr* eekk"e$k?GGO +s   Br#  r<  c                     U R                   (       a\  U R                  R                  5       n[        R                  " U R
                  R                  UU R
                  5      U l        SU l         U R                  $ r  )rB   r#  r   r   wherer<  r;  r3  r   s     r   r   LockableBbox.get_points  sX    ==ZZ**,F88D$7$7$<$<$*$($7$79DL DM||r   c                 H    U R                  5       nU R                  U5        U$ r   r/  r   s     r   r   rA    r1  r   c                 ^    U R                   R                  S   (       a  gU R                   S   $ )z2
float or None: The value used for the locked x0.
r   Nr<  r;  rH   s    r   	locked_x0LockableBbox.locked_x0  ,    
 ##D)&&t,,r   c                     US L U R                   R                  S'   XR                   R                  S'   U R                  5         g r  r<  r;  datarn   )r    r   s     r   rE  rF    :    )+t  &)+  &r   c                 ^    U R                   R                  S   (       a  gU R                   S   $ )z2
float or None: The value used for the locked y0.
r   NrD  rH   s    r   	locked_y0LockableBbox.locked_y0  rG  r   c                     US L U R                   R                  S'   XR                   R                  S'   U R                  5         g r  rI  )r    r   s     r   rM  rN    rK  r   c                 ^    U R                   R                  S   (       a  gU R                   S   $ )z2
float or None: The value used for the locked x1.
r   NrD  rH   s    r   	locked_x1LockableBbox.locked_x1  rG  r   c                     US L U R                   R                  S'   XR                   R                  S'   U R                  5         g r  rI  )r    r   s     r   rQ  rR    rK  r   c                 ^    U R                   R                  S   (       a  gU R                   S   $ )z2
float or None: The value used for the locked y1.
r   NrD  rH   s    r   	locked_y1LockableBbox.locked_y1  rG  r   c                     US L U R                   R                  S'   XR                   R                  S'   U R                  5         g r  rI  )r    r   s     r   rU  rV    rK  r   )r#  rB   r<  r3  )NNNN)r(   r   r   r   r   rE   r2   rI   r   r   r0  r  rE  r  rM  rQ  rU  r   r   r   s   @r   r8  r8    s    P: w(89G  	
 - -  
 - -  
 - -  
 - -  r   r8  c                       \ rS rSrSrSr Sr Sr Sr S r	S r
S r\S 5       rS	 rS
 rS rS rS rS rS rS rS rS rS rS rS rS rSS jrS rSrg)r   i  aU  
The base class of all `TransformNode` instances that
actually perform a transformation.

All non-affine transformations should be subclasses of this class.
New affine transformations should be subclasses of `Affine2D`.

Subclasses of this class should override the following members (at
minimum):

- :attr:`input_dims`
- :attr:`output_dims`
- :meth:`transform`
- :meth:`inverted` (if an inverse exists)

The following attributes may be overridden if the default is unsuitable:

- :attr:`is_separable` (defaults to True for 1D -> 1D transforms, False
  otherwise)
- :attr:`has_inverse` (defaults to True if :meth:`inverted` is overridden,
  False otherwise)

If the transform needs to do something non-standard with
`matplotlib.path.Path` objects, such as adding curves
where there were once line segments, it should override:

- :meth:`transform_path`
NFc                 J   [        S U R                   5       5      S:X  a+  U R                  U R                  s=:X  a  S:X  a
  O  OSU l        [        S U R                   5       5      S:X  a8  [        U S5      (       a&  U R                  [        R                  La  SU l        g g g g )Nc              3   >   #    U  H  nS [        U5      ;   v   M     g7f)is_separableNr^   r   rt   s     r   r!   .Transform.__init_subclass__.<locals>.<genexpr>1  s     I[6$v,.[   r   Tc              3   >   #    U  H  nS [        U5      ;   v   M     g7f)has_inverseNr\  r]  s     r   r!   r^  7  s     HK&f-Kr_  r3  )	ra  __mro__r!  r"  r[  hasattrr3  r   ra  r;   s    r   __init_subclass__Transform.__init_subclass__,  s    
 IS[[IIQNNNcoo::#C HCKKHHAMC,,LL	(:(::"CO ; - Nr   c                 N    [        U[        5      (       a  [        X5      $ [        $ )z
Compose two transforms together so that *self* is followed by *other*.

``A + B`` returns a transform ``C`` so that
``C.transform(x) == B.transform(A.transform(x))``.
)r   r   composite_transform_factoryNotImplementedr  s     r   __add__Transform.__add__<  s(     eY// ,D8 	 	 r   c              #   (   #    [        5       U 4v   g7f)aj  
Return an iterator breaking down this transform stack from left to
right recursively. If self == ((A, N), A) then the result will be an
iterator which yields I : ((A, N), A), followed by A : (N, A),
followed by (A, N) : (A), but not ((A, N), A) : I.

This is equivalent to flattening the stack then yielding
``flat_stack[:i], flat_stack[i:]`` where i=0..(n-1).
NIdentityTransformrH   s    r   _iter_break_from_left_to_right(Transform._iter_break_from_left_to_rightK  s       !4''s   c                     g)z
Return the number of transforms which have been chained
together to form this Transform instance.

.. note::

    For the special case of a Composite transform, the maximum depth
    of the two is returned.

r   r:   rH   s    r   depthTransform.depthW  s     r   c                 z    U R                   UR                   :  a  gU R                  5        H  u  p#X1:X  d  M    g   g)a!  
Return whether the given transform is a sub-tree of this transform.

This routine uses transform equality to identify sub-trees, therefore
in many situations it is object id which will be used.

For the case where the given transform represents the whole
of this transform, returns True.
FT)rq  rn  )r    ra   rS   sub_trees       r   contains_branchTransform.contains_branche  s=     ::#  >>@KA  A r   c                 b    U R                   S:w  a  [        S5      eU R                  U5      4S-  $ )a%  
Return whether the given branch is a sub-tree of this transform on
each separate dimension.

A common use for this method is to identify if a transform is a blended
transform containing an Axes' data transform. e.g.::

    x_isdata, y_isdata = trans.contains_branch_seperately(ax.transData)

r  Lcontains_branch_seperately only supports transforms with 2 output dimensions)r"  rG  ru  r    other_transforms     r   contains_branch_seperately$Transform.contains_branch_seperatelyx  sB     q  C D D $$_581<<r   c                 p   [        U[        5      (       d  [        $ U R                  5        H  u  p#X1:X  d  M  Us  $    UR                  5        H8  u  p#X0:X  d  M  UR                  (       d  [        S5      eUR                  5       s  $    UR                  (       a  XR                  5       -   $ [        S5      e)a  
Compose *self* with the inverse of *other*, cancelling identical terms
if any::

    # In general:
    A - B == A + B.inverted()
    # (but see note regarding frozen transforms below).

    # If A "ends with" B (i.e. A == A' + B for some A') we can cancel
    # out B:
    (A' + B) - B == A'

    # Likewise, if B "starts with" A (B = A + B'), we can cancel out A:
    A - (A + B') == B'.inverted() == B'^-1

Cancellation (rather than naively returning ``A + B.inverted()``) is
important for multiple reasons:

- It avoids floating-point inaccuracies when computing the inverse of
  B: ``B - B`` is guaranteed to cancel out exactly (resulting in the
  identity transform), whereas ``B + B.inverted()`` may differ by a
  small epsilon.
- ``B.inverted()`` always returns a frozen transform: if one computes
  ``A + B + B.inverted()`` and later mutates ``B``, then
  ``B.inverted()`` won't be updated and the last two terms won't cancel
  out anymore; on the other hand, ``A + B - B`` will always be equal to
  ``A`` even if ``B`` is mutated.
zQThe shortcut cannot be computed since 'other' includes a non-invertible componentzpIt is not possible to compute transA - transB since transB cannot be inverted and there is no shortcut possible.)r   r   rh  rn  ra  rG  r3  )r    ra   	remainderrt  s       r   __sub__Transform.__sub__  s    < %++!!#'#F#F#HI    $I $)#G#G#II ,,$>? ? !))++ $J ..*** 2 3 3r   c                 >    U R                  5       R                  5       $ )z9Array interface to get at this Transform's affine matrix.
get_affine
get_matrixr   s      r   r   Transform.__array__       ++--r   c                    [         R                  " U5      nUR                  nUR                  SU R                  45      nU R                  U R                  U5      5      nUS:X  a+  [         R                  R                  U5      (       a   eUS   $ US:X  a  UR                  S5      $ US:X  a  U$ [        SR                  U R                  S95      e)a`  
Apply this transformation on the given array of *values*.

Parameters
----------
values : array-like
    The input values as an array of length :attr:`input_dims` or
    shape (N, :attr:`input_dims`).

Returns
-------
array
    The output values as an array of length :attr:`output_dims` or
    shape (N, :attr:`output_dims`), depending on the input.
r(  r   r   r   r  z5Input values must have shape (N, {dims}) or ({dims},))dims)r   
asanyarrayndimr  r!  transform_affinetransform_non_affiner   	is_maskedrG  r  )r    rs   r  ress       r   r  Transform.transform  s    $ v&{{T__ 56 ##D$=$=f$EF 19uus++++t919;;r?"QYJCVV)+ 	+r   c                 @    U R                  5       R                  U5      $ )aX  
Apply only the affine part of this transformation on the
given array of values.

``transform(values)`` is always equivalent to
``transform_affine(transform_non_affine(values))``.

In non-affine transformations, this is generally a no-op.  In
affine transformations, this is equivalent to
``transform(values)``.

Parameters
----------
values : array
    The input values as an array of length :attr:`input_dims` or
    shape (N, :attr:`input_dims`).

Returns
-------
array
    The output values as an array of length :attr:`output_dims` or
    shape (N, :attr:`output_dims`), depending on the input.
r  r  r    rs   s     r   r  Transform.transform_affine  s    0  **622r   c                     U$ )aF  
Apply only the non-affine part of this transformation.

``transform(values)`` is always equivalent to
``transform_affine(transform_non_affine(values))``.

In non-affine transformations, this is generally equivalent to
``transform(values)``.  In affine transformations, this is
always a no-op.

Parameters
----------
values : array
    The input values as an array of length :attr:`input_dims` or
    shape (N, :attr:`input_dims`).

Returns
-------
array
    The output values as an array of length :attr:`output_dims` or
    shape (N, :attr:`output_dims`), depending on the input.
r:   r  s     r   r  Transform.transform_non_affine  s	    . r   c                 R    [        U R                  UR                  5       5      5      $ )z
Transform the given bounding box.

For smarter transforms including caching (a common requirement in
Matplotlib), see `TransformedBbox`.
)r   r  r   )r    r  s     r   transform_bboxTransform.transform_bbox  s     DNN4??#4566r   c                     [        5       $ )z&Get the affine part of this transform.rl  rH   s    r   r  Transform.get_affine!  s     ""r   c                 >    U R                  5       R                  5       $ )z5Get the matrix for the affine part of this transform.r  rH   s    r   r  Transform.get_matrix%  r  r   c                 l    [        U5      U R                  :w  a  [        S5      eU R                  U5      $ )aI  
Return a transformed point.

This function is only kept for backcompatibility; the more general
`.transform` method is capable of transforming both a list of points
and a single point.

The point is given as a sequence of length :attr:`input_dims`.
The transformed point is returned as a sequence of length
:attr:`output_dims`.
z/The length of 'point' must be 'self.input_dims')r^  r!  rG  r  )r    points     r   transform_pointTransform.transform_point)  s/     u:(NOO~~e$$r   c                 B    U R                  U R                  U5      5      $ )z
Apply the transform to `.Path` *path*, returning a new `.Path`.

In some cases, this transform may insert curves into the path
that began as line segments.
)transform_path_affinetransform_path_non_affiner    r  s     r   transform_pathTransform.transform_path9  s      ))$*H*H*NOOr   c                 @    U R                  5       R                  U5      $ )z
Apply the affine part of this transform to `.Path` *path*, returning a
new `.Path`.

``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
)r  r  r  s     r   r  Transform.transform_path_affineB  s      66t<<r   c                 z    U R                  UR                  5      n[        R                  " X!R                  U5      $ )z
Apply the non-affine part of this transform to `.Path` *path*,
returning a new `.Path`.

``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
)r  rb  r	   _fast_from_codes_and_vertscodes)r    r  r   s      r   r  #Transform.transform_path_non_affineL  s/     %%dmm4..q**dCCr   c                    U R                   S:w  d  U R                  S:w  a  [        S5      e[        R                  " U5      n[        R                  " U5      n[
        R                  " SUS9  [
        R                  " SUS9  [        U5      [        U5      :w  a  [        S5      eU(       d  [        R                  " U5      nX$[        R                  " [        R                  " U5      [        R                  " U5      /5      -  -   nU R                  U5      nU R                  U5      nXv-
  n[        R                  " USS2S	4   USS2S
4   5      n	U(       d  [        R                  " U	5      n	U	$ )ax  
Transform a set of angles anchored at specific locations.

Parameters
----------
angles : (N,) array-like
    The angles to transform.
pts : (N, 2) array-like
    The points where the angles are anchored.
radians : bool, default: False
    Whether *angles* are radians or degrees.
pushoff : float
    For each point in *pts* and angle in *angles*, the transformed
    angle is computed by transforming a segment of length *pushoff*
    starting at that point and making that angle relative to the
    horizontal axis, and measuring the angle between the horizontal
    axis and the transformed segment.

Returns
-------
(N,) array
r  zOnly defined in 2D)Nr  )r   r   )anglesz'There must be as many 'angles' as 'pts'Nr   r   )r!  r"  r   r   r   r   check_shaper^  rG  deg2radr  cossinr  arctan2rad2deg)
r    r  r   r  pushoffpts2tptstpts2dro  s
             r   transform_anglesTransform.transform_anglesW  s#   0 ??a4#3#3q#8%&:;;F#jjo,0v;#c("FGGZZ'Frv02v0@  A A A ~~c"t$LJJqAw!Q$(

1Ar   c                     [        5       e)a  
Return the corresponding inverse transformation.

It holds ``x == self.inverted().transform(self.transform(x))``.

The return value of this method should be treated as
temporary.  An update to *self* does not cause a corresponding
update to its inverted copy.
r   rH   s    r   r3  Transform.inverted  s     "##r   r:   )Fgh㈵>)r(   r   r   r   r   r!  r"  r[  ra  rd  ri  rn  r  rq  ru  r{  r  r   r  r  r  r  r  r  r  r  r  r  r  r3  r   r:   r   r   r   r     s    : J
 K
 LJKG# 	 
(  &=$03d.#+J3427#.% P=	D/b
$r   r   c                      ^  \ rS rSrSrSrU 4S jrS r\" S5      r	S r
S r\" S	 5      r\" S
 5      r\" S 5      r\" S 5      r\" S 5      rSrU =r$ )TransformWrapperi  a  
A helper class that holds a single child transform and acts
equivalently to it.

This is useful if a node of the transform tree must be replaced at
run time with a transform of a different type.  This class allows
that replacement to correctly trigger invalidation.

`TransformWrapper` instances must have the same input and output dimensions
during their entire lifetime, so the child transform may only be replaced
with another child transform of the same dimensions.
Tc                 v   > [         R                  " [        US9  [        TU ]  5         U R                  U5        g)zV
*child*: A `Transform` instance.  This child may later
be replaced with :meth:`set`.
)r{   N)r   r  r   r]   rE   r  )r    r{   rd   s     r   rE   TransformWrapper.__init__  s+    
 	iu5r   c                 8    U R                   R                  U5      $ r   )_child__eq__r  s     r   r  TransformWrapper.__eq__  s    {{!!%((r   r  c                 6    U R                   R                  5       $ r   )r  r~   rH   s    r   r~   TransformWrapper.frozen  s    {{!!##r   c                    [        U S5      (       a  U R                  5         UR                  UR                  4nU R                  R                  U R                  R                  4nX#:w  a  [        SU SU 35      eU R                  R                  R                  [        U 5      S5        Xl        U R                  U5        UR                  U l
        UR                  U l        UR                  U l        UR                  U l        UR                  U l        UR                  U l        UR                   U l        UR"                  U l        UR$                  U l        SU l        U R                  5         SU l        g)z
Replace the current child of this transform with another one.

The new child must have the same number of input and output
dimensions as the current child.
r  z+The input and output dims of the new child z% do not match those of current child Nr   )rc  rn   r!  r"  r  rG  r@   rT   r_   r`   r  r  r  r  r  r  r  r3  r  rB   )r    r{   new_dimsold_dimss       r   r  TransformWrapper.set  s?    4""OO((%*;*;<H..0G0GHH# A( L;;C*FG G KK  $$RXt4%  % 6 6$)$>$>!#22%*%@%@").)H)H&****
 r   c                 .    U R                   R                  $ r   )r  r!  rH   s    r   r-   TransformWrapper.<lambda>  s    t{{'='=r   c                 .    U R                   R                  $ r   )r  r"  rH   s    r   r-   r        (?(?r   c                 .    U R                   R                  $ r   )r  rl   rH   s    r   r-   r    s    dkk&;&;r   c                 .    U R                   R                  $ r   )r  r[  rH   s    r   r-   r    s    )A)Ar   c                 .    U R                   R                  $ r   )r  ra  rH   s    r   r-   r    r  r   )r  rB   r  r  r3  r  r  r  r  r  r  )r(   r   r   r   r   rq   rE   r  r2   rI   r~   r  r  r!  r"  rl   r[  ra  r   r   r   s   @r   r  r    si     L) x(G$#J =>J?@K;<IABL?@Kr   r  c                   f   ^  \ rS rSrSrSrU 4S jrS rS rS r	S r
S	 rS
 rS rS rS rSrU =r$ )
AffineBasei  zK
The base class of all affine transformations of any number of dimensions.
Tc                 4   > [         TU ]  " U0 UD6  S U l        g r   )r]   rE   	_inverted)r    r+   r,   rd   s      r   rE   AffineBase.__init__  s    $)&)r   c                 "    U R                  5       $ r   r  r   s      r   r   AffineBase.__array__  s      r   c                     [        USS5      (       a@  [        US5      (       a/  U R                  5       UR                  5       :H  R                  5       $ [        $ )Nrl   Fr  )r   rc  r  r`  rh  r  s     r   r  AffineBase.__eq__  sG    5+u--'%2N2NOO%)9)9);;@@BBr   c                 $    U R                  U5      $ r   )r  r  s     r   r  AffineBase.transform  s    $$V,,r   c                     [        S5      e)Nz.Affine subclasses should override this method.r   r  s     r   r  AffineBase.transform_affine  s    ! #, - 	-r   c                     U$ r   r:   r  s     r   r  AffineBase.transform_non_affine  s    r   c                 $    U R                  U5      $ r   )r  r  s     r   r  AffineBase.transform_path  s    ))$//r   c                 v    [        U R                  UR                  5      UR                  UR                  5      $ r   )r	   r  rb  r  _interpolation_stepsr  s     r   r   AffineBase.transform_path_affine  s/    D))$--8JJ 9 9; 	;r   c                     U$ r   r:   r  s     r   r  $AffineBase.transform_path_non_affine      r   c                     U $ r   r:   rH   s    r   r  AffineBase.get_affine  r  r   )r  )r(   r   r   r   r   rl   rE   r   r  r  r  r  r  r  r  r  r   r   r   s   @r   r  r    sF     I!
--
0;
 r   r  c                   `    \ rS rSrSrSrSrS r\S 5       r	S r
S r\(       a  \rS rS	 rS
rg)Affine2DBasei  a  
The base class of all 2D affine transformations.

2D affine transformations are performed using a 3x3 numpy array::

    a c e
    b d f
    0 0 1

This class provides the read-only interface.  For a mutable 2D
affine transformation, use `Affine2D`.

Subclasses of this class will generally only need to override a
constructor and `~.Transform.get_matrix` that generates a custom 3x3 matrix.
r  c                 P    [        U R                  5       R                  5       5      $ r   )r  r  r\   rH   s    r   r~   Affine2DBase.frozen(  s    )..011r   c                 X    U R                  5       nUS   US   s=:H  =(       a    S:H  $ s  $ )Nr   r   r'  r  r    mtxs     r   r[  Affine2DBase.is_separable,  s/    oo4yCI,,,,,,r   c                 r    U R                  5       n[        USS R                  SS5      R                  5      $ )zE
Return the values of the matrix as an ``(a, b, c, d, e, f)`` tuple.
Nr  r   r   )r  tupleswapaxesflatr  s     r   	to_valuesAffine2DBase.to_values1  s4     ooS!W%%a+0011r   c                 ,   U R                  5       n[        U[        R                  R                  5      (       aQ  [        UR                  U5      n[        R                  R	                  U[        R                  R                  U5      S9$ [        X5      $ )Nr:  )r  r   r   r   r   r   rJ  getmask)r    rs   r  tpointss       r   r  Affine2DBase.transform_affine8  sg    oofbee//00&v{{C8G55$$W255==3H$II,,r   c                     [        U[        R                  5      (       d#  [        R                  " S[        U5       S35        U R                  U5      $ )NzA non-numpy array of type zE was passed in for transformation, which results in poor performance.)r   r   ndarrayr   r   r'   _transform_affiner  s     r   r  r  B  sN    
 fbjj11""0f ?M NO ))&11r   c                     U R                   b  U R                  (       aQ  U R                  5       nS nU R                  (       a  SU R                  -  n[	        [        U5      US9U l         SU l        U R                   $ )Nz(%s)-1)rD   r   )r  rB   r  rC   r  r   )r    r  rD   s      r   r3  Affine2DBase.invertedM  s_    >>!T]]//#C!N##!)D,@,@!@%c#h~NDNDM~~r   )rB   r  N)r(   r   r   r   r   r!  r"  r~   r  r[  r  r  r   r  r3  r   r:   r   r   r  r    sK     JK2 - -2- ,		2	r   r  c                      ^  \ rS rSrSrSU 4S jjr\" S5      rS r\	S 5       r
S rS rS	 rS
 rS rS rS rS rS rSS jrS rS rSrU =r$ )r  iY  z%
A mutable 2D affine transformation.
c                    > [         TU ]  " S0 UD6  Uc  [        R                  nUR	                  5       U l        SU l        g)z
Initialize an Affine transform from a 3x3 numpy float array::

  a c e
  b d f
  0 0 1

If *matrix* is None, initialize with the identity transform.
Nr   r:   )r]   rE   rm  _mtxr\   rB   )r    matrixr,   rd   s      r   rE   Affine2D.__init__^  s9     	"6">&++FKKM	r   r  c                 v   U R                   [        R                  " [        R                  " U R                   5      5      :g  R                  5       (       a  U R	                  5       $ U R                   S   U R                   S   :w  a#  SU R                   S    SU R                   S    S3$ SU R                   S    S3$ )Nr   r   zAffine2D().scale(z, r&   )r  r   diagr   	_base_strrH   s    r   rI   Affine2D.__str__q  s    II);!<<AACC   	= 99T?diio5 )4(9DIIdO;LAN	= )4(9;		=r   c                 t    [        [        R                  " XXAX5SSS/	[        5      R	                  S5      5      $ )zT
Create a new Affine2D instance from the given values::

  a c e
  b d f
  0 0 1

.
r'  r'  )r6   r6   )r  r   r  r  r  )ro  r7  r4  r  efs         r   from_valuesAffine2D.from_valuesx  s9     HHaA!S#6>FFvNP 	Pr   c                 X    U R                   (       a  SU l        SU l         U R                  $ )zW
Get the underlying transformation matrix as a 3x3 array::

  a c e
  b d f
  0 0 1

.
Nr   rB   r  r  rH   s    r   r  Affine2D.get_matrix  s#     ==!DNDMyyr   c                 0    Xl         U R                  5         g)zY
Set the underlying transformation matrix from a 3x3 array::

  a c e
  b d f
  0 0 1

.
Nr  rn   r  s     r   
set_matrixAffine2D.set_matrix  s     	r   c                     [         R                  " [        US9  UR                  5       U l        U R                  5         g)zP
Set this transformation from the frozen copy of another
`Affine2DBase` object.
)ra   N)r   r  r  r  r  rn   r  s     r   r  Affine2D.set  s.    
 	l%8$$&	r   c                 l    [         R                  R                  5       U l        U R                  5         U $ )z8
Reset the underlying matrix to the identity transform.
)rm  r  r\   rn   rH   s    r   clearAffine2D.clear  s)    
 &**//1	r   c                 X   [         R                  " U5      n[         R                  " U5      nU R                  nUR	                  5       u  u  pVnu  ppX%-  X8-  -
  US'   X&-  X9-  -
  US'   X'-  X:-  -
  US'   X5-  X(-  -   US'   X6-  X)-  -   US'   X7-  X*-  -   US'   U R                  5         U $ )z
Add a rotation (in radians) to this transform in place.

Returns *self*, so this method can easily be chained with more
calls to :meth:`rotate`, :meth:`rotate_deg`, :meth:`translate`
and :meth:`scale`.
r   r   r   r  r   r   r   r  )mathr  r  r  tolistrn   )r    thetaro  r7  r  xxr  r   yxyyr   rS   s               r   r  Affine2D.rotate  s     HHUOHHUOii(+

%lrrFQVOD	FQVOD	FQVOD	FQVOD	FQVOD	FQVOD	r   c                 L    U R                  [        R                  " U5      5      $ )z
Add a rotation (in degrees) to this transform in place.

Returns *self*, so this method can easily be chained with more
calls to :meth:`rotate`, :meth:`rotate_deg`, :meth:`translate`
and :meth:`scale`.
)r  r!  r  )r    degreess     r   
rotate_degAffine2D.rotate_deg  s     {{4<<011r   c                 f    U R                  U* U* 5      R                  U5      R                  X5      $ )z
Add a rotation (in radians) around the point (x, y) in place.

Returns *self*, so this method can easily be chained with more
calls to :meth:`rotate`, :meth:`rotate_deg`, :meth:`translate`
and :meth:`scale`.
)	translater  )r    r   r   r#  s       r   rotate_aroundAffine2D.rotate_around  s/     ~~qb1"%,,U3==aCCr   c                     [        U5      [        U5      p!U R                  U* U* 5      R                  U5      R                  X5      $ )z
Add a rotation (in degrees) around the point (x, y) in place.

Returns *self*, so this method can easily be chained with more
calls to :meth:`rotate`, :meth:`rotate_deg`, :meth:`translate`
and :meth:`scale`.
)r  r-  r*  )r    r   r   r)  s       r   rotate_deg_aroundAffine2D.rotate_deg_around  s>     Qxq1~~qb1"%009CCAIIr   c                     U R                   S==   U-  ss'   U R                   S==   U-  ss'   U R                  5         U $ )z
Add a translation in place.

Returns *self*, so this method can easily be chained with more
calls to :meth:`rotate`, :meth:`rotate_deg`, :meth:`translate`
and :meth:`scale`.
r  r   r  rx  s      r   r-  Affine2D.translate  s7     			$2		$2r   c                 D   Uc  UnU R                   S==   U-  ss'   U R                   S==   U-  ss'   U R                   S==   U-  ss'   U R                   S==   U-  ss'   U R                   S==   U-  ss'   U R                   S==   U-  ss'   U R                  5         U $ )z
Add a scale in place.

If *sy* is None, the same scale is applied in both the *x*- and
*y*-directions.

Returns *self*, so this method can easily be chained with more
calls to :meth:`rotate`, :meth:`rotate_deg`, :meth:`translate`
and :meth:`scale`.
r   r   r  r   r   r   r  )r    sxsys      r   scaleAffine2D.scale  s     :B		$2		$2		$2		$2		$2		$2r   c                 |   [         R                  " U5      n[         R                  " U5      nU R                  nUR                  5       u  u  pgnu  ppUS==   X9-  -  ss'   US==   X:-  -  ss'   US==   X;-  -  ss'   US==   XF-  -  ss'   US==   XG-  -  ss'   US==   XH-  -  ss'   U R	                  5         U $ )a  
Add a skew in place.

*xShear* and *yShear* are the shear angles along the *x*- and
*y*-axes, respectively, in radians.

Returns *self*, so this method can easily be chained with more
calls to :meth:`rotate`, :meth:`rotate_deg`, :meth:`translate`
and :meth:`scale`.
r   r   r  r   r   r   )r!  tanr  r"  rn   )r    xShearyShearrxryr  r$  r  r   r%  r&  r   rS   s                r   skewAffine2D.skew  s     XXfXXfii(+

%lrrD	RW	D	RW	D	RW	D	RW	D	RW	D	RW	r   c                 v    U R                  [        R                  " U5      [        R                  " U5      5      $ )a  
Add a skew in place.

*xShear* and *yShear* are the shear angles along the *x*- and
*y*-axes, respectively, in degrees.

Returns *self*, so this method can easily be chained with more
calls to :meth:`rotate`, :meth:`rotate_deg`, :meth:`translate`
and :meth:`scale`.
)r@  r!  r  )r    r<  r=  s      r   skew_degAffine2D.skew_deg)  s'     yyf-t||F/CDDr   r  r   )r(   r   r   r   r   rE   r2   r  rI   r  r  r  r  r  r  r  r*  r.  r1  r-  r8  r@  rC  r   r   r   s   @r   r  r  Y  sy    " !(I= P P.2D
J.4E Er   r  c                       \ rS rSrSr\R                  " S5      rS r\	" 5       r
S rS rS rS rS	 rS
 rS rS rS rSrg)rm  i7  zM
A special class that does one thing, the identity transform, in a
fast way.
r6   c                     U $ r   r:   rH   s    r   r~   IdentityTransform.frozen>  r  r   c                     U R                   $ r   )r  rH   s    r   r  IdentityTransform.get_matrixD  s    yyr   c                 .    [         R                  " U5      $ r   r   r  r  s     r   r  IdentityTransform.transformH      }}V$$r   c                 .    [         R                  " U5      $ r   rK  r  s     r   r  "IdentityTransform.transform_affineL  rM  r   c                 .    [         R                  " U5      $ r   rK  r  s     r   r  &IdentityTransform.transform_non_affineP  rM  r   c                     U$ r   r:   r  s     r   r   IdentityTransform.transform_pathT  r  r   c                     U$ r   r:   r  s     r   r  'IdentityTransform.transform_path_affineX  r  r   c                     U$ r   r:   r  s     r   r  +IdentityTransform.transform_path_non_affine\  r  r   c                     U $ r   r:   rH   s    r   r  IdentityTransform.get_affine`  r  r   c                     U $ r   r:   rH   s    r   r3  IdentityTransform.invertedd  r  r   r:   N)r(   r   r   r   r   r   identityr  r~   r2   rI   r  r  r  r  r  r  r  r  r3  r   r:   r   r   rm  rm  7  sR     ;;q>D  G%%%r   rm  c                   6    \ rS rSrSrS rS r\" SS5      rSr	g)	_BlendedMixinii  zCCommon methods for `BlendedGenericTransform` and `BlendedAffine2D`.c                    [        U[        [        45      (       a9  U R                  UR                  :H  =(       a    U R                  UR                  :H  $ U R                  U R                  :X  a  U R                  U:H  $ [
        $ r   )r   BlendedAffine2DBlendedGenericTransform_x_yrh  r  s     r   r  _BlendedMixin.__eq__l  s_    eo/FGHHGGuxx'Bdgg.ABWW77e##!!r   c                 n    U R                   R                  U5      U R                  R                  U5      4$ r   )rb  ru  rc  )r    r  s     r   r{  (_BlendedMixin.contains_branch_seperatelyt  s0    ''	2''	24 	4r   rb  rc  r:   N)
r(   r   r   r   r   r  r{  r2   rI   r   r:   r   r   r^  r^  i  s    M"4 tT*Gr   r^  c                       \ rS rSrSrSrSrSrSrS r	\
S 5       rS r\
" S 5      r\
" S	 5      rS
 rS rS rS rSrg)ra  i{  z
A "blended" transform uses one transform for the *x*-direction, and
another transform for the *y*-direction.

This "generic" version can handle any given child transform in the
*x*- and *y*-directions.
r  Tc                 z    [         R                  " U 40 UD6  Xl        X l        U R	                  X5        SU l        g)a;  
Create a new "blended" transform using *x_transform* to transform the
*x*-axis and *y_transform* to transform the *y*-axis.

You will generally not call this constructor directly but use the
`blended_transform_factory` function instead, which can determine
automatically which kind of blended transform to create.
N)r   rE   rb  rc  r`   _affine)r    x_transformy_transformr,   s       r   rE    BlendedGenericTransform.__init__  s6     	4*6*+3r   c                 j    [        U R                  R                  U R                  R                  5      $ r   )r   rb  rq  rc  rH   s    r   rq  BlendedGenericTransform.depth  s    477==$''--00r   c                     gr9   r:   r  s     r   ru  'BlendedGenericTransform.contains_branch  s     r   c                 h    U R                   R                  =(       a    U R                  R                  $ r   )rb  rl   rc  rH   s    r   r-    BlendedGenericTransform.<lambda>       dgg&7&7&MDGG<M<M&Mr   c                 h    U R                   R                  =(       a    U R                  R                  $ r   )rb  ra  rc  rH   s    r   r-   rr         TWW((@TWW-@-@@r   c                 z    [        U R                  R                  5       U R                  R                  5       5      $ r   )blended_transform_factoryrb  r~   rc  rH   s    r   r~   BlendedGenericTransform.frozen  s%    ()9477>>;KLLr   c                    U R                   R                  (       a  U R                  R                  (       a  U$ U R                   nU R                  nX#:X  a!  UR                  S:X  a  UR	                  U5      $ UR                  S:X  a  UR	                  U5      S S 2SS24   nO4UR	                  US S 2S4   5      nUR                  [        U5      S45      nUR                  S:X  a  UR	                  U5      S S 2SS 24   nO4UR	                  US S 2S4   5      nUR                  [        U5      S45      n[        U[        R                  R                  5      (       d)  [        U[        R                  R                  5      (       a!  [        R                  R                  XE4S5      $ [        R                  " XE4S5      $ )Nr  r   r   )rb  rl   rc  r!  r  r  r^  r   r   r   r   concatenate)r    rs   r   r   x_pointsy_pointss         r   r  ,BlendedGenericTransform.transform_non_affine  sa   77!2!2MGGGG6alla'))&11<<1--f5a1f=H--fQTl;H''X(:;H<<1--f5ae<H--fQTl;H''X(:;Hx!2!2338RUU%6%67755$$h%91==>>8"6::r   c                 z    [        U R                  R                  5       U R                  R                  5       5      $ r   )ra  rb  r3  rc  rH   s    r   r3   BlendedGenericTransform.inverted  s)    &tww'7'7'9477;K;K;MNNr   c                    U R                   (       d  U R                  c  U R                  U R                  :X  a   U R                  R	                  5       U l        OU R                  R	                  5       R                  5       nU R                  R	                  5       R                  5       n[        R                  " US   US   / SQ/5      n[        U5      U l        SU l         U R                  $ Nr   r   r'  r'  r'  )	rB   ri  rb  rc  r  r  r   r  r  )r    x_mtxy_mtxr  s       r   r  "BlendedGenericTransform.get_affine  s    ==DLL0ww$''!#ww113**,779**,779 hha%(ODE'}DM||r   )ri  rB   rb  rc  N)r(   r   r   r   r   r!  r"  r[  rq   rE   r  rq  ru  rl   ra  r~   r  r3  r  r   r:   r   r   ra  ra  {  sl     JKLL 1 1
 MNI@BKM;8Or   ra  c                   (    \ rS rSrSrSrS rS rSrg)r`  i  z
A "blended" transform uses one transform for the *x*-direction, and
another transform for the *y*-direction.

This version is an optimization for the case where both child
transforms are of type `Affine2DBase`.
Tc                 Z   UR                   =(       a    UR                   nUR                  =(       a    UR                  nU=(       a    UnU(       d  [        S5      e[        R                  " U 40 UD6  Xl        X l        U R                  X5        [        R	                  U 5        SU l	        g)a  
Create a new "blended" transform using *x_transform* to transform the
*x*-axis and *y_transform* to transform the *y*-axis.

Both *x_transform* and *y_transform* must be 2D affine transforms.

You will generally not call this constructor directly but use the
`blended_transform_factory` function instead, which can determine
automatically which kind of blended transform to create.
zABoth *x_transform* and *y_transform* must be 2D affine transformsN)
rl   r[  rG  r   rE   rb  rc  r`   r  r  )r    rj  rk  r,   rl   r[  
is_corrects          r   rE   BlendedAffine2D.__init__  s      ))Ck.C.C	"//LK4L4L/<
 1 2 2 	4*6*+3d#	r   c                    U R                   (       a  U R                  U R                  :X  a   U R                  R                  5       U l        OZU R                  R                  5       nU R                  R                  5       n[
        R                  " US   US   / SQ/5      U l        S U l        SU l         U R                  $ r  )rB   rb  rc  r  r  r   r  r  )r    r  r  s      r   r  BlendedAffine2D.get_matrix  s    ==ww$''! GG..0	**,**, HHeAha/%JK	!DNDMyyr   )rB   r  r  rb  rc  N)	r(   r   r   r   r   r[  rE   r  r   r:   r   r   r`  r`    s     L4r   r`  c                     [        U [        5      (       a   [        U[        5      (       a  [        X5      $ [        X5      $ )z
Create a new "blended" transform using *x_transform* to transform
the *x*-axis and *y_transform* to transform the *y*-axis.

A faster version of the blended transform is returned for the case
where both child transforms are affine.
)r   r  r`  ra  )rj  rk  s     r   rw  rw  	  s4     	;--{L11{88";<<r   c                      ^  \ rS rSrSrSrU 4S jrS rU 4S jrS r	S r
S	 r\" S
 5      r\" S 5      r\" S 5      r\" S 5      r\" SS5      rS rS rS rS rS rSrU =r$ )CompositeGenericTransformi	  z
A composite transform formed by applying transform *a* then
transform *b*.

This "generic" version can handle any two arbitrary
transformations.
Tc                    > UR                   UR                  :w  a  [        S5      eUR                  U l        UR                   U l         [        TU ]  " S0 UD6  Xl        X l        U R                  X5        g)a  
Create a new composite transform that is the result of
applying transform *a* then transform *b*.

You will generally not call this constructor directly but write ``a +
b`` instead, which will automatically choose the best kind of composite
transform instance to create.
HThe output dimension of 'a' must be equal to the input dimensions of 'b'Nr:   )r"  r!  rG  r]   rE   _a_br`   r    ro  r7  r,   rd   s       r   rE   "CompositeGenericTransform.__init__%	  sf     ==ALL( ; < <,,=="6"!r   c                     SU l         [        U R                  R                  5       U R                  R                  5       5      n[        U[        5      (       d  UR                  5       $ U$ r  )rB   rg  r  r~   r  r   r  )r    r~   s     r   r~    CompositeGenericTransform.frozen9	  sM    ,GGNNdggnn.0&";<<==?"r   c                    > X R                   L a+  U R                  R                  (       d  [        R                  n[
        TU ]  X5        g r   )r  r  rl   r   rA   r]   rk   )r    ri   rj   rd   s      r   rk   .CompositeGenericTransform._invalidate_internalB	  s3     '0A0A++E$U>r   c                     [        U[        [        45      (       aC  XL =(       d9    U R                  UR                  :H  =(       a    U R                  UR                  :H  $ gr9   )r   r  CompositeAffine2Dr  r  r  s     r   r   CompositeGenericTransform.__eq__I	  sN    e79JKLL= >TWW%8 &=)-EHH)<> r   c              #      #    U R                   R                  5        H  u  pXU R                  -   4v   M     U R                  R                  5        H  u  pU R                   U-   U4v   M     g 7fr   r  rn  r  r    leftrights      r   rn  8CompositeGenericTransform._iter_break_from_left_to_rightP	  ]     77AACKD'' D77AACKD''D.%'' D   A-A/c                 z    U R                   S:w  a  [        S5      eX:X  a  gU R                  R                  U5      $ )Nr  rx  )TT)r"  rG  r  r{  ry  s     r   r{  4CompositeGenericTransform.contains_branch_seperatelyV	  sC    q  C D D"ww11/BBr   c                 \    U R                   R                  U R                  R                  -   $ r   r  rq  r  rH   s    r   r-   "CompositeGenericTransform.<lambda>_	  s    $''--$''--"?r   c                 h    U R                   R                  =(       a    U R                  R                  $ r   )r  rl   r  rH   s    r   r-   r  `	  rs  r   c                 h    U R                   R                  =(       a    U R                  R                  $ r   )r  r[  r  rH   s    r   r-   r  b	  s     TWW))Bdgg.B.BBr   c                 h    U R                   R                  =(       a    U R                  R                  $ r   )r  ra  r  rH   s    r   r-   r  d	  ru  r   r  r  c                 @    U R                  5       R                  U5      $ r   r  r  s     r   r  *CompositeGenericTransform.transform_affineh	  s     **622r   c                 |   U R                   R                  (       a  U R                  R                  (       a  U$ U R                   R                  (       d6  U R                  R                  (       a  U R                   R                  U5      $ U R                  R                  U R                   R	                  U5      5      $ r   )r  rl   r  r  r  r  s     r   r  .CompositeGenericTransform.transform_non_affinel	  sr    77!2!2M""tww'8'877//7777//0A0A&0IJJr   c                 |   U R                   R                  (       a  U R                  R                  (       a  U$ U R                   R                  (       d6  U R                  R                  (       a  U R                   R                  U5      $ U R                  R                  U R                   R	                  U5      5      $ r   )r  rl   r  r  r  r  s     r   r  3CompositeGenericTransform.transform_path_non_affineu	  sy    77!2!2K""tww'8'87744T::7744$(GG$:$:4$@B Br   c                 D   U R                   R                  (       d  U R                   R                  5       $ [        [        R
                  " U R                   R                  5       R                  5       U R                  R                  5       R                  5       5      5      $ r   )r  rl   r  r  r   dotr  r  rH   s    r   r  $CompositeGenericTransform.get_affine	  sn    ww  77%%''BFF477#5#5#7#B#B#D#'77#5#5#7#B#B#DF G Gr   c                 z    [        U R                  R                  5       U R                  R                  5       5      $ r   )r  r  r3  r  rH   s    r   r3  "CompositeGenericTransform.inverted	  s.    (GG 0 0 24 	4r   )r  r  rB   r!  r"  )r(   r   r   r   r   rq   rE   r~   rk   r  rn  r{  r  rq  rl   r[  ra  r2   rI   r  r  r  r  r3  r   r   r   s   @r   r  r  	  s     L (?(C ?@EMNIBDL@BK tT*G3KBG4 4r   r  c                   Z   ^  \ rS rSrSrU 4S jr\S 5       rS r\	" SS5      r
S rS	rU =r$ )
r  i	  z
A composite transform formed by applying transform *a* then transform *b*.

This version is an optimization that handles the case where both *a*
and *b* are 2D affines.
c                 V  > UR                   (       a  UR                   (       d  [        S5      eUR                  UR                  :w  a  [        S5      eUR                  U l        UR                  U l        [        TU ]  " S0 UD6  Xl        X l        U R                  X5        SU l	        g)a  
Create a new composite transform that is the result of
applying `Affine2DBase` *a* then `Affine2DBase` *b*.

You will generally not call this constructor directly but write ``a +
b`` instead, which will automatically choose the best kind of composite
transform instance to create.
z%'a' and 'b' must be affine transformsr  Nr:   )
rl   rG  r"  r!  r]   rE   r  r  r`   r  r  s       r   rE   CompositeAffine2D.__init__	  s     {{!++DEE==ALL( ; < <,,=="6"!	r   c                 \    U R                   R                  U R                  R                  -   $ r   r  rH   s    r   rq  CompositeAffine2D.depth	  s    ww}}tww}},,r   c              #      #    U R                   R                  5        H  u  pXU R                  -   4v   M     U R                  R                  5        H  u  pU R                   U-   U4v   M     g 7fr   r  r  s      r   rn  0CompositeAffine2D._iter_break_from_left_to_right	  r  r  r  r  c                     U R                   (       aZ  [        R                  " U R                  R	                  5       U R
                  R	                  5       5      U l        S U l        SU l         U R                  $ r  )rB   r   r  r  r  r  r  r  rH   s    r   r  CompositeAffine2D.get_matrix	  sS    ==""$""$&DI "DNDMyyr   )r  r  rB   r  r  r!  r"  )r(   r   r   r   r   rE   r  rq  rn  r2   rI   r  r   r   r   s   @r   r  r  	  s>    . - -( tT*G r   r  c                     [        U [        5      (       a  U$ [        U[        5      (       a  U $ [        U [        5      (       a   [        U[        5      (       a  [        X5      $ [	        X5      $ )aR  
Create a new composite transform that is the result of applying
transform a then transform b.

Shortcut versions of the blended transform are provided for the
case where both child transforms are affine, or one or the other
is the identity transform.

Composite transforms may also be created using the '+' operator,
e.g.::

  c = a + b
)r   rm  r  r  r  )ro  r7  s     r   rg  rg  	  sY    $ !&''	A(	)	)	Ax	 	 Z8%<%< &&$Q**r   c                   H   ^  \ rS rSrSrSrU 4S jr\" SS5      rS r	Sr
U =r$ )	BboxTransformi	  zH
`BboxTransform` linearly transforms points from one `Bbox` to another.
Tc                    > [         R                  " [        XS9  [        TU ]  " S0 UD6  Xl        X l        U R                  X5        SU l        SU l	        g)zX
Create a new `BboxTransform` that linearly transforms
points from *boxin* to *boxout*.
)boxinboxoutNr:   )
r   r  r   r]   rE   _boxin_boxoutr`   r  r  )r    r  r  r,   rd   s       r   rE   BboxTransform.__init__	  sK    
 	heC"6"%(	r   r  r  c                    U R                   (       a  U R                  R                  u  pp4U R                  R                  u  pVpxXs-  n	X-  n
[        (       a  U	S:X  d  U
S:X  a  [        S5      e[        R                  " U	SU* U	-  U-   /SX* U
-  U-   // SQ/[        5      U l	        S U l
        SU l         U R                  $ )Nr   z/Transforming from or to a singular bounding boxr'  r  )rB   r  r   r  r   rG  r   r  r  r  r  )r    inlinbinwinhoutloutboutwouthx_scaley_scales              r   r  BboxTransform.get_matrix	  s    ==!%!3!3Cc%)\\%8%8"DjGjGu'Q,'Q, EG G7cT'\$5F"G'*GT'\$5F"G"G"I "'(DI "DNDMyyr   )r  r  rB   r  r  r(   r   r   r   r   r[  rE   r2   rI   r  r   r   r   s   @r   r  r  	  s,     L x3G r   r  c                   F   ^  \ rS rSrSrSrU 4S jr\" S5      rS r	Sr
U =r$ )BboxTransformToi
  zu
`BboxTransformTo` is a transformation that linearly transforms points from
the unit bounding box to a given `Bbox`.
Tc                    > [         R                  " [        US9  [        TU ]  " S0 UD6  Xl        U R                  U5        SU l        SU l        g)zh
Create a new `BboxTransformTo` that linearly transforms
points from the unit bounding box to *boxout*.
)r  Nr:   )	r   r  r   r]   rE   r  r`   r  r  )r    r  r,   rd   s      r   rE   BboxTransformTo.__init__
  sF    
 	hv6"6"&!	r   r  c                 "   U R                   (       as  U R                  R                  u  pp4[        (       a  US:X  d  US:X  a  [	        S5      e[
        R                  " USU/SXB// SQ/[        5      U l        S U l	        SU l         U R                  $ Nr   z(Transforming to a singular bounding box.r'  r  )
rB   r  r   r   rG  r   r  r  r  r  )r    r  r  r  r  s        r   r  BboxTransformTo.get_matrix
  s    ==%)\\%8%8"Du$!)tqy !KLL4#t"4$'"4"4"6 "'(DI "DNDMyyr   )r  rB   r  r  r  r   s   @r   r  r  
  s*    
 L y)G r   r  r7   c                       \ rS rSrSrS rSrg)BboxTransformToMaxOnlyi-
  z
`BboxTransformToMaxOnly` is a transformation that linearly transforms points from
the unit bounding box to a given `Bbox` with a fixed upper left of (0, 0).
c                 "   U R                   (       as  U R                  R                  u  p[        (       a  US:X  d  US:X  a  [	        S5      e[
        R                  " USS/SUS// SQ/[        5      U l        S U l	        SU l         U R                  $ r  )
rB   r  r   r   rG  r   r  r  r  r  )r    r   r   s      r   r  !BboxTransformToMaxOnly.get_matrix3
  s    ==))JDu$!)tqy !KLL4#s"3$'s"3"3"5 "'(DI "DNDMyyr   r  N)r(   r   r   r   r   r  r   r:   r   r   r  r  -
  s    r   r  c                   F   ^  \ rS rSrSrSrU 4S jr\" S5      rS r	Sr
U =r$ )BboxTransformFromiB
  z^
`BboxTransformFrom` linearly transforms points from a given `Bbox` to the
unit bounding box.
Tc                    > [         R                  " [        US9  [        TU ]  " S0 UD6  Xl        U R                  U5        S U l        S U l        g )N)r  r:   )	r   r  r   r]   rE   r  r`   r  r  )r    r  r,   rd   s      r   rE   BboxTransformFrom.__init__I
  sD    he4"6"% 	r   r  c                 F   U R                   (       a  U R                  R                  u  pp4[        (       a  US:X  d  US:X  a  [	        S5      eSU-  nSU-  n[
        R                  " USU* U-  /SXb* U-  // SQ/[        5      U l        S U l	        SU l         U R                  $ )Nr   z*Transforming from a singular bounding box.r'  r'  r  )
rB   r  r   r   rG  r   r  r  r  r  )r    r  r  r  r  r  r  s          r   r  BboxTransformFrom.get_matrixT
  s    ==!%!3!3Ccu#(cQh !MNNCiGCiG7cT'\"B'*GT'\"B"B"D "'(DI "DNDMyyr   )r  rB   r  r  r  r   s   @r   r  r  B
  s*     L x(G r   r  c                   B   ^  \ rS rSrSrU 4S jr\" S5      rS rSr	U =r
$ )ScaledTranslationie
  zp
A transformation that translates by *xt* and *yt*, after *xt* and *yt*
have been transformed by *scale_trans*.
c                    > [         TU ]  " S0 UD6  X4U l        X0l        U R	                  U5        S U l        S U l        g Nr:   )r]   rE   _t_scale_transr`   r  r  )r    xtytscale_transr,   rd   s        r   rE   ScaledTranslation.__init__j
  s>    "6"('+&	r   r  c                 
   U R                   (       ag  [        R                  R                  5       U l        U R                  R                  U R                  5      U R                  S S2S4'   SU l         S U l        U R                  $ )Nr  r   )rB   rm  r  r\   r  r  r  r  rH   s    r   r  ScaledTranslation.get_matrixt
  sb    ==)..335DI#00::477CDIIbqb!eDM!DNyyr   )rB   r  r  r  r  )r(   r   r   r   r   rE   r2   rI   r  r   r   r   s   @r   r  r  e
  s#     t$G r   r  c                   2   ^  \ rS rSrSrU 4S jrS rSrU =r$ )_ScaledRotationi
  zV
A transformation that applies rotation by *theta*, after transform by *trans_shift*.
c                 H   > [         TU ]  5         Xl        X l        S U l        g r   )r]   rE   _theta_trans_shiftr  )r    r#  trans_shiftrd   s      r   rE   _ScaledRotation.__init__
  s     '	r   c                     U R                   (       a^  U R                  R                  U R                  S//5      S   nUS   n[	        5       R                  U5      nUR                  5       U l        U R                  $ r  )rB   r  r  r  r  r  r  r  )r    transformed_coordsadjusted_thetarotations       r   r  _ScaledRotation.get_matrix
  sh    ==!%!2!2!<!<t{{A>N=O!PQR!S/2Nz((8H ++-DIyyr   )r  r  r  )	r(   r   r   r   r   rE   r  r   r   r   s   @r   r  r  
  s     r   r  c                   F   ^  \ rS rSrSrSrU 4S jr\" S5      rS r	Sr
U =r$ )AffineDeltaTransformi
  aJ  
A transform wrapper for transforming displacements between pairs of points.

This class is intended to be used to transform displacements ("position
deltas") between pairs of points (e.g., as the ``offset_transform``
of `.Collection`\s): given a transform ``t`` such that ``t =
AffineDeltaTransform(t) + offset``, ``AffineDeltaTransform``
satisfies ``AffineDeltaTransform(a - b) == AffineDeltaTransform(a) -
AffineDeltaTransform(b)``.

This is implemented by forcing the offset components of the transform
matrix to zero.

This class is experimental as of 3.3, and the API may change.
Tc                 T   > [         TU ]  " S0 UD6  Xl        U R                  U5        g r  )r]   rE   _base_transformr`   )r    r  r,   rd   s      r   rE   AffineDeltaTransform.__init__
  s'    "6"()$r   r  c                     U R                   (       a@  U R                  R                  5       R                  5       U l        SU R                  S S2S4'   U R                  $ )Nr   r  r(  )rB   r  r  r\   r  rH   s    r   r  AffineDeltaTransform.get_matrix
  sH    ==,,779>>@DI !DIIbqb"fyyr   )r  r  )r(   r   r   r   r   rq   rE   r2   rI   r  r   r   r   s   @r   r   r   
  s+      L%
 01G r   r   c                   J   ^  \ rS rSrSrU 4S jrS rS rS rS r	S r
S	rU =r$ )
TransformedPathi
  aE  
A `TransformedPath` caches a non-affine transformed copy of the
`~.path.Path`.  This cached copy is automatically updated when the
non-affine part of the transform changes.

.. note::

    Paths are considered immutable by this class. Any update to the
    path's vertices/codes will not trigger a transform recomputation.

c                    > [         R                  " [        US9  [        TU ]  5         Xl        X l        U R                  U5        SU l        SU l	        g)zD
Parameters
----------
path : `~.path.Path`
transform : `Transform`
r  N)
r   r  r   r]   rE   _pathr$  r`   _transformed_path_transformed_points)r    r  r  rd   s      r   rE   TransformedPath.__init__
  sH     	i9=
#)$!%#' r   c                 \   U R                   U R                  :X  d  U R                  c~  U R                  R	                  U R
                  5      U l        [        R                  " U R                  R                  U R
                  R                  5      S U R
                  5      U l
        SU l         g r  )rB   rA   r
  r$  r  r	  r	   r  r  rb  r  rH   s    r   _revalidateTransformedPath._revalidate
  s     MMT///))199$**E " //OO889L9LM$**& $ r   c                 Z    U R                  5         U R                  U R                  5       4$ )a  
Return a copy of the child path, with the non-affine part of
the transform already applied, along with the affine part of
the path necessary to complete the transformation.  Unlike
:meth:`get_transformed_path_and_affine`, no interpolation will
be performed.
)r  r  r  rH   s    r   !get_transformed_points_and_affine1TransformedPath.get_transformed_points_and_affine
  s(     	''):::r   c                 Z    U R                  5         U R                  U R                  5       4$ )z
Return a copy of the child path, with the non-affine part of
the transform already applied, along with the affine part of
the path necessary to complete the transformation.
)r  r
  r  rH   s    r   get_transformed_path_and_affine/TransformedPath.get_transformed_path_and_affine
  s(     	%%t'888r   c                 l    U R                  5         U R                  R                  U R                  5      $ )z4
Return a fully-transformed copy of the child path.
)r  r$  r  r
  rH   s    r   get_fully_transformed_path*TransformedPath.get_fully_transformed_path
  s+     	44T5K5KLLr   c                 6    U R                   R                  5       $ r   )r$  r  rH   s    r   r  TransformedPath.get_affine
  s    ))++r   )rB   r	  r$  r
  r  )r(   r   r   r   r   rE   r  r  r  r  r  r   r   r   s   @r   r  r  
  s,    
(	;9M, ,r   r  c                   8   ^  \ rS rSrSrU 4S jrU 4S jrSrU =r$ )TransformedPatchPathi
  z
A `TransformedPatchPath` caches a non-affine transformed copy of the
`~.patches.Patch`. This cached copy is automatically updated when the
non-affine part of the transform or the patch changes.
c                 j   > [         TU ]  UR                  5       UR                  5       5        Xl        g)z1
Parameters
----------
patch : `~.patches.Patch`
N)r]   rE   get_pathget_transform_patch)r    patchrd   s     r   rE   TransformedPatchPath.__init__  s)     	)5+>+>+@Ar   c                    > U R                   R                  5       nXR                  :w  a  Xl        S U l        [        TU ]  5         g r   )r   r  r	  r
  r]   r  )r    
patch_pathrd   s     r   r   TransformedPatchPath._revalidate  s9    [[))+
 ##J%)D"r   )r   r	  r
  )	r(   r   r   r   r   rE   r  r   r   r   s   @r   r  r  
  s     r   r  c                    [         R                  " U 5      (       a  [         R                  " U5      (       d  U* U4$ SnX:  a  XpSn[        [        X/5      u  p[	        [        U 5      [        U5      5      nUSU-  [         R                  " [        5      R                  -  :  a  U* n UnO<X-
  Xc-  ::  a2  US:X  a  U S:X  a  U* n UnO X[        U 5      -  -  n X[        U5      -  -  nU(       a	  U(       d  XpX4$ )a  
Modify the endpoints of a range as needed to avoid singularities.

Parameters
----------
vmin, vmax : float
    The initial endpoints.
expander : float, default: 0.001
    Fractional amount by which *vmin* and *vmax* are expanded if
    the original interval is too small, based on *tiny*.
tiny : float, default: 1e-15
    Threshold for the ratio of the interval to the maximum absolute
    value of its endpoints.  If the interval is smaller than
    this, it will be expanded.  This value should be around
    1e-15 or larger; otherwise the interval will be approaching
    the double precision resolution limit.
increasing : bool, default: True
    If True, swap *vmin*, *vmax* if *vmin* > *vmax*.

Returns
-------
vmin, vmax : float
    Endpoints, expanded and/or swapped if necessary.
    If either input is inf or NaN, or if both inputs are 0 or very
    close to zero, it returns -*expander*, *expander*.
FTg    .Ar   )r   isfinitemapr  r   absfinfotiny)vminvmaxexpanderr+  
increasingswappedmaxabsvalues          r   nonsingularr2    s    8 KKr{{4'8'8y(""G{d UTL)JDc$iT+KcDjBHHUO$8$888y	*	*199DDSY&&DSY&&Dzd:r   c                 @    U u  p#X#:  a  X2p2X!s=:*  =(       a    U:*  $ s  $ )a
  
Check, inclusively, whether an interval includes a given value.

Parameters
----------
interval : (float, float)
    The endpoints of the interval.
val : float
    Value to check is within interval.

Returns
-------
bool
    Whether *val* is within the *interval*.
r:   r  rc   ro  r7  s       r   interval_containsr5  O  s(      DAu1==q==r   c                 X    U u  p4X4:  a  XCpCXC-
  U-  nX2-
  Us=:*  =(       a    XB-   :*  $ s  $ )aP  
Check, inclusively, whether an interval includes a given value, with the
interval expanded by a small tolerance to admit floating point errors.

Parameters
----------
interval : (float, float)
    The endpoints of the interval.
val : float
    Value to check is within interval.
rtol : float, default: 1e-10
    Relative tolerance slippage allowed outside of the interval.
    For an interval ``[a, b]``, values
    ``a - rtol * (b - a) <= val <= b + rtol * (b - a)`` are considered
    inside the interval.

Returns
-------
bool
    Whether *val* is within the *interval* (with tolerance).
r:   )r  rc   rtolro  r7  s        r   _interval_contains_closer8  e  s=    , DAu1ET>D8s&&ah&&&&r   c                 h    U u  p#X!s=:  =(       a    U:  Os  =(       d    X!s=:  =(       a    U:  $ s  $ )a  
Check, excluding endpoints, whether an interval includes a given value.

Parameters
----------
interval : (float, float)
    The endpoints of the interval.
val : float
    Value to check is within interval.

Returns
-------
bool
    Whether *val* is within the *interval*.
r:   r4  s       r   interval_contains_openr:    s+      DA;;Q;%!++A+%+%r   c                     [         R                  " / SQUS9  US:X  a  U [        5       R                  X#5      -   $ Uc  [	        S5      eUS:X  a
  US-  nUS-  nU [        X#UR                  5      -   $ )a  
Return a new transform with an added offset.

Parameters
----------
trans : `Transform` subclass
    Any transform, to which offset will be applied.
fig : `~matplotlib.figure.Figure`, default: None
    Current figure. It can be None if *units* are 'dots'.
x, y : float, default: 0.0
    The offset to apply.
units : {'inches', 'points', 'dots'}, default: 'inches'
    Units of the offset.

Returns
-------
`Transform` subclass
    Transform with applied offset.
)dotsr   inches)unitsr<  z3For units of inches or points a fig kwarg is neededr   g      R@)r   check_in_listr  r-  rG  r  dpi_scale_trans)transfigr   r   r>  s        r   offset_copyrC    sx    ( 	35Axz++A111
{NOO	T		T	$Q3+>+>???r   )gMbP?gV瞯<T)g|=)Nr'  r'  r=  )9r   r\   r/   rN  r1   rV   r!  numpyr   numpy.linalgr   
matplotlibr   matplotlib._pathr   r   r   r  r	   r   r2   r4   r   r  r  r  r   r  r8  r   r  r  r  r  rm  r^  ra  r`  rw  r  r  rg  r  r  r   r  r  r  r  r   r  r  r2  r5  r8  r:  rC  r:   r   r   <module>rH     s  J         J J 8y yxFM} FMR ((BFFBFF+,Y?8 Y?xHXh HXVv8 vrV$ V$rKAy KA\/ /dA: AH[E| [E|/ /d+ +$ZmY Zz2m\ 2j=o4	 o4d2 2j+6'L 'T#l #L _  (   F 4l &< BD,m D,N? 67t,':&(@r   