+
     h#  c                  sv   ^ RI Ht ^ RIHtHt ^ RIHt ^ RIt^ RI	H
t
HtHt ^ RIHtHtHtHtHtHt ]'       d   ^ RIHt R R ltR	 R
 ltR R ltR R ltR R ltR R ltR R ltR R ltR R ltR R lt R R lt!R R lt"R R  lt#R! R" lt$R# R$ lt%R% R& lt&R' R( lt'R) R* lt(R+ R, lt)R- R. lt*R# )/    )annotations)chainpairwise)TYPE_CHECKINGN)check_code_arraycheck_offset_arraycheck_point_array)	CLOSEPOLYLINETOMOVETO
code_dtypeoffset_dtypepoint_dtypec                    V ^8  d   QhRRRR/# )   offsetscpy.OffsetArrayreturncpy.CodeArray Zformat   "6/usr/lib64/python3.14/site-packages/contourpy/array.py__annotate__r      s     	 	 	M 	    c                s    \        V 4       V R,          p\        P                  ! V\        \        R7      p\
        W RR &   \        W R,          ^,
          &   V# )zSDetermine codes from offsets, assuming they all correspond to closed polygons.
    ZdtypeN   NN)r   npfullr	   r   r
   r   )r   ncodes   &  r   codes_from_offsetsr#      sJ     wAGGAvZ0E E#2,&E"+/Lr   c               $    V ^8  d   QhRRRRRR/# )r   r   r   pointscpy.PointArrayr   r   r   r   r   r   r   r      s&       r   c                s.   \        V 4       \        V4       \        P                  ! \	        V4      \
        \        R7      p\        W RR &   V R,          ^,
          p\        P                  ! WRR ,          W,          8H  ^R7      p\        W#V,          &   V# )zDetermine codes from offsets and points, using the equality of the start and end points of
each line to determine if lines are closed or not.
r   Nr   Zaxisr   )
r   r   r   r   lenr	   r   r
   allr   )r   r%   r!   Zend_offsetsZcloseds   &&   r   codes_from_offsets_and_pointsr*      sx     wfGGCKz:E E#2,"+/KVVF3B<(F,??aHF!*Ef
Lr   c               r   )r   r%   r&   r   r   r   r   r   r   r   r   /   s      n  r   c                s    \        V 4       \        V 4      p\        P                  ! V\        \
        R7      p\        V^ &   \        P                  ! V ^ ,          V R,          8H  4      '       d
   \        VR&   V# )z}Determine codes for a single line, using the equality of the start and end points to
