
    h£                     ~    S r SSKrSSKJr  SSKJr  SSKrSSKr	SSK
JrJr  SSKJrJr  SSKJr   " S	 S
5      rS rg)a  
A module for dealing with the polylines used throughout Matplotlib.

The primary class for polyline handling in Matplotlib is `Path`.  Almost all
vector drawing makes use of `Path`\s somewhere in the drawing pipeline.

Whilst a `Path` instance itself cannot be drawn, some `.Artist` subclasses,
such as `.PathPatch` and `.PathCollection`, can be used for convenient `Path`
visualisation.
    N)	lru_cache)WeakValueDictionary   )_api_path)_to_unmasked_float_arraysimple_linear_interpolation)BezierSegmentc                     ^  \ rS rSrSr\R                  r\" S5      r\" S5      r	\" S5      r
\" S5      r\" S5      r\" S5      r\S\	S\
S\S\S\S0r  S:S jr\S;S j5       r\S 5       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 5       rS rS;U 4S jjr\r\S 5       r\S 5       rS r S r!   S<S jr"S  r#S! r$S=S
S
SS
S	S".S# jjr%S$ r&S>S% jr'S>S& jr(S;S' jr)S;S( jr*S?S) jr+S?S* jr,S+ r-S@S, jr.S	r/\S- 5       r0\1" 5       r2\S. 5       r3\1" 5       r4\SAS/ j5       r5\S0 5       r6S	r7\S1 5       r8\SBS2 j5       r9S	r:\S3 5       r;\SCS4 j5       r<\S;S5 j5       r=\>\?" S65      SDS7 j5       5       r@S?S8 jrAS9rBU =rC$ )EPath   u   
A series of possibly disconnected, possibly closed, line and curve
segments.

The underlying storage is made up of two parallel numpy arrays:

- *vertices*: an (N, 2) float array of vertices
- *codes*: an N-length `numpy.uint8` array of path codes, or None

These two arrays always have the same length in the first
dimension.  For example, to represent a cubic curve, you must
provide three vertices and three `CURVE4` codes.

The code types are:

- `STOP`   :  1 vertex (ignored)
    A marker for the end of the entire path (currently not required and
    ignored)

- `MOVETO` :  1 vertex
    Pick up the pen and move to the given vertex.

- `LINETO` :  1 vertex
    Draw a line from the current position to the given vertex.

- `CURVE3` :  1 control point, 1 endpoint
    Draw a quadratic Bézier curve from the current position, with the given
    control point, to the given end point.

- `CURVE4` :  2 control points, 1 endpoint
    Draw a cubic Bézier curve from the current position, with the given
    control points, to the given end point.

- `CLOSEPOLY` : 1 vertex (ignored)
    Draw a line segment to the start point of the current polyline.

If *codes* is None, it is interpreted as a `MOVETO` followed by a series
of `LINETO`.

Users of Path objects should not access the vertices and codes arrays
directly.  Instead, they should use `iter_segments` or `cleaned` to get the
vertex/code pairs.  This helps, in particular, to consistently handle the
case of *codes* being None.

Some behavior of Path objects can be controlled by rcParams. See the
rcParams whose keys start with 'path.'.

.. note::

    The vertices and codes arrays should be treated as
    immutable -- there are a number of optimizations and assumptions
    made up front in the constructor that will not change when the
    data changes.
