ó
    sñ:i#  ã                  óz  • S SK Jr  S SKJrJr  S SKJr  S SKrS SK	J
r
JrJr  S SKJrJrJrJrJrJr  \(       a  S SKJ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!S j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&S j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*g),é    )Úannotations)ÚchainÚpairwise)ÚTYPE_CHECKINGN)Úcheck_code_arrayÚcheck_offset_arrayÚcheck_point_array)Ú	CLOSEPOLYÚLINETOÚMOVETOÚ
code_dtypeÚoffset_dtypeÚpoint_dtypec                ó”   • [        U 5        U S   n[        R                  " U[        [        S9n[
        X SS '   [        X SS S-
  '   U$ )zSDetermine codes from offsets, assuming they all correspond to closed polygons.
    éÿÿÿÿ©ÚdtypeNé   )r   ÚnpÚfullr   r   r   r
   )ÚoffsetsÚnÚcodess      ÚR/srv/projetos/modelo_ml_acdoc/venv/lib/python3.13/site-packages/contourpy/array.pyÚcodes_from_offsetsr      sL   € ô �wÔà�‰€AÜ�GŠG�A”v¤ZÑ0€EÜ €E�#�2ˆ,ÑÜ&€E�!�"ˆ+˜‰/ÑØ€Ló    c                óú   • [        U 5        [        U5        [        R                  " [	        U5      [
        [        S9n[        X SS '   U SS S-
  n[        R                  " XSS    X   :H  SS9n[        X#U   '   U$ )zŽDetermine 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   r   ©Úaxis)
r   r	   r   r   Úlenr   r   r   Úallr
   )r   Úpointsr   Úend_offsetsÚcloseds        r   Úcodes_from_offsets_and_pointsr%      sz   € ô �wÔÜ�fÔä�GŠG”C˜“K¤¬zÑ:€EÜ €E�#�2ˆ,Ñà˜!˜"�+ ‘/€KÜ�VŠV�F 3 B˜<Ñ(¨FÑ,?Ñ?ÀaÑH€FÜ!*€E�fÑ
Ñà€Lr   c                óÚ   • [        U 5        [        U 5      n[        R                  " U[        [
        S9n[        US'   [        R                  " U S   U S   :H  5      (       a	  [        US'   U$ )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   s      r   Úcodes_from_pointsr'   /   sZ   € ô �fÔäˆF‹€AÜ�GŠG�A”v¤ZÑ0€EÜ€Eˆ!�HÜ	‡v‚vˆf�Q‰i˜6 "™:Ñ%×&Ñ&Üˆˆb‰	Ø€Lr   c                óX   • U (       d  [        S5      e[        R                  " U [        S9$ )zAConcatenate a list of codes arrays into a single code array.
    z!Empty list passed to concat_codesr   )Ú
ValueErrorr   Úconcatenater   )Úlist_of_codess    r   Úconcat_codesr,   =   s$   € ö ÜÐ<Ó=Ð=ä�>Š>˜-¬zÑ:Ð:r   c                ó^   • U  Vs/ s H	  oc  M  UPM     nnU(       a  [        U5      $ gs  snf )zQConcatenate a list of codes arrays or None into a single code array or None.
    N)r,   )Úlist_of_codes_or_noner   r+   s      r   Úconcat_codes_or_noner/   F   s1   € ñ )>ÓSÒ(=˜u—UÑ(=€MÐSÞÜ˜MÓ*Ð*àùò	 Tó   …*�*c                ó  ^ ^• T (       d  [        S5      e[        T 5      n[        R                  " T  Vs/ s H  o"S   PM	     sn[        S9m[        R
                  " T S   /UU 4S j[        US-
  5       5       Q7[        S9nU$ s  snf )zEConcatenate a list of offsets arrays into a single offset array.
    z#Empty list passed to concat_offsetsr   r   r   c              3  óF   >#   • U  H  nTUS -      S S TU   -   v •  M     g7f)r   N© )Ú.0ÚiÚ
cumulativeÚlist_of_offsetss     €€r   Ú	<genexpr>Ú!concat_offsets.<locals>.<genexpr>Y   s,   øé € Ð\ÒQ[ÈA˜¨q°©sÑ3°A°BÐ7¸*ÀQ¹-ÖGÒQ[ùs   ƒ!r   )r)   r    r   Úcumsumr   r*   Úrange)r7   r   r   Úretr6   s   `   @r   Úconcat_offsetsr=   P   s€   ù€ ö ÜÐ>Ó?Ð?äˆOÓ€AÜ—’±ÓG²¨G BœK±ÑGÌ|Ñ\€JÜŸ>š>Ø	˜Ñ	Ð]Õ\ÔQVÐWXÐYZÑWZÔQ[Ó\Ñ]Üñ€Cð €Jùò Hs   ´Bc                ó^   • U  Vs/ s H	  oc  M  UPM     nnU(       a  [        U5      $ gs  snf )zUConcatenate a list of offsets arrays or None into a single offset array or None.
    N)r=   )Úlist_of_offsets_or_noner   r7   s      r   Úconcat_offsets_or_noner@   _   s2   € ñ
 /FÓ]Ò.E 7—wÑ.E€OÐ]ÞÜ˜oÓ.Ð.àùò	 ^r0   c                óX   • U (       d  [        S5      e[        R                  " U [        S9$ )zBConcatenate a list of point arrays into a single point array.
    z"Empty list passed to concat_pointsr   )r)   r   r*   r   )Úlist_of_pointss    r   Úconcat_pointsrC   k   s$   € ö ÜÐ=Ó>Ð>ä�>Š>˜.´Ñ<Ð<r   c                ó^   • U  Vs/ s H	  oc  M  UPM     nnU(       a  [        U5      $ gs  snf )zRConcatenate a list of point arrays or None into a single point array or None.
    N)rC   ©Úlist_of_points_or_noner"   rB   s      r   Úconcat_points_or_nonerG   t   s2   € ñ
 ,BÓXÒ+A —fÑ+A€NÐXÞÜ˜^Ó,Ð,àùò	 Yr0   c                ó^   • U  Vs/ s H	  oc  M  UPM     nnU(       a  [        U5      $ gs  snf )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_nanrE   s      r   Úconcat_points_or_none_with_nanrJ   €   s2   € ñ ,BÓXÒ+A —fÑ+A€NÐXÞÜ% nÓ5Ð5àùò	 Yr0   c           	     óþ   ^• U (       d  [        S5      e[        U 5      S:X  a  U S   $ [        R                  " S[        R                  [
        S9mU S   /[        [        U4S jU SS  5       6 5      Qn [        U 5      $ )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   r   )r   é   r   c              3  ó,   >#   • U  H	  nTU4v •  M     g 7f)Nr3   )r4   ÚxÚ
nan_spacers     €r   r8   Ú)concat_points_with_nan.<locals>.<genexpr>˜   s   øé € Ð'TÒAS¸A¨°Q­ÒASùs   ƒN)	r)   r    r   r   Únanr   Úlistr   rC   )rB   rO   s    @r   rI   rI   �   s   ø€ ö ÜÐFÓGÐGä
ˆ>Ó˜aÓØ˜aÑ Ð ä—W’W˜V¤R§V¡V´;Ñ?ˆ
Ø(¨Ñ+ð XÜ¤Ô'TÀÐPQÐPRÑASÓ'TÐ UÓVðXˆä˜^Ó,Ð,r   c                ó*  • [        U 5        [        U5        [        U5      S::  a  U $ [        R                  " [        R
                  [        R
                  /[        S9n[        R                  " XSS R                  [        R                  5      USS9$ )zNInsert NaNs into a point array at locations specified by an offset array.
    rL   r   r   r   r   r   )
r	   r   r    r   ÚarrayrQ   r   ÚinsertÚastypeÚint64)r"   r   rO   s      r   Úinsert_nan_at_offsetsrX   œ   sk   € ô �fÔÜ�wÔä
ˆ7ƒ|�qÓØˆä—X’XœrŸv™v¤r§v¡vÐ.´kÑBˆ
ä�yŠy˜¨¨2 ×!5Ñ!5´b·h±hÓ!?ÀÐRSÑTÐTr   c                óº   • [        U 5        [        R                  " [        R                  " U [        :H  5      S   [        U 5      5      R                  [        5      $ )zBDetermine offsets from codes using locations of MOVETO codes.
    r   )r   r   ÚappendÚnonzeror   r    rV   r   )r   s    r   Úoffsets_from_codesr\   ª   s>   € ô �UÔä�9Š9”R—Z’Z ¬¡Ó0°Ñ3´S¸³ZÓ@×GÑGÌÓUÐUr   c           	     óž   • U (       d  [        S5      e[        R                  " S/U  Vs/ s H  n[        U5      PM     sn-   [        S9$ s  snf )z4Determine offsets from lengths of point arrays.
    z)Empty list passed to offsets_from_lengthsr   r   ©r)   r   r:   r    r   )rB   Úlines     r   Úoffsets_from_lengthsr`   ²   sA   € ö ÜÐDÓEÐEä�9Š9�a�S±.ÓA².¨$œC žI±.ÑAÑAÌÑVÐVùÒAs   ©A

c           
     óÂ   • U (       d  [        S5      e[        R                  " S/U  Vs/ s H   n[        R                  " U[        :H  5      PM"     sn-   [
        S9$ s  snf )zHDetermine outer offsets from codes using locations of MOVETO codes.
    z5Empty list passed to outer_offsets_from_list_of_codesr   r   )r)   r   r:   Úcount_nonzeror   r   )r+   r   s     r   Ú outer_offsets_from_list_of_codesrc   »   sQ   € ö ÜÐPÓQÐQä�9Š9�a�SÉ=ÓYÊ=À%œB×,Ò,¨U´f©_Ö=É=ÑYÑYÜ'ñ)ð )ùÒYs   ©'A
c           	     ó¤   • U (       d  [        S5      e[        R                  " S/U  Vs/ s H  n[        U5      S-
  PM     sn-   [        S9$ s  snf )z4Determine outer offsets from a list of offsets.
    z7Empty list passed to outer_offsets_from_list_of_offsetsr   r   r   r^   )r7   r   s     r   Ú"outer_offsets_from_list_of_offsetsre   Å   sF   € ö ÜÐRÓSÐSä�9Š9�a�S¹/ÓJº/¨wœC ›L¨œN¹/ÑJÑJÔR^Ñ_Ð_ùÒJs   ©A
c                óÖ  • [        U 5        [        R                  " [        R                  " U SS2S4   5      5      S   n[	        U5      S:X  a&  U [        R
                  " S[	        U 5      /[        S94$ [        R                  " XSS9n U[        R                  " [	        U5      5      -  n[        R                  " [	        U5      S-   [        S9nSUS'   XSS& [	        U 5      US'   X4$ )z^Remove NaN from a points array, also return the offsets corresponding to the NaN removed.
    Nr   r   r   rL   r   r   )
r	   r   r[   Úisnanr    rT   r   ÚdeleteÚarangeÚempty)r"   Únan_offsetsr   s      r   Ú
remove_nanrl   Î   sÅ   € ô �fÔä—*’*œRŸXšX fªQ°¨T¡lÓ3Ó4°QÑ7€KÜ
ˆ;Ó˜1ÓØ”r—x’x ¤C¨£KÐ 0¼ÑEÐEÐEä—’˜6°QÑ7ˆØ”r—y’y¤ [Ó!1Ó2Ñ2ˆÜ#%§8¢8¬C°Ó,<¸QÑ,>ÄlÑ#SˆØˆ�‰
Ø#��"ˆÜ˜&“kˆ�‰ØˆÐr   c                ó„   • [        U 5        [        U5        [        U5      S:”  a  [        R                  " XSS 5      $ U /$ )z]Split a code array at locations specified by an offset array into a list of code arrays.
    rL   r   r   )r   r   r    r   Úsplit)r   r   s     r   Úsplit_codes_by_offsetsro   à   s<   € ô �UÔÜ�wÔä
ˆ7ƒ|�aÓÜ�xŠx˜ q¨˜}Ó-Ð-àˆwˆr   c                ó„   • [        U 5        [        U5        [        U5      S:”  a  [        R                  " XSS 5      $ U /$ )z_Split a point array at locations specified by an offset array into a list of point arrays.
    rL   r   r   )r	   r   r    r   rn   )r"   r   s     r   Úsplit_points_by_offsetsrq   ì   s<   € ô �fÔÜ�wÔä
ˆ7ƒ|�aÓÜ�xŠx˜¨¨" Ó.Ð.àˆxˆr   c                óB  • [        U 5        [        R                  " [        R                  " U SS2S4   5      5      S   n[	        U5      S:X  a  U /$ [        R
                  " S/U[	        U 5      /45      n[        U5       VVs/ s H  u  p#XS-   U PM     snn$ s  snnf )z>Split a points array at NaNs into a list of point arrays.
    Nr   r   r   )r	   r   r[   rg   r    r*   r   )r"   rk   ÚsÚes       r   Úsplit_points_at_nanru   û   sŠ   € ô �fÔä—*’*œRŸXšX fªQ°¨T¡lÓ3Ó4°QÑ7€KÜ
ˆ;Ó˜1ÓØˆxˆä—n’n r d¨K¼#¸f»+¸Ð%GÓHˆÜ*2°;Ô*?Ô@Ò*?¡$ !�˜‘s˜1“Ñ*?Ò@Ð@ùÓ@s   ÂB)r   úcpy.OffsetArrayÚreturnúcpy.CodeArray)r   rv   r"   úcpy.PointArrayrw   rx   )r"   ry   rw   rx   )r+   úlist[cpy.CodeArray]rw   rx   )r.   zlist[cpy.CodeArray | None]rw   zcpy.CodeArray | None)r7   zlist[cpy.OffsetArray]rw   rv   )r?   zlist[cpy.OffsetArray | None]rw   zcpy.OffsetArray | None)rB   úlist[cpy.PointArray]rw   ry   )rF   zlist[cpy.PointArray | None]rw   zcpy.PointArray | None)r"   ry   r   rv   rw   ry   )r   rx   rw   rv   )rB   r{   rw   rv   )r+   rz   rw   rv   )r"   ry   rw   z&tuple[cpy.PointArray, cpy.OffsetArray])r   rx   r   rv   rw   rz   )r"   ry   r   rv   rw   r{   )r"   ry   rw   r{   )+Ú
__future__r   Ú	itertoolsr   r   Útypingr   Únumpyr   Úcontourpy.typecheckr   r   r	   Úcontourpy.typesr
   r   r   r   r   r   Úcontourpy._contourpyÚ
_contourpyÚcpyr   r%   r'   r,   r/   r=   r@   rC   rG   rJ   rI   rX   r\   r`   rc   re   rl   ro   rq   ru   r3   r   r   Ú<module>r…      sð   ðÝ "ç %Ý  ã ç WÑ Wß \× \æÝ&ô	ðØðàðð ôô(ô;ôôð	Ø9ð	àô	ô=ð	Ø7ð	àô	ð
Ø7ð
àô
ô-ôUôVôWô)ô`ôô$	ðØðàðð ôõ
Ar   