determine if the line is closed or not.
r   r   )	r   r(   r   r   r	   r   r
   r)   r   )r%   r    r!   r"   r   codes_from_pointsr+   /   sZ     fFAGGAvZ0EE!H	vvfQi6":%&&b	Lr   c               r   )r   list_of_codeslist[cpy.CodeArray]r   r   r   r   r   r   r   r   =   s     ; ; 3 ; ;r   c                `    V '       g   \        R4      h\        P                  ! V \        R7      # )zAConcatenate a list of codes arrays into a single code array.
    z!Empty list passed to concat_codesr   )
ValueErrorr   concatenater   )r,      &r   concat_codesr2   =   s$     <==>>-z::r   c               r   )r   list_of_codes_or_nonezlist[cpy.CodeArray | None]r   zcpy.CodeArray | Noner   r   r   r   r   r   F   s      0J Oc r   c                b    V  Uu. uF
  qf   K  VNK  	  ppV'       d   \        V4      # R# u upi )zQConcatenate a list of codes arrays or None into a single code array or None.
    N)r2   )r3   r!   r,   r"   r   concat_codes_or_noner5   F   s3     )>S(=uUU(=MSM**	 T   ,,c               r   r   list_of_offsetszlist[cpy.OffsetArray]r   r   r   r   r   r   r   r   P   s      $9 o r   c                s8  a a S '       g   \        R4      h\        S 4      p\        P                  ! S  Uu. uF  q"R,          NK  	  up\        R7      o\        P
                  ! S ^ ,          .VV 3R l\        V^,
          4       4       O5\        R7      pV# u upi )zEConcatenate a list of offsets arrays into a single offset array.
    z#Empty list passed to concat_offsetsr   c              3  sn   <"   T F*  pSV^,           ,          R,          SV,          ,           x  K,  	  R# 5i)r   r   Nr   ).0Zi
cumulativer8   s   & r   	<genexpr>Z!concat_offsets.<locals>.<genexpr>Y   s-     \Q[Aqs3B7*Q-GGQ[s   25r   )r/   r(   r   cumsumr   r0   Zrange)r8   r    r   Zretr:   s   f   @r   concat_offsetsr=   P   s     >??OAGGBKKG|\J>>		]\QVWXYZWZQ[\]C J Hs   Bc               r   )r   list_of_offsets_or_nonezlist[cpy.OffsetArray | None]r   zcpy.OffsetArray | Noner   r   r   r   r   r   _   s     	 	9		r   c                r4   )zUConcatenate a list of offsets arrays or None into a single offset array or None.
    N)r=   )r>   r   r8   r"   r   concat_offsets_or_noner?   _   s4    
 /F].E7ww.EO]o..	 ^r6   c               r   r   list_of_pointslist[cpy.PointArray]r   r&   r   r   r   r   r   r   k   s     = ="6 => =r   c                r.   )zBConcatenate a list of point arrays into a single point array.
    z"Empty list passed to concat_pointsr   )r/   r   r0   r   )rA   r1   r   concat_pointsrC   k   s$     =>>>>.<<r   c               r   r   list_of_points_or_nonezlist[cpy.PointArray | None]r   zcpy.PointArray | Noner   r   r   r   r   r   t   s     	 	7		r   c                r4   )zRConcatenate a list of point arrays or None into a single point array or None.
    N)rC   rE   r%   rA   r"   r   concat_points_or_nonerG   t   s4    
 ,BX+Aff+ANX^,,	 Yr6   c               r   rD   r   r   r   r   r   r      s     
 
7

r   c                r4   )znConcatenate a list of points or None into a single point array or None, with NaNs used to
separate each line.
N)concat_points_with_nanrF   r"   r   concat_points_or_none_with_nanrI      s4     ,BX+Aff+ANX%n55	 Yr6   c               r   r@   r   r   r   r   r   r      s     - -+? -N -r   c                s"  a V '       g   \        R4      h\        V 4      ^8X  d
   V ^ ,          # \        P                  ! R\        P                  \
        R7      oV ^ ,          .\        \        V3R lV R,           4       !  4      Op \        V 4      # )zaConcatenate a list of points into a single point array with NaNs used to separate each line.
    z+Empty list passed to concat_points_with_nanr   c              3  s,   <"   T F	  pSV3x  K  	  R # 5i)Nr   )r9   Zx
nan_spacers   & r   r;   Z)concat_points_with_nan.<locals>.<genexpr>   s     'TASAQASs   r   )r   r   )	r/   r(   r   r   nanr   Zlistr   rC   )rA   rJ   s   &@r   rH   rH      s|     FGG
>aa  WWVRVV;?
(+ X'TPRAS'T UVX^,,r   c               s$    V ^8  d   QhRRRRRR/# )r   r%   r&   r   r   r   r   r   r   r   r   r      s&     U U. U? U~ Ur   c                s8   \        V 4       \        V4       \        V4      ^8:  d   V # \        P                  ! \        P
                  \        P
                  .\        R7      p\        P                  ! W^R P                  \        P                  4      V^ R7      # )zNInsert NaNs into a point array at locations specified by an offset array.
    r   r'   r   )
r   r   r(   r   arrayrK   r   ZinsertastypeZint64)r%   r   rJ   s   && r   insert_nan_at_offsetsrN      sk     fw
7|qXXrvvrvv.kB
yy2!5!5bhh!?RSTTr   c               r   )r   r!   r   r   r   r   r   r   r   r   r      s     V Vm V Vr   c                s    \        V 4       \        P                  ! \        P                  ! V \        8H  4      ^ ,          \        V 4      4      P                  \        4      # )zBDetermine offsets from codes using locations of MOVETO codes.
    )r   r   Zappendnonzeror
   r(   rM   r   )r!   r1   r   offsets_from_codesrP      s>     U99RZZ03SZ@GGUUr   c               r   )r   rA   rB   r   r   r   r   r   r   r   r      s     W W)= W/ Wr   c           	     s    V '       g   \        R4      h\        P                  ! ^ .V  Uu. uF  p\        V4      NK  	  up,           \        R7      # u upi )z4Determine offsets from lengths of point arrays.
    z)Empty list passed to offsets_from_lengthsr   r/   r   r<   r(   r   )rA   Zline   & r   offsets_from_lengthsrS      sA     DEE99aS.A.$CI.AAVVAs   A
c               r   )r   r,   r-   r   r   r   r   r   r   r   r      s     ) )4G )O )r   c           
     s    V '       g   \        R4      h\        P                  ! ^ .V  Uu. uF   p\        P                  ! V\        8H  4      NK"  	  up,           \
        R7      # u upi )zHDetermine outer offsets from codes using locations of MOVETO codes.
    z5Empty list passed to outer_offsets_from_list_of_codesr   )r/   r   r<   Zcount_nonzeror
   r   )r,   r!   rR   r    outer_offsets_from_list_of_codesrT      sQ     PQQ99aS=Y=%B,,Uf_==YY') )Ys   &A#
c               r   r7   r   r   r   r   r   r      s      ` `8M `Ra `r   c           	     s    V '       g   \        R4      h\        P                  ! ^ .V  Uu. uF  p\        V4      ^,
          NK  	  up,           \        R7      # u upi )z4Determine outer offsets from a list of offsets.
    z7Empty list passed to outer_offsets_from_list_of_offsetsr   rQ   )r8   r   rR   r   "outer_offsets_from_list_of_offsetsrU      sH     RSS99aS/J/wCLNN/JJR^__Js   A
c               r   )r   r%   r&   r   z&tuple[cpy.PointArray, cpy.OffsetArray]r   r   r   r   r   r      s      ~ *P r   c                s   \        V 4       \        P                  ! \        P                  ! V R,          4      4      ^ ,          p\	        V4      ^ 8X  d*   V \        P
                  ! ^ \	        V 4      .\        R7      3# \        P                  ! W^ R7      p V\        P                  ! \	        V4      4      ,          p\        P                  ! \	        V4      ^,           \        R7      p^ V^ &   W^R% \	        V 4      VR&   W3# )z^Remove NaN from a points array, also return the offsets corresponding to the NaN removed.
    r   r'   :NNNr    r   )
r   r   rO   isnanr(   rL   r   ZdeleteZarangeZempty)r%   nan_offsetsr   r"   r   
remove_nanrY      s     f**RXXfTl34Q7K
;1rxxCK 0EEE6Q7ryy[!122#%88C,<Q,>l#S
#"&kr   c               r$   )r   r!   r   r   r   r   r-   r   r   r   r   r   r      s"     	 	- 	/ 	Na 	r   c                    \        V 4       \        V4       \        V4      ^8  d   \        P                  ! W^R 4      # V .# )z]Split a code array at locations specified by an offset array into a list of code arrays.
    r   )r   r   r(   r   split)r!   r      &&r   split_codes_by_offsetsr]      s<     Uw
7|axxq}--wr   c               r$   )r   r%   r&   r   r   r   rB   r   r   r   r   r   r      s&       r   c                rZ   )z_Split a point array at locations specified by an offset array into a list of point arrays.
    r   )r   r   r(   r   r[   )r%   r   r\   r   split_points_by_offsetsr^      s<     fw
7|axx"..xr   c               r   )r   r%   r&   r   rB   r   r   r   r   r   r      s     
A 
A 
A3G 
Ar   c                sR   \        V 4       \        P                  ! \        P                  ! V R,          4      4      ^ ,          p\	        V4      ^ 8X  d   V .# \        P
                  ! R.V\	        V 4      .34      p\        V4       UUu. uF  w  r#W^,           V NK  	  upp# u uppi )z>Split a points array at NaNs into a list of point arrays.
    rV   r   )r   r   rO   rW   r(   r0   r   )r%   rX   ZsZes   &   r   split_points_at_nanr_      s     f**RXXfTl34Q7K
;1xnnrdK#f+%GH*2;*?@*?$!s1*?@@@s   	B#)+Z
__future__r   Z	itertoolsr   r   Ztypingr   Znumpyr   Zcontourpy.typecheckr   r   r   Zcontourpy.typesr   r	   r
   r   r   r   Zcontourpy._contourpyZ
_contourpyZcpyr#   r*   r+   r2   r5   r=   r?   rC   rG   rI   rH   rN   rP   rS   rT   rU   rY   r]   r^   r_   r   r   r   <module>r`      s    " %    W W \ \&	(;	=	
-UVW)`$	
Ar   