r   r            O   NFc                    [        U5      n[        R                  " SUS9  Ub  [        U5      (       a  [        R
                  " X R                  5      nUR                  S:w  d  [        U5      [        U5      :w  a%  [        SUR                   SUR                   35      e[        U5      (       a1  US   U R                  :w  a  [        SU R                   S	US    35      eOlU(       ae  [        U5      (       aU  [        R                  " [        U5      U R                  S
9nU R                  US'   U R                  USS& U R                  US'   Xl        X l        X0l        U R#                  5         U(       aK  SU R                  R$                  l        U R                  b  SU R                  R$                  l        SU l        gSU l        g)a  
Create a new path with the given vertices and codes.

Parameters
----------
vertices : (N, 2) array-like
    The path vertices, as an array, masked array or sequence of pairs.
    Masked values, if any, will be converted to NaNs, which are then
    handled correctly by the Agg PathIterator and other consumers of
    path data, such as :meth:`iter_segments`.
codes : array-like or None, optional
    N-length array of integers representing the codes of the path.
    If not None, codes must be the same length as vertices.
    If None, *vertices* will be treated as a series of line segments.
_interpolation_steps : int, optional
    Used as a hint to certain projections, such as Polar, that this
    path should be linearly interpolated immediately before drawing.
    This attribute is primarily an implementation detail and is not
    intended for public use.
closed : bool, optional
    If *codes* is None and closed is True, vertices will be treated as
    line segments of a closed polygon.  Note that the last vertex will
    then be ignored (as the corresponding code will be set to
    `CLOSEPOLY`).
readonly : bool, optional
    Makes the path behave in an immutable way and sets the vertices
    and codes as read-only arrays.
)Nr   )verticesNr   z`'codes' must be a 1D list or array with the same length of 'vertices'. Your vertices have shape z but your codes have shape r   z7The first element of 'code' must be equal to 'MOVETO' (z).  Your first code is dtypeFT)r   r   check_shapelennpasarray	code_typendim
ValueErrorshapeMOVETOemptyLINETO	CLOSEPOLY	_vertices_codes_interpolation_steps_update_valuesflags	writeable	_readonly)selfr   codesr%   closedreadonlys         A/var/www/html/env/lib/python3.13/site-packages/matplotlib/path.py__init__Path.__init__c   s   < ,H5X6XJJunn5EzzQ#e*H"=  "==E^^<L M>>Ckk]"L M M 5zzeAh$++5  "115 >77<Qxj"B C C HHHS]$..AE{{E!H++E!BKE"I!$8!-2DNN  *{{&.3!!+!DN"DN    c                    U R                  U 5      n[        U5      Ul        X$l        SUl        Ub5  UR
                  Ul        UR                  Ul        UR                  Ul        U$ SUl        [        R                  S   Ul        SUl        U$ )a  
Create a Path instance without the expense of calling the constructor.

Parameters
----------
verts : array-like
codes : array
internals_from : Path or None
    If not None, another `Path` from which the attributes
    ``should_simplify``, ``simplify_threshold``, and
    ``interpolation_steps`` will be copied.  Note that ``readonly`` is
    never copied, and always set to ``False`` by this constructor.
FTpath.simplify_thresholdr   )
__new__r   r#   r$   r)   _should_simplify_simplify_thresholdr%   mplrcParams)clsvertsr+   internals_frompths        r.   _fast_from_codes_and_vertsPath._fast_from_codes_and_verts   s     kk#07
%#1#B#BC &4&H&HC#'5'J'JC$
 
 $(C &)ll3L&MC#'(C$
r1   c                 V    [        U5      nU " [        R                  " X"SS /5      SS9$ )z
Create a closed polygonal path going through *vertices*.

Unlike ``Path(..., closed=True)``, *vertices* should **not** end with
an entry for the CLOSEPATH; this entry is added by `._create_closed`.
Nr   T)r,   )r   r   concatenate)r9   r   vs      r.   _create_closedPath._create_closed   s,     %X.2>>1e*-d;;r1   c                 h   [         R                  S   U l        U R                  S:  =(       a    [         R                  S   =(       ae    [        U R                  5      S:  =(       aF    U R
                  S L =(       d1    [        R                  " U R
                  [        R                  :*  5      U l
        g )Nr3   r   zpath.simplify   )r7   r8   r6   r   r#   r$   r   allr   r!   r5   r*   s    r.   r&   Path._update_values   s    #&<<0I#J $$q( HLL)H3&H [[D FBFF4;;$+++E$F	 	r1   c                     U R                   $ )z.The vertices of the `Path` as an (N, 2) array.)r#   rG   s    r.   r   Path.vertices   s     ~~r1   c                 h    U R                   (       a  [        S5      eXl        U R                  5         g )Nz%Can't set vertices on a readonly Path)r)   AttributeErrorr#   r&   )r*   r   s     r.   r   rJ      s&    >> !HII!r1   c                     U R                   $ )a,  
The list of codes in the `Path` as a 1D array.

Each code is one of `STOP`, `MOVETO`, `LINETO`, `CURVE3`, `CURVE4` or
`CLOSEPOLY`.  For codes that correspond to more than one vertex
(`CURVE3` and `CURVE4`), that code will be repeated so that the length
of `vertices` and `codes` is always the same.
)r$   rG   s    r.   r+   
Path.codes   s     {{r1   c                 h    U R                   (       a  [        S5      eXl        U R                  5         g )Nz"Can't set codes on a readonly Path)r)   rL   r$   r&   )r*   r+   s     r.   r+   rN      s&    >> !EFFr1   c                     U R                   $ )zQ
The fraction of a pixel difference below which vertices will
be simplified out.
r6   rG   s    r.   simplify_thresholdPath.simplify_threshold   s     '''r1   c                     Xl         g NrQ   )r*   	thresholds     r.   rR   rS      s    #, r1   c                     U R                   $ )z4
`True` if the vertices array should be simplified.
r5   rG   s    r.   should_simplifyPath.should_simplify   s    
 $$$r1   c                     Xl         g rU   rX   )r*   rY   s     r.   rY   rZ     s     /r1   c                     U R                   $ )z$
`True` if the `Path` is read-only.
)r)   rG   s    r.   r-   Path.readonly	  s    
 ~~r1   c                 .    [         R                   " U 5      $ )zf
Return a shallow copy of the `Path`, which will share the
vertices and codes with the source `Path`.
)copyrG   s    r.   r_   	Path.copy  s    
 yyr1   c                 T   > [         R                  " [        5       U5      nSUl        U$ )zb
Return a deepcopy of the `Path`.  The `Path` will not be
readonly, even if the source `Path` is.
F)r_   deepcopysuperr)   )r*   memop	__class__s      r.   __deepcopy__Path.__deepcopy__  s#     MM%'4(r1   c                 l   UR                   u  p#nUS:w  a  [        S5      eUS-   nX%-  n[        R                  " US45      n[        R                  " X`R
                  U R                  S9nU R                  USSU2'   U R                  XSU2'   [        U5       H  n	USS2U	4   XySU2'   M     U " Xx5      $ )z
Make a compound `Path` object to draw a number of polygons with equal
numbers of sides.

.. plot:: gallery/misc/histogram_path.py

Parameters
----------
XY : (numpolys, numsides, 2) array
r   z%The third dimension of 'XY' must be 2r   r   r   N)
r   r   r   zerosfullr!   r   r   r"   range)
r9   XYnumpolysnumsidestwostridenvertsr:   r+   is
             r.   make_compound_path_from_polys"Path.make_compound_path_from_polys#  s     #%((C!8DEEA"&!%

#--@::aii"%--xA!!Q$xE)V) !5  r1   c                 0   U(       d.  [        [        R                  " SS/[        R                  S95      $ [        R                  " U Vs/ s H  o"R
                  PM     sn5      n[        R                  " [        U5      U R                  S9nSnU Hb  n[        UR
                  5      nUR                  c)  U(       a!  U R                  XE'   U R                  XES-   XV-   & OUR                  XEXV-   & XV-  nMd     X@R                  :g  nU " X7   XG   5      $ s  snf )zM
Concatenate a list of `Path`\s into a single `Path`, removing all `STOP`\s.
r   r   r   r   )r   r   r    float32r@   r   r   r   r+   r   r!   STOP)r9   argspathr   r+   rs   sizenot_stop_masks           r.   make_compound_pathPath.make_compound_path?  s    
 !Qrzz:;;>>T"BTT==T"BCXcmm<Dt}}%Dzz!"zzEH(+

