ó
    oñ:i 0  ã                   óh  •  S SK r \ R                  rS SKJr  S SKJ	r	  S SK
r
S SKJrJrJr  S/r\ R                   \ R"                  " \ R$                  5      \ R&                  " \ R(                  \ R*                  \ R*                  \ R*                  \ R*                  S9\ R&                  " \ R*                  \ R*                  S9S	 5       5       5       5       r\ R&                  " \ R*                  \ R*                  \ R*                  \ R*                  S
9S 5       r\ R                   \ R&                  " \ R$                  \ R$                  \ R$                  \ R(                  \ R(                  \ R(                  \ R(                  \ R*                  \ R*                  \ R*                  \ R*                  S9S 5       5       r\ R&                  " \ R$                  \ R$                  \ R$                  \ R*                  \ R*                  \ R*                  S9S 5       r\\\\4   \4   r\ R&                  " \ R$                  \ R$                  S9  S0S\\\      S\S\S\\\S4      4S jj5       r\	" S/ SQ5      r\ R&                  " S10 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&\ R$                  _S'\ R*                  _S(\ R*                  _S)\ R*                  _S*\ R*                  _S+\ R*                  _S,\ R*                  _6S0S- j5       rS. r \!S/:X  a  \ " 5         gg! \\4 a
    S SKJ r    GNªf = f)2é    N)Úcython)ÚsplitCubicAtTC)Ú