EA#af%"&**IA  )8*E,@AA #Cs   
Dc                 @    SU R                   < SU R                  < S3$ )NzPath(z, ))r   r+   rG   s    r.   __repr__Path.__repr__U  s     t}}'r$**q99r1   c                 ,    [        U R                  5      $ rU   )r   r   rG   s    r.   __len__Path.__len__X  s    4==!!r1         ?c	              #     #    [        U 5      (       d  gU R                  UX#XEXgUS9n	U R                  n
U R                  n[	        U	R
                  5      n[	        U	R                  5      n[        X5       H\  u  pX:X  a    gX   S-
  nU(       a=  [        U5       H.  n[        U5        [        R                  " U[        U5      5      nM0     X4v   M^     g7f)a>  
Iterate over all curve segments in the path.

Each iteration returns a pair ``(vertices, code)``, where ``vertices``
is a sequence of 1-3 coordinate pairs, and ``code`` is a `Path` code.

Additionally, this method can provide a number of standard cleanups and
conversions to the path.

Parameters
----------
transform : None or :class:`~matplotlib.transforms.Transform`
    If not None, the given affine transformation will be applied to the
    path.
remove_nans : bool, optional
    Whether to remove all NaNs from the path and skip over them using
    MOVETO commands.
clip : None or (float, float, float, float), optional
    If not None, must be a four-tuple (x1, y1, x2, y2)
    defining a rectangle in which to clip the path.
snap : None or bool, optional
    If True, snap all nodes to pixels; if False, don't snap them.
    If None, snap if the path contains only segments
    parallel to the x or y axes, and no more than 1024 of them.
stroke_width : float, optional
    The width of the stroke being drawn (used for path snapping).
simplify : None or bool, optional
    Whether to simplify the path by removing vertices
    that do not affect its appearance.  If None, use the
    :attr:`should_simplify` attribute.  See also :rc:`path.simplify`
    and :rc:`path.simplify_threshold`.
curves : bool, optional
    If True, curve segments will be returned as curve segments.
    If False, all curves will be converted to line segments.
sketch : None or sequence, optional
    If not None, must be a 3-tuple of the form
    (scale, length, randomness), representing the sketch parameters.
N)	transformremove_nansclipsnapstroke_widthsimplifycurvessketchr   )r   cleanedNUM_VERTICES_FOR_CODErx   iterr   r+   ziprl   nextr   append)r*   r   r   r   r   r   r   r   r   r   r   rx   r   r+   curr_verticescodeextra_verticesrs   s                     r.   iter_segmentsPath.iter_segments[  s     R 4yy,,+6$((0&,	  . !% : :yy(()W]]##&x#7M|281<N~.AK$&IImT(^$LM /  %% $8s   CCc              +   H  #    SnSnU R                   " S0 UD6 GH  u  pEUc  U[        R                  :w  a  [        S5      eU[        R                  :X  a(  Un[	        [
        R                  " U/5      5      U4v   GOU[        R                  :X  a%  [	        [
        R                  " X4/5      5      U4v   OU[        R                  :X  a,  [	        [
        R                  " X4SS USS /5      5      U4v   OU[        R                  :X  a0  [	        [
        R                  " X4SS USS USS /5      5      U4v   O]U[        R                  :X  a%  [	        [
        R                  " X2/5      5      U4v   O$U[        R                  :X  a    g[        SU 35      eUSS nGM     g7f)u  
Iterate over each Bézier curve (lines included) in a `Path`.

Parameters
----------
**kwargs
    Forwarded to `.iter_segments`.

Yields
------
B : `~matplotlib.bezier.BezierSegment`
    The Bézier curves that make up the current path. Note in particular
    that freestanding points are Bézier curves of order 0, and lines
    are Bézier curves of order 1 (with two control points).
code : `~matplotlib.path.Path.code_type`
    The code describing what kind of curve is being returned.
    `MOVETO`, `LINETO`, `CURVE3`, and `CURVE4` correspond to
    Bézier curves with 1, 2, 3, and 4 control points (respectively).
    `CLOSEPOLY` is a `LINETO` with the control points correctly
    chosen based on the start/end points of the current stroke.
Nz'Malformed path, must start with MOVETO.r   r   zInvalid Path.code_type:  )r   r   r   r   r
   r   arrayr!   CURVE3CURVE4r"   rx   )r*   kwargs
first_vert	prev_vertr:   r   s         r.   iter_bezierPath.iter_bezier  s    , 
	--77KE!4;;&$%NOOt{{""
#BHHj\$:;TAA$#BHHi-?$@A4GG$#BHHir.3ABi.9 %: ;<@A A$#BHHir.3Aaj%).E %F GHLM M'#BHHi-D$EFLL" #;D6!BCCbc
I+ 8s   F F"c              #   v  #    U R                   c  U v   g[        R                  " U R                   [        R                  :H  R                  5       S   [        U R                   5      5      n[        [        XSS 5       H6  n[        R                  U R                  U   U R                   U   U 5      v   M8     g7f)z!Return subpaths split at MOVETOs.Nr   r   )r+   r   r   r   r   nonzeror   mapslicer=   r   )r*   idxssls      r.   _iter_connected_componentsPath._iter_connected_components  s     ::J99djjDKK7@@B1Es4::WD%ABx055MM"%tzz"~t= = 1s   B7B9)r   r   r   r   r   c                    [         R                  " XX#XvUXX5	      u  p[        R                  XU 5      nU(       d  SUl        U$ )z
Return a new `Path` with vertices and codes cleaned according to the
parameters.

See Also
--------
Path.iter_segments : for details of the keyword arguments.
F)r   cleanup_pathr   r=   r5   )r*   r   r   r   r   r   r   r   r   r   r+   r<   s               r.   r   Path.cleaned  sF      ,,[H --htD#(C 
r1   c                 v    [        UR                  U R                  5      U R                  U R                  5      $ )z
Return a transformed copy of the path.

See Also
--------
matplotlib.transforms.TransformedPath
    A specialized path class that will cache the transformed result and
    automatically update when the transform changes.
)r   r   r   r+   r%   )r*   r   s     r.   transformedPath.transformed  s1     I''6

--/ 	/r1   c                     Ub  UR                  5       nU(       a$  UR                  (       d  UR                  U 5      n Sn[        R                  " US   US   X0U5      $ )aZ  
Return whether the area enclosed by the path contains the given point.

The path is always treated as closed; i.e. if the last code is not
`CLOSEPOLY` an implicit segment connecting the last vertex to the first
vertex is assumed.

Parameters
----------
point : (float, float)
    The point (x, y) to check.
transform : `~matplotlib.transforms.Transform`, optional
    If not ``None``, *point* will be compared to ``self`` transformed
    by *transform*; i.e. for a correct check, *transform* should
    transform the path into the coordinate system of *point*.
radius : float, default: 0
    Additional margin on the path in coordinates of *point*.
    The path is extended tangentially by *radius/2*; i.e. if you would
    draw the path with a linewidth of *radius*, all points on the line
    would still be considered to be contained in the area. Conversely,
    negative values shrink the area: Points on the imaginary line
    will be considered outside the area.

Returns
-------
bool

Notes
-----
The current algorithm has some limitations:

- The result is undefined for points exactly at the boundary
  (i.e. at the path shifted by *radius/2*).
- The result is undefined if there is no enclosed area, i.e. all
  vertices are on a straight line.
- If bounding lines start to cross each other due to *radius* shift,
  the result is not guaranteed to be correct.
Nr   r   )frozen	is_affinetransform_pathr   point_in_path)r*   pointr   radiuss       r.   contains_pointPath.contains_point  sZ    N  !((*I
 Y00++D1DI""58U1XvYOOr1   c                 x    Ub  UR                  5       n[        R                  " XX5      nUR                  S5      $ )a  
Return whether the area enclosed by the path contains the given points.

The path is always treated as closed; i.e. if the last code is not
`CLOSEPOLY` an implicit segment connecting the last vertex to the first
vertex is assumed.

Parameters
----------
points : (N, 2) array
    The points to check. Columns contain x and y values.
transform : `~matplotlib.transforms.Transform`, optional
    If not ``None``, *points* will be compared to ``self`` transformed
    by *transform*; i.e. for a correct check, *transform* should
    transform the path into the coordinate system of *points*.
radius : float, default: 0
    Additional margin on the path in coordinates of *points*.
    The path is extended tangentially by *radius/2*; i.e. if you would
    draw the path with a linewidth of *radius*, all points on the line
    would still be considered to be contained in the area. Conversely,
    negative values shrink the area: Points on the imaginary line
    will be considered outside the area.

Returns
-------
length-N bool array

Notes
-----
The current algorithm has some limitations:

- The result is undefined for points exactly at the boundary
  (i.e. at the path shifted by *radius/2*).
- The result is undefined if there is no enclosed area, i.e. all
  vertices are on a straight line.
- If bounding lines start to cross each other due to *radius* shift,
  the result is not guaranteed to be correct.
bool)r   r   points_in_pathastype)r*   pointsr   r   results        r.   contains_pointsPath.contains_points(  s:    N  !((*I%%fdF}}V$$r1   c                 X    Ub  UR                  5       n[        R                  " U SX5      $ )z
Return whether this (closed) path completely contains the given path.

If *transform* is not ``None``, the path will be transformed before
checking for containment.
N)r   r   path_in_path)r*   rz   r   s      r.   contains_pathPath.contains_pathT  s-      !((*I!!$d>>r1   c                    SSK Jn  Ub  UR                  U 5      n U R                  c  U R                  nO[        [        R                  " U R                  [        R                  [        R                  /5      5      S:X  aM  U R                  [        R                  " U R                  [        R                  [        R                  /5         nOa/ nU R                  " S0 UD6 H3  u  pVUR                  5       u  pxUR!                  U" S/UQSP5      5        M5     [        R"                  " U5      n[        U5      (       a$  U" UR%                  SS9UR'                  SS9/5      $ UR)                  5       $ )a=  
Get Bbox of the path.

Parameters
----------
transform : `~matplotlib.transforms.Transform`, optional
    Transform to apply to path before computing extents, if any.
**kwargs
    Forwarded to `.iter_bezier`.

Returns
-------
matplotlib.transforms.Bbox
    The extents of the path Bbox([[xmin, ymin], [xmax, ymax]])
r   Bboxr   )axisr   )
transformsr   r   r+   r   r   r   intersect1dr   r   r   isinr   r!   r   axis_aligned_extremar   r@   minmaxnull)	r*   r   r   r   xyscurver   _dzeross	            r.   get_extentsPath.get_extents_  s!     	% ++D1D::--C

T[[$++,FGHAM
 --

)-dkk(B!D EC C#//9&9!668	

5!fa12	  :
 ..%Cs88a#''q'/:;;99;r1   c                 0    [         R                  " XU5      $ )z
Return whether if this path intersects another given path.

If *filled* is True, then this also returns True if one path completely
encloses the other (i.e., the paths are treated as filled).
)r   path_intersects_path)r*   otherfilleds      r.   intersects_pathPath.intersects_path  s     ))$v>>r1   c                     [         R                  " XR                  UR                  UR                  UR
                  U5      $ )z
Return whether this path intersects a given `~.transforms.Bbox`.

If *filled* is True, then this also returns True if the path completely
encloses the `.Bbox` (i.e., the path is treated as filled).

The bounding box is always considered filled.
)r   path_intersects_rectanglex0y0x1y1)r*   bboxr   s      r.   intersects_bboxPath.intersects_bbox  s2     ..''477DGGTWWf> 	>r1   c                    US:X  a  U $ [        U R                  U5      nU R                  nUbH  [        R                  " [        U5      S-
  U-  S-   [        R                  U R                  S9nX4SSU2'   OSn[        X$5      $ )zj
Return a new path resampled to length N x *steps*.

Codes other than `LINETO` are not handled correctly.
r   Nr   r   )	r	   r   r+   r   rk   r   r   r!   r   )r*   stepsr   r+   	new_codess        r.   interpolatedPath.interpolated  s|     A:K.t}}eD

Ua5 81 <dkk&*nn6I"'ahhIH((r1   c                    [        U R                  5      S:X  a  / $ Ub  UR                  5       nU R                  cu  US:X  d  US:X  ai  U R                  nU(       a>  [        U5      S:  a  / $ [        R
                  " US   US   :g  5      (       a	  / UQUS   PnUc  U/$ UR                  U5      /$ [        R                  " XX#U5      $ )u  
Convert this path to a list of polygons or polylines.  Each
polygon/polyline is an (N, 2) array of vertices.  In other words,
each polygon has no `MOVETO` instructions or curves.  This
is useful for displaying in backends that do not support
compound paths or Bézier curves.

If *width* and *height* are both non-zero then the lines will
be simplified so that vertices outside of (0, 0), (width,
height) will be clipped.

The resulting polygons will be simplified if the
:attr:`Path.should_simplify` attribute of the path is `True`.

If *closed_only* is `True` (default), only closed polygons,
with the last point being the same as the first point, will be
returned.  Any unclosed polylines in the path will be
explicitly closed.  If *closed_only* is `False`, any unclosed
polygons in the path will be returned as unclosed polygons,
and the closed polygons will be returned explicitly closed by
setting the last point to the same as the first point.
r   r   r   )	r   r   r   r+   r   anyr   r   convert_path_to_polygons)r*   r   widthheightclosed_onlyr   s         r.   to_polygonsPath.to_polygons  s    . t}}"I !((*I::5A:1}}Hx=1$IVVHQK8B<788778A;7H  z!!++H566 --UK9 	9r1   c                 l    U R                   c  U " SS/SS/SS/SS/SS//SSS9U l         U R                   $ )zG
Return a `Path` instance of the unit rectangle from (0, 0) to (1, 1).
r   r   Tr,   r-   )_unit_rectangler9   s    r.   unit_rectanglePath.unit_rectangle  sP    
 &"%1v1v1v1v1v&N-1D#BC"""r1   c                    US::  a  U R                   R                  U5      nOSnUc  S[        R                  -  U-  [        R                  " US-   5      -  [        R                  S-  -   n[        R
                  " [        R                  " U5      [        R                  " U5      45      nU " USSS9nUS::  a  X R                   U'   U$ )z
Return a :class:`Path` instance for a unit regular polygon with the
given *numVertices* such that the circumscribing circle has radius 1.0,
centered at (0, 0).
   Nr   r   Tr   )_unit_regular_polygonsgetr   piarangecolumn_stackcossin)r9   numVerticesrz   thetar:   s        r.   unit_regular_polygonPath.unit_regular_polygon  s     "--11+>DD<"%%i+-;?1KK uuqy!E OORVVE]BFF5M$BCEuTD9Db :>**;7r1   c                     US::  a  U R                   R                  X45      nOSnUc  US-  nS[        R                  -  U-  [        R                  " US-   5      -  nU[        R                  S-  -  n[        R
                  " US-   5      nX&SSS2'   U[        R                  " [        R                  " U5      [        R                  " U5      45      -  R                  nU " USSS9nUS::  a  X0R                   X4'   U$ )zr
Return a :class:`Path` for a unit regular star with the given
numVertices and radius of 1.0, centered at (0, 0).
r   Nr   r   g       @Tr   )
_unit_regular_starsr   r   r   r  onesvstackr  r  T)r9   r  innerCirclerz   ns2r  rr:   s           r.   unit_regular_starPath.unit_regular_star  s     "**../IJDD</CruuWS[299S1W#55E RUUS[ Ea A!addGBFF5M266%=#ABBEEEuTD9Db FJ''(BCr1   c                 &    U R                  US5      $ )zv
Return a :class:`Path` for a unit regular asterisk with the given
numVertices and radius of 1.0, centered at (0, 0).
        )r  )r9   r  s     r.   unit_regular_asteriskPath.unit_regular_asterisk  s     $$[#66r1   c                 `    U R                   c  U R                  SSSS9U l         U R                   $ )zs
Return the readonly :class:`Path` of the unit circle.

For most cases, :func:`Path.circle` will be what you want.
)r   r   r   T)centerr   r-   )_unit_circlecircler   s    r.   unit_circlePath.unit_circle'  s9     #"zz37  *  9Cr1   c                    Sn[         R                  " S5      nXT-  n[         R                  " SS/US/XV-
  U* U-
  /XU* /XV-   U* U-   /SU* /SS/SU/XV-   XV-
  /XU/XV-
  XV-   /US/SS/U* S/U* U-   XV-   /U* U/U* U-
  XV-
  /SU/SS/SU* /U* U-
  U* U-   /U* U* /U* U-   U* U-
  /U* S/SS/SS//[        S9nU R                  /S-  nU R
                  US'   U R                  US	'   [        Xr-  U-   XS
9$ )u6  
Return a `Path` representing a circle of a given radius and center.

Parameters
----------
center : (float, float), default: (0, 0)
    The center of the circle.
radius : float, default: 1
    The radius of the circle.
readonly : bool
    Whether the created path should have the "readonly" argument
    set when creating the Path instance.

Notes
-----
The circle is approximated using 8 cubic Bézier curves, as described in

  Lancaster, Don.  `Approximating a Circle or an Ellipse Using Four
  Bezier Cubic Splines <https://www.tinaja.com/glib/ellipse4.pdf>`_.
rSl?      ?r        r   r      r   r   r-   )r   sqrtr   floatr   r   r"   r   )	r9   r  r   r-   MAGICSQRTHALFMAGIC45r   r+   s	            r.   r  Path.circle3  s   , 773<"88c4[#T]&.	'0AB&	2&.	'0AB!E6]!3Z!5\&.0@A&1&.0@A#S\!3Z$fc]'i/1AB'i2'i/1AB"E]"C["UF^'i/(71BC'i(3'i/(71BC$fd^!4[!4[E"*F #(G#)J r!::aMMb	H%.IIr1   c                    U R                   c  Sn[        R                  " S5      nX!-  n[        R                  " SS/US/X#-
  U* U-
  /X"* /X#-   U* U-   /SU* /SS/SU/X#-   X#-
  /X"/X#-
  X#-   /US/SS/SS//[        5      n[        R
                  " SU R                  U R                  S9nU R                  US'   U R                  US	'   U " XES
S9U l         U R                   $ )zu
Return a `Path` of the right half of a unit circle.

See `Path.circle` for the reference on the approximation used.
r  r  r  r   r      r   r   r   Tr"  )
_unit_circle_righthalfr   r#  r   r$  rk   r   r   r   r"   )r9   r%  r&  r'  r   r+   s         r.   unit_circle_righthalfPath.unit_circle_righthalfy  s    %%-Ewws|H&Gxxt"XIg$56I&"XIg$56vsu"H$45%"H$45st%( +H. GGB

#--@EzzE!HE"I),Xt)LC&)))r1   c                    [         R                  S-  nUnUS[         R                  " X!-
  S-  5      -  -
  nX!:w  a
  Xv::  a  US-  n[         R                  " Xg/5      u  pgUc'  [	        S[         R
                  " Xv-
  U-  5      -  5      nUS:  a  [        S5      eXv-
  U-  n[         R                  " SU-  5      n	[         R                  " U5      [         R                  " SSU	-  U	-  -   5      S-
  -  S-  n
[         R                  " XgUS-   S	5      n[         R                  " U5      n[         R                  " U5      nUSS
 nUSS
 nU* nUnUSS nUSS nU* nUnU(       a  US-  S-   n[         R                  " US4[        5      n[         R                  " UU R                  U R                   S9nUS   US   /US'   U R"                  U R$                  /USS& U R$                  U R&                  /USS& SnUS-
  nOoUS-  S-   n[         R(                  " US4[        5      n[         R                  " UU R                  U R                   S9nUS   US   /US'   U R"                  US'   SnUnXU-  -   UUUS2S4'   XU-  -   UUUS2S4'   UU
U-  -
  UUS-   US2S4'   UU
U-  -
  UUS-   US2S4'   UUUS-   US2S4'   UUUS-   US2S4'   U " UUS	S9$ )a  
Return a `Path` for the unit circle arc from angles *theta1* to
*theta2* (in degrees).

*theta2* is unwrapped to produce the shortest arc within 360 degrees.
That is, if *theta2* > *theta1* + 360, the arc will be from *theta1* to
*theta2* - 360 and not a full circle plus some extra overlap.

If *n* is provided, it is the number of spline segments to make.
If *n* is not provided, the number of spline segments is
determined based on the delta between *theta1* and *theta2*.

   Masionobe, L.  2003.  `Drawing an elliptical arc using
   polylines, quadratic or cubic Bezier curves
   <https://web.archive.org/web/20190318044212/http://www.spaceroots.org/documents/ellipse/index.html>`_.
r  ih  Nr   r   zn must be >= 1 or Noneg      @g      @Tr   r   r   r   r   r   r"  )r   r   floordeg2radintceilr   tanr  r#  linspacer  rj   r$  rk   r   r   r   r!   r"   r    )r9   theta1theta2nis_wedgehalfpieta1eta2detatalphar   cos_etasin_etaxAyAxA_dotyA_dotxByBxB_dotyB_dotlengthr   r+   vertex_offsetends                              r.   arcPath.arc  s   $ bhh3'>??? CKDZZ-
 9A$+!7889Aq5566q FF3:tcAgk(9 :Q >?#EDAt4&&-&&-Sb\Sb\QR[QR[UQYFxxU3HGGFCJJcmmDEa5"Q%.HQK**cjj1E!AJ**cmm4E"#JM1*CUQYFxxU3HGGFCJJcmmDEa5"Q%.HQKzzE!HMC+-+>s1$a'(+-+>s1$a'(-/%&.-@qQ&)*-/%&.-@qQ&)*-/qQ&)*-/qQ&)*8UT22r1   c                 (    U R                  XUS5      $ )a   
Return a `Path` for the unit circle wedge from angles *theta1* to
*theta2* (in degrees).

*theta2* is unwrapped to produce the shortest wedge within 360 degrees.
That is, if *theta2* > *theta1* + 360, the wedge will be from *theta1*
to *theta2* - 360 and not a full circle plus some extra overlap.

If *n* is provided, it is the number of spline segments to make.
If *n* is not provided, the number of spline segments is
determined based on the delta between *theta1* and *theta2*.

See `Path.arc` for the reference on the approximation used.
T)rL  )r9   r5  r6  r7  s       r.   wedge
Path.wedge  s      wwvq$//r1      c                 (    SSK Jn  U b  U" X5      $ S$ )z
Given a hatch specifier, *hatchpattern*, generates a `Path` that
can be used in a repeated hatching pattern.  *density* is the
number of lines per unit square.
r   )get_pathN)matplotlib.hatchrS  )hatchpatterndensityrS  s      r.   hatch
Path.hatch  s$     	.+ / 	715	7r1   c                     [         R                  " XU5      nU Vs/ s H  n[        U5      PM     nnU R                  " U6 $ s  snf )z
Clip the path to the given bounding box.

The path must be made up of one or more closed polygons.  This
algorithm will not behave correctly for unclosed paths.

If *inside* is `True`, clip to the inside of the box, otherwise
to the outside of the box.
)r   clip_path_to_rectr   r}   )r*   r   insider:   polypathss         r.   clip_to_bboxPath.clip_to_bbox  sD     ''F;(-.d.&&.. /s   A)r$   r%   r)   r5   r6   r#   )Nr   FFrU   )NTNFr   NTN)NFN)Nr  )T)Nr   r   T)r  ))r  r  r   F)NF)   )D__name__
__module____qualname____firstlineno____doc__r   uint8r   rx   r   r!   r   r   r"   r   r/   classmethodr=   rB   r&   propertyr   setterr+   rR   rY   r-   r_   rg   rb   rt   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+  r,  rL  rO  staticmethodr   rW  r^  __static_attributes____classcell__)rf   s   @r.   r   r      s,   5n I Q<Dq\Fq\Fq\Fq\F"I "1#Q#Q#Q#Q&+ CD(-=#~  8 < <
   __  	 	 \\  ( ( - - % % 0 0   H! !6 B B*:" DH=A*.@&D-#^=!% uT&/0Pd*%X	?'R?
>)&-9^ O# # 12 * ./ . 7 7 L	  	  AJ AJF "'* '*R L3 L3\ 0 0" q\7  7/ /r1   r   c                     SSK Jn  [        U5      S:X  a  [        S5      e[        U5      S:X  a  [        S5      e[        R
                  " X[        R                  " U5      X45      u  pgUR                  " USU06$ )u  
Get bounding box of a `.PathCollection`\s internal objects.

That is, given a sequence of `Path`\s, `.Transform`\s objects, and offsets, as found
in a `.PathCollection`, return the bounding box that encapsulates all of them.

Parameters
----------
master_transform : `~matplotlib.transforms.Transform`
    Global transformation applied to all paths.
paths : list of `Path`
transforms : list of `~matplotlib.transforms.Affine2DBase`
    If non-empty, this overrides *master_transform*.
offsets : (N, 2) array-like
offset_transform : `~matplotlib.transforms.Affine2DBase`
    Transform applied to the offsets before offsetting the path.

Notes
-----
The way that *paths*, *transforms* and *offsets* are combined follows the same
method as for collections: each is iterated over independently, so if you have 3
paths (A, B, C), 2 transforms (α, β) and 1 offset (O), their combinations are as
follows:

- (A, α, O)
- (B, β, O)
- (C, α, O)
r   r   r   zNo paths providedzNo offsets providedminpos)	r   r   r   r   r   get_path_collection_extentsr   
atleast_3dfrom_extents)master_transformr]  r   offsetsoffset_transformr   extentsrn  s           r.   ro  ro    sq    < !
5zQ,--
7|q.//77z!:#OG g5f55r1   )re  r_   	functoolsr   weakrefr   numpyr   
matplotlibr7    r   r   cbookr   r	   bezierr
   r   ro  r   r1   r.   <module>r}     s6   	   '    H !D/ D/N &6r1   