namedtuple)ÚListÚTupleÚUnionÚquadratic_to_curves)Ú	toleranceÚp0Úp1Úp2Úp3)ÚmidÚderiv3c                 óü   • [        U5      U::  a  [        U5      U::  a  gU SX-   -  -   U-   S-  n[        U5      U:”  a  gX2-   U-
  U -
  S-  n[        X U-   S-  XV-
  XT5      =(       a    [        XUU-   X#-   S-  X45      $ )a\  Check if a cubic Bezier lies within a given distance of the origin.

"Origin" means *the* origin (0,0), not the start of the curve. Note that no
checks are made on the start and end positions of the curve; this function
only checks the inside of the curve.

Args:
    p0 (complex): Start point of curve.
    p1 (complex): First handle of curve.
    p2 (complex): Second handle of curve.
    p3 (complex): End point of curve.
    tolerance (double): Distance from origin.

Returns:
    bool: True if the cubic Bezier ``p`` entirely lies within a distance
    ``tolerance`` of the origin, False otherwise.
Té   g      À?Fç      à?)ÚabsÚcubic_farthest_fit_inside)r   r   r   r   r
   r   r   s          ÚX/srv/projetos/modelo_ml_acdoc/venv/lib/python3.13/site-packages/fontTools/qu2cu/qu2cu.pyr   r   (   s™   € ô: ˆ2ƒw�)Ó¤ B£¨9Ó 4Øð ��R‘W‘Ñ Ñ" eÑ
+€CÜ
ˆ3ƒx�)ÓØØ‰g˜‰l˜RÑ 5Ñ(€FÜ$Ø
�"‰W˜‰O˜S™\¨3ó÷ Wä
# C¨v©¸¹À3±ÈÓ
VðWó    ©r   r   r   Úp1_2_3c                 ó0   • US-  nU U S-  U-   US-  U-   U4$ )zAGiven a quadratic bezier curve, return its degree-elevated cubic.gUUUUUUå?gUUUUUUÕ?© r   s       r   Úelevate_quadraticr   R   s5   € ð �5‰\€Fà
Ø	ˆu‰˜Ñ	Ø	ˆu‰˜Ñ	Ø
ð	ð r   )ÚstartÚnÚkÚ
prod_ratioÚ	sum_ratioÚratioÚtr   r   r   r   c                 óì  • SnSnS/n[        SU5       Hd  nXU-      nXU-   S-
     nUS   US   :X  d   e[        US   US   -
  5      [        US   US   -
  5      -  n	X9-  nXC-  nUR                  U5        Mf     USS  V
s/ s H  oªU-  PM	     nn
X   S   nX   S   nXU-   S-
     S   nXU-   S-
     S   nX¼U-
  U(       a  US   OS-  -   nXíU-
  U(       a  SUS   -
  OS-  -   nX¼XÞ4nXõ4$ s  sn
f )z}Give a cubic-Bezier spline, reconstruct one cubic-Bezier
that has the same endpoints and tangents and approxmates
the spline.g      ð?é   r   r   é   Néÿÿÿÿ)Úranger   Úappend)Úcurvesr   r   r    r!   Útsr   ÚckÚc_beforer"   r#   r   r   r   r   Úcurves                   r   Úmerge_curvesr/   e   sQ  € ð( €JØ€IØ
ˆ€BÜ�1�aŽ[ˆØ˜A‘IÑˆØ !™) a™-Ñ(ˆð �!‰u˜ ™Ó#Ð#Ð#Ü�B�q‘E˜B˜q™E‘MÓ"¤S¨°!©°xÀ±{Ñ)BÓ%CÑCˆàÑˆ
ØÑˆ	Ø
�	‰	�)Öñ ð "$ C R¡Ó	)¢˜AˆiŒ-¡€BÐ	)à	‰�qÑ	€BØ	‰�qÑ	€BØ	˜‘	˜A‘Ñ	˜qÑ	!€BØ	˜‘	˜A‘Ñ	˜qÑ	!€Bð 
�B‰w¦B˜2˜aš5¨AÑ.Ñ	.€BØ	�B‰w®2˜A  2¡šJ°1Ñ5Ñ	5€Bà�RÐ€Eàˆ9Ðùò 
*s   ÂC1)ÚcountÚnum_offcurvesÚiÚoff1Úoff2Úonc                 óÆ   • [        U 5      nSn[        U 5      S-
  n[        SU5       H5  nX   nXS-      nXVU-
  S-  -   nUR                  US-   U-   U5        US-  nM7     U$ )Nr   r&   r%   r   )ÚlistÚlenr(   Úinsert)ÚpÚqr0   r1   r2   r3   r4   r5   s           r   Úadd_implicit_on_curvesr<   š   sy   € ô 	ˆQ‹€AØ€EÜ˜“F˜Q‘J€MÜ�1�mÖ$ˆØ‰tˆØ�Q‘‰xˆØ˜D‘[ CÑ'Ñ'ˆØ	�‰��Q‘˜‘ Ô#Ø�‰
Šñ %ð €Hr   )ÚcostÚ
is_complexÚquadsÚmax_errÚ	all_cubicÚreturn.c                 ó”  • [        U S   S   5      [        L nU(       d3  U  VVVs/ s H"  oD VVs/ s H  u  pV[        XV5      PM     snnPM$     n nnnU S   S   /nS/nSn	U  H›  nUS   US   :X  d   e[        [        U5      S-
  5       H*  n
U	S-  n	UR	                  U	5        UR	                  U	5        M,     [        U5      SS nUR                  5         UR                  U5        U	S-  n	UR	                  U	5        M�     [        XxX5      nU(       d"  U Vs/ s H  n[        S U 5       5      PM     nnU$ s  snnf s  snnnf s  snf )aÀ  Converts a connecting list of quadratic splines to a list of quadratic
and cubic curves.

A quadratic spline is specified as a list of points.  Either each point is
a 2-tuple of X,Y coordinates, or each point is a complex number with
real/imaginary components representing X,Y coordinates.

The first and last points are on-curve points and the rest are off-curve
points, with an implied on-curve point in the middle between every two
consequtive off-curve points.

Returns:
    The output is a list of tuples of points. Points are represented
    in the same format as the input, either as 2-tuples or complex numbers.

    Each tuple is either of length three, for a quadratic curve, or four,
    for a cubic curve.  Each curve's last point is the same as the next
    curve's first point.

Args:
    quads: quadratic splines

    max_err: absolute error tolerance; defaults to 0.5

    all_cubic: if True, only cubic curves are generated; defaults to False
r   r%   r'   r&   Nc              3   óP   #   • U  H  oR                   UR                  4v •  M     g 7f©N)ÚrealÚimag)Ú.0Úcs     r   Ú	<genexpr>Ú&quadratic_to_curves.<locals>.<genexpr>ë   s   é € Ð8²%¨QŸ™ §¡Õ(²%ùs   ‚$&)
ÚtypeÚcomplexr(   r8   r)   r<   ÚpopÚextendÚspline_to_curvesÚtuple)r?   r@   rA   r>   r:   ÚxÚyr;   Úcostsr=   r2   Úqqr*   r.   s                 r   r	   r	   ²   s8  € ôF �e˜A‘h˜q‘kÓ"¤gÐ-€JÞÙ:?Õ@º%°Q¨aÔ0ªa¡F Q”'˜!–-©aÕ0¹%ˆÒ@à	ˆq‰�!‰ˆ€AØˆC€EØ€DÛˆØ�‰u˜˜!™‹}Ðˆ}Ü”s˜1“v ‘zÖ"ˆAØ�A‰IˆDØ�L‰L˜ÔØ�L‰L˜Öñ #ô $ AÓ& q rÐ*ˆØ�	‰	ŒØ	�‰�ŒØ�‰	ˆØ�‰�TÖñ ô ˜a¨Ó;€FæÙFLÓMÂf¸U”%Ñ8±%Ó8Ö8ÁfˆÐMØ€Mùó+ 1ùÔ@ùò( Ns   ¥
D>¯D8ÁD>ÄEÄ8D>ÚSolution)Ú
num_pointsÚerrorÚstart_indexÚis_cubicr2   Újr   r   Úi_sol_countÚj_sol_countÚthis_sol_countr
   ÚerrrX   Úi_sol_errorÚj_sol_errorrZ   r0   r   r   r   r   ÚvÚuc           
      óz  • [        U 5      S:¼  d   S5       e[        S[        U 5      S-
  S5       Vs/ s H  n[        XUS-    6 PM     nn[        5       n[        S[        U5      5       H[  nXTS-
     S   nXT   S   nXT   S   n	[	        X‡-
  5      [	        X˜-
  5      -   U[	        X—-
  5      -   :”  d  MJ  UR                  U5        M]     [        SSSS5      /n
[        [        U5      S-  S-   SSS5      nSn[        S[        U5      S-   5       GH¦  nUn[        XÄ5       GHu  nX®   R                  X®   R                  nnU(       d>  USU-  S-
     USU-     -
  S-   nUU-   nUn[        UUXN-
  S5      nUU:  a  UnUS::  a  Me   [        X^XN-
  5      u  nn[        / UQUQ76 n/ nSn[        U5       HF  u  nnX^U-      n[	        US   US   -
  5      n[        UU5      nUU:”  a    OUR                  U5        MH     UU:”  a  Må  [        U5       HG  u  nnX^U-      n[        S [!        UU5       5       5      u  pxn	n[#        XxU	UU5      (       a  MB  US-   n  O   UU:”  a  GMD  US-   n[        UU5      n[        UUXN-
  S5      nUU:  a  UnUS:X  d  GMv    O   U
R                  U5        XF;   d  GM¤  UnGM©     / n/ n [        U
5      S-
  nU(       aL  X¤   R$                  X¤   R&                  n"n!UR                  U5        U R                  U"5        UU!-  nU(       a  ML  / n#Sn[)        [+        [!        UU 5      5      5       H_  u  nn"U"(       a!  U#R                  [        X^XN-
  5      S   5        O/[        Xä5       H   nU#R                  U US-  US-  S-    5        M"     UnMa     U#$ s  snf ! [         a     GM™  f = f)	a.  
q: quadratic spline with alternating on-curve / off-curve points.

costs: cumulative list of encoding cost of q in terms of number of
  points that need to be encoded.  Implied on-curve points do not
  contribute to the cost. If all points need to be encoded, then
  costs will be range(1, len(q)+1).
r   z+quadratic spline requires at least 3 pointsr   r&   r%   Fc              3   ó.   #   • U  H  u  pX-
  v •  M     g 7frE   r   )rH   rb   rc   s      r   rJ   Ú#spline_to_curves.<locals>.<genexpr>T  s   é € Ð&LÒ9K±° q¦uÒ9Kùs   ‚T)r8   r(   r   Úsetr   ÚaddrV   rW   rX   r/   ÚZeroDivisionErrorr   Ú	enumerateÚmaxr)   rQ   Úzipr   rY   rZ   Úreversedr7   )$r;   rT   r
   rA   r2   Úelevated_quadraticsÚforcedr   r   r   ÚsolsÚ
impossibler   Úbest_solr[   r]   ra   Ú
this_countr\   r`   Úi_solr.   r+   Úreconstructed_iterÚreconstructedrX   r   ÚreconstÚorigr_   r   ÚsplitsÚcubicr0   rZ   r*   s$                                       r   rP   rP   ò   s  € ôB ˆq‹6�Q‹;ÐEÐEÓEˆ;ô 38¸¼3¸q»6ÀA¹:ÀqÔ2IóÚ2I¨QÔ˜1  Q¡˜<Ó(Ñ2Ið ð ô
 ‹U€FÜ�1”cÐ-Ó.Ö/ˆØ  Q¡Ñ'¨Ñ*ˆØ Ñ# AÑ&ˆØ Ñ# AÑ&ˆÜˆr‰w‹<œ#˜b™g›,Ñ&¨´S¸¹³\Ñ)AÕAØ�J‰J�qŽMñ 0ô �Q˜˜1˜eÓ$Ð%€DÜœ#Ð1Ó2°QÑ6¸Ñ:¸A¸qÀ%ÓH€JØ€EÜ�1”cÐ-Ó.°Ñ2×3ˆØˆÜ�u—ˆAØ'+¡w×'9Ñ'9¸4¹7¿=¹=˜ˆKæà" 1 q¡5¨1¡9Ñ-°°a¸!±e±Ñ<¸qÑ@�
Ø)¨JÑ6�Ø)�Ü  ¨k¸1¹5À%ÓH�Ø˜8Ó#Ø$�Hà “?áðÜ(Ð)<ÀÁÓG‘	��rô
 "0Ð!<°Ð!<¸Ò!<ÐØˆMð ˆEÜ'Ð(:Ö;‘
��7Ø*¨q©5Ñ1�Ü˜' !™* t¨A¡wÑ.Ó/�Ü˜E 3›�Ø˜9Ó$ÙØ×$Ñ$ WÖ-ñ <ð �yÓ áô (¨Ö6‘
��7Ø*¨q©5Ñ1�Ü!&Ñ&L¼¸WÀdÔ9KÓ&LÓ!L‘�˜˜Bä0°¸¸RÀ×KÓKØ%¨™M�EÙñ 7ð �yÓ âð &¨™/ˆKÜ˜k¨5Ó1ˆKÜ˜[¨+°q±u¸dÓCˆEØ�xÓØ �à˜aÖáñy !ð| 	�‰�HÔØŽ;Ø‹EñE 4ðJ €FØ€EÜˆD‹	�A‰€AÞ
Ø™'×-Ñ-¨t©w×/?Ñ/?ˆxˆØ�‰�aÔØ�‰�XÔØ	ˆU‰
ˆ÷	 ˆ!ð
 €FØ	€AÜ¤¤S¨°Ó%7Ó 8Ö9‰ˆˆ8ÞØ�M‰Mœ,Ð':¸q¹uÓEÀaÑHÕIä˜1–[�Ø—‘˜a  A¡¨¨A©°©	Ð2Ö3ñ !àŠñ :ð €MùòSøôN %ó Ûðús   ²N&ÆN+Î+
N:Î9N:c                  ó  • SSK Jn   SSKJn  SnUS-  nU " 5       nU" XB5      n[	        SX#4-  5        [	        S[        U5      -  5        [        U/U5      n[	        S[        U5      -  5        [	        S	U5        [	        S
U5        g )Nr   )Úgenerate_curve)Úcurve_to_quadraticgš™™™™™©?r%   z'cu2qu tolerance %g. qu2cu tolerance %g.z+One random cubic turned into %d quadratics.z-Those quadratics turned back into %d cubics. zOriginal curve:zReconstructed curve(s):)ÚfontTools.cu2qu.benchmarkr|   ÚfontTools.cu2qur}   Úprintr8   r	   )r|   r}   r
   Úreconstruct_tolerancer.   Ú
quadraticsr*   s          r   Úmainrƒ   ‚  s‡   € Ý8Ý2à€IØ%¨™MÐÙÓ€EÙ# EÓ5€JÜ	Ø1°YÐ4VÑVôô 
Ð
7¼#¸j»/Ñ
IÔJÜ  * Ð/DÓE€FÜ	Ð
9¼CÀ»KÑ
GÔHÜ	Ð
˜UÔ#Ü	Ð
# VÕ,r   Ú__main__)r   Fr   )"r   ÚAttributeErrorÚImportErrorÚfontTools.miscÚcompiledÚCOMPILEDÚfontTools.misc.bezierToolsr   Úcollectionsr   ÚmathÚtypingr   r   r   Ú__all__ÚcfuncÚreturnsÚintÚlocalsÚdoublerM   r   r   r/   r<   ÚfloatÚPointÚboolr	   rV   rP   rƒ   Ú__name__r   r   r   Ú<module>r˜      s½  ðð&&Ûð �?‰?€å 5Ý "Û ÷ñ ð !Ð
!€ð ‡�Ø‡‚�—
‘
ÓØ‡‚Ø�m‰mØ‡~�~Ø‡~�~Ø‡~�~Ø‡~�~ñð ‡‚�6—>‘>¨&¯.©.Ñ9ñWó :óó ó ðWð@ ‡‚Ø‡~�~Ø‡~�~Ø‡~�~Ø�>‰>ñ	ñ
óð
ð ‡�Ø‡‚Ø
�*‰*Ø‡j�jØ‡j�jØ�}‰}Ø�m‰mØ
�-‰-Ø‡m�mØ‡~�~Ø‡~�~Ø‡~�~Ø‡~�~ññ$óó ð$ðN ‡‚Ø
�*‰*Ø—*‘*Ø‡j�jØ	�‰Ø	�‰Ø‡~�~ññ
óð
ð 	ˆe�E˜5�LÑ! 7Ð*Ñ+€ð ‡‚Ø	�‰Ø�z‰zñð Øñ6Ø��U‘Ñð6àð6ð ð6ð 
ˆ%��s�
Ñ
Ñô	6ó	ð6ñr �jÒ"TÓU€ð ‡‚ò Ø‡j‚jðà‡j‚jðð ‡j‚jðð �*Š*ð	ð
 —
’
ðð —
’
ðð —:’:ðð �mŠmðð 	�Šðð �-Š-ðð —’ðð —’ðð �jŠjðð �ZŠZðð �*Š*ðð  ‡~‚~ð!ð" ‡~‚~ð#ð$ ‡~‚~ð%ð& ‡~‚~ð'ð( ‡n‚nð)ð* ‡n‚nð+ó.vó/ð.vòr-ð$ ˆzÓÙ…Fð øð 	˜Ð$ó &ç%Ð%ð&ús   ‚N ÎN1Î0N1