ó
    oñ:i¶=  ã                  ó0  • S r SSKJr  SSKrSSKJr  SSKJr  / SQrSr	S\	-
  r
S	\	-   rSS
 jr " S S\5      r\" 5       rSSS jjrSSS jjr\ " S S5      5       r\S:X  a4  SSKrSSKr\R*                  " \R,                  " 5       R.                  5        gg)a	  Affine 2D transformation matrix class.

The Transform class implements various transformation matrix operations,
both on the matrix itself, as well as on 2D coordinates.

Transform instances are effectively immutable: all methods that operate on the
transformation itself always return a new instance. This has as the
interesting side effect that Transform instances are hashable, ie. they can be
used as dictionary keys.

This module exports the following symbols:

Transform
        this is the main class
Identity
        Transform instance set to the identity transformation
Offset
        Convenience function that returns a translating transformation
Scale
        Convenience function that returns a scaling transformation

The DecomposedTransform class implements a transformation with separate
translate, rotation, scale, skew, and transformation-center components.

:Example:

        >>> t = Transform(2, 0, 0, 3, 0, 0)
        >>> t.transformPoint((100, 100))
        (200, 300)
        >>> t = Scale(2, 3)
        >>> t.transformPoint((100, 100))
        (200, 300)
        >>> t.transformPoint((0, 0))
        (0, 0)
        >>> t = Offset(2, 3)
        >>> t.transformPoint((100, 100))
        (102, 103)
        >>> t.transformPoint((0, 0))
        (2, 3)
        >>> t2 = t.scale(0.5)
        >>> t2.transformPoint((100, 100))
        (52.0, 53.0)
        >>> import math
        >>> t3 = t2.rotate(math.pi / 2)
        >>> t3.transformPoint((0, 0))
        (2.0, 3.0)
        >>> t3.transformPoint((100, 100))
        (-48.0, 53.0)
        >>> t = Identity.scale(0.5).translate(100, 200).skew(0.1, 0.2)
        >>> t.transformPoints([(0, 0), (1, 1), (100, 100)])
        [(50.0, 100.0), (50.550167336042726, 100.60135501775433), (105.01673360427253, 160.13550177543362)]
        >>>
é    )ÚannotationsN)Ú
NamedTuple)Ú	dataclass)Ú	TransformÚIdentityÚOffsetÚScaleÚDecomposedTransformgVçž¯Ò<é   éÿÿÿÿc                óh   • [        U 5      [        :  a  Sn U $ U [        :”  a  Sn U $ U [        :  a  Sn U $ )Nr   r   r   )ÚabsÚ_EPSILONÚ_ONE_EPSILONÚ_MINUS_ONE_EPSILON)Úvs    Ú[/srv/projetos/modelo_ml_acdoc/venv/lib/python3.13/site-packages/fontTools/misc/transform.pyÚ_normSinCosr   F   sE   € Ü
ˆ1ƒv”ÓØˆð
 €Hð	 
Œ\Ó	Øˆð €Hð 
ÔÓ	ØˆØ€Hó    c                  óô   • \ rS rSr% SrSrS\S'   SrS\S'   SrS\S'   Sr	S\S	'   Sr
S\S
'   SrS\S'   S rS rS rS rSSS jjrSS S jjrS!S jrSSS jjrS rS rS rS"S jrS#S jrS$S jrS"S jrSrg)%r   éP   a¤  2x2 transformation matrix plus offset, a.k.a. Affine transform.
Transform instances are immutable: all transforming methods, eg.
rotate(), return a new Transform instance.

:Example:

        >>> t = Transform()
        >>> t
        <Transform [1 0 0 1 0 0]>
        >>> t.scale(2)
        <Transform [2 0 0 2 0 0]>
        >>> t.scale(2.5, 5.5)
        <Transform [2.5 0 0 5.5 0 0]>
        >>>
        >>> t.scale(2, 3).transformPoint((100, 100))
        (200, 300)

Transform's constructor takes six arguments, all of which are
optional, and can be used as keyword arguments::

        >>> Transform(12)
        <Transform [12 0 0 1 0 0]>
        >>> Transform(dx=12)
        <Transform [1 0 0 1 12 0]>
        >>> Transform(yx=12)
        <Transform [1 0 12 1 0 0]>

Transform instances also behave like sequences of length 6::

        >>> len(Identity)
        6
        >>> list(Identity)
        [1, 0, 0, 1, 0, 0]
        >>> tuple(Identity)
        (1, 0, 0, 1, 0, 0)

Transform instances are comparable::

        >>> t1 = Identity.scale(2, 3).translate(4, 6)
        >>> t2 = Identity.translate(8, 18).scale(2, 3)
        >>> t1 == t2
        1

But beware of floating point rounding errors::

        >>> t1 = Identity.scale(0.2, 0.3).translate(0.4, 0.6)
        >>> t2 = Identity.translate(0.08, 0.18).scale(0.2, 0.3)
        >>> t1
        <Transform [0.2 0 0 0.3 0.08 0.18]>
        >>> t2
        <Transform [0.2 0 0 0.3 0.08 0.18]>
        >>> t1 == t2
        0

Transform instances are hashable, meaning you can use them as
keys in dictionaries::

        >>> d = {Scale(12, 13): None}
        >>> d
        {<Transform [12 0 0 13 0 0]>: None}

But again, beware of floating point rounding errors::

        >>> t1 = Identity.scale(0.2, 0.3).translate(0.4, 0.6)
        >>> t2 = Identity.translate(0.08, 0.18).scale(0.2, 0.3)
        >>> t1
        <Transform [0.2 0 0 0.3 0.08 0.18]>
        >>> t2
        <Transform [0.2 0 0 0.3 0.08 0.18]>
        >>> d = {t1: None}
        >>> d
        {<Transform [0.2 0 0 0.3 0.08 0.18]>: None}
        >>> d[t2]
        Traceback (most recent call last):
          File "<stdin>", line 1, in ?
        KeyError: <Transform [0.2 0 0 0.3 0.08 0.18]>
r   ÚfloatÚxxr   ÚxyÚyxÚyyÚdxÚdyc                óF   • Uu  p#U u  pEpgp‰XB-  Xc-  -   U-   XR-  Xs-  -   U	-   4$ )z�Transform a point.

:Example:

        >>> t = Transform()
        >>> t = t.scale(2.5, 5.5)
        >>> t.transformPoint((100, 100))
        (250.0, 550.0)
© )
ÚselfÚpÚxÚyr   r   r   r   r   r   s
             r   ÚtransformPointÚTransform.transformPoint¦   s<   € ð ‰ˆØ!%Ñˆ�˜Ø‘˜™‘ "Ñ$ b¡f¨r©v¡o¸Ñ&:Ð;Ð;r   c                ót   • U u  p#pEpgU VV	s/ s H  u  p‰X(-  XI-  -   U-   X8-  XY-  -   U-   4PM     sn	n$ s  sn	nf )zÉTransform a list of points.

:Example:

        >>> t = Scale(2, 3)
        >>> t.transformPoints([(0, 0), (0, 100), (100, 100), (100, 0)])
        [(0, 0), (0, 300), (200, 300), (200, 0)]
        >>>
r    )
r!   Úpointsr   r   r   r   r   r   r#   r$   s
             r   ÚtransformPointsÚTransform.transformPoints´   sI   € ð "&Ñˆ�˜ÙIOÔPÊÁÀ�‘˜"™&‘ 2Ñ% r¡v°±¡¸Ñ';Ó<ÉÒPÐPùÓPs   Œ$4c                ó>   • Uu  p#U SS u  pEpgXB-  Xc-  -   XR-  Xs-  -   4$ )z¹Transform an (dx, dy) vector, treating translation as zero.

:Example:

        >>> t = Transform(2, 0, 0, 2, 10, 20)
        >>> t.transformVector((3, -4))
        (6, -8)
        >>>
Né   r    )r!   r   r   r   r   r   r   r   s           r   ÚtransformVectorÚTransform.transformVectorÁ   s7   € ð ‰ˆØ˜b˜q˜‰ˆ�Ø‘˜"™'Ñ! 2¡7¨R©WÑ#4Ð5Ð5r   c                ól   • U SS u  p#pEU VVs/ s H  u  pgX&-  XG-  -   X6-  XW-  -   4PM     snn$ s  snnf )zØTransform a list of (dx, dy) vector, treating translation as zero.

:Example:
        >>> t = Transform(2, 0, 0, 2, 10, 20)
        >>> t.transformVectors([(3, -4), (5, -6)])
        [(6, -8), (10, -12)]
        >>>
Nr,   r    )r!   Úvectorsr   r   r   r   r   r   s           r   ÚtransformVectorsÚTransform.transformVectorsÏ   sD   € ð ˜b˜q˜‰ˆ�ÙELÔMÂW¹6¸2�‘˜2™7Ñ" B¡G¨b©gÑ$5Ó6ÁWÒMÐMùÓMs   Ž0c                ó.   • U R                  SSSSX45      $ )z±Return a new transformation, translated (offset) by x, y.

:Example:
        >>> t = Transform()
        >>> t.translate(20, 30)
        <Transform [1 0 0 1 20 30]>
        >>>
r   r   ©Ú	transform©r!   r#   r$   s      r   Ú	translateÚTransform.translateÛ   s   € ð �~‰~˜q ! Q¨¨1Ð0Ó1Ð1r   Nc                ó:   • Uc  UnU R                  USSUSS45      $ )a#  Return a new transformation, scaled by x, y. The 'y' argument
may be None, which implies to use the x value for y as well.

:Example:
        >>> t = Transform()
        >>> t.scale(5)
        <Transform [5 0 0 5 0 0]>
        >>> t.scale(5, 6)
        <Transform [5 0 0 6 0 0]>
        >>>
r   r4   r6   s      r   ÚscaleÚTransform.scaleæ   s*   € ð ‰9ØˆAØ�~‰~˜q ! Q¨¨1¨aÐ0Ó1Ð1r   c                ó¬   • [        [        R                  " U5      5      n[        [        R                  " U5      5      nU R	                  X#U* USS45      $ )zËReturn a new transformation, rotated by 'angle' (radians).

:Example:
        >>> import math
        >>> t = Transform()
        >>> t.rotate(math.pi / 2)
        <Transform [0 1 -1 0 0 0]>
        >>>
r   )r   ÚmathÚcosÚsinr5   )r!   ÚangleÚcÚss       r   ÚrotateÚTransform.rotateö   sD   € ô œŸš ›Ó(ˆÜœŸš ›Ó(ˆØ�~‰~˜q a R¨¨A¨qÐ1Ó2Ð2r   c                ó€   • U R                  S[        R                  " U5      [        R                  " U5      SSS45      $ )z½Return a new transformation, skewed by x and y.

:Example:
        >>> import math
        >>> t = Transform()
        >>> t.skew(math.pi / 4)
        <Transform [1 0 1 1 0 0]>
        >>>
r   r   )r5   r=   Útanr6   s      r   ÚskewÚTransform.skew  s0   € ð �~‰~˜q¤$§(¢(¨1£+¬t¯xªx¸«{¸A¸qÀ!ÐDÓEÐEr   c           
     ó¦   • Uu  p#pEpgU u  p‰p«pÍU R                  X(-  X:-  -   X)-  X;-  -   XH-  XZ-  -   XI-  X[-  -   X†-  X§-  -   U-   X–-  X·-  -   U-   5      $ )z×Return a new transformation, transformed by another
transformation.

:Example:
        >>> t = Transform(2, 0, 0, 3, 1, 6)
        >>> t.transform((4, 3, 2, 1, 5, 6))
        <Transform [8 9 4 3 11 24]>
        >>>
©Ú	__class__©r!   ÚotherÚxx1Úxy1Úyx1Úyy1Údx1Údy1Úxx2Úxy2Úyx2Úyy2Údx2Údy2s                 r   r5   ÚTransform.transform  s   € ð (-Ñ$ˆ�#˜CØ'+Ñ$ˆ�#˜CØ�~‰~Ø‰I˜™	Ñ!Ø‰I˜™	Ñ!Ø‰I˜™	Ñ!Ø‰I˜™	Ñ!Ø‰I˜™	Ñ! CÑ'Ø‰I˜™	Ñ! CÑ'ó
ð 	
r   c           
     ó¦   • U u  p#pEpgUu  p‰p«pÍU R                  X(-  X:-  -   X)-  X;-  -   XH-  XZ-  -   XI-  X[-  -   X†-  X§-  -   U-   X–-  X·-  -   U-   5      $ )a�  Return a new transformation, which is the other transformation
transformed by self. self.reverseTransform(other) is equivalent to
other.transform(self).

:Example:
        >>> t = Transform(2, 0, 0, 3, 1, 6)
        >>> t.reverseTransform((4, 3, 2, 1, 5, 6))
        <Transform [8 6 6 3 21 15]>
        >>> Transform(4, 3, 2, 1, 5, 6).transform((2, 0, 0, 3, 1, 6))
        <Transform [8 6 6 3 21 15]>
        >>>
rJ   rL   s                 r   ÚreverseTransformÚTransform.reverseTransform%  s   € ð (,Ñ$ˆ�#˜CØ',Ñ$ˆ�#˜CØ�~‰~Ø‰I˜™	Ñ!Ø‰I˜™	Ñ!Ø‰I˜™	Ñ!Ø‰I˜™	Ñ!Ø‰I˜™	Ñ! CÑ'Ø‰I˜™	Ñ! CÑ'ó
ð 	
r   c                ó²   • U [         :X  a  U $ U u  pp4pVX-  X2-  -
  nXG-  U* U-  U* U-  X-  4u  pp4U* U-  X6-  -
  U* U-  XF-  -
  peU R                  XX4XV5      $ )a  Return the inverse transformation.

:Example:
        >>> t = Identity.translate(2, 3).scale(4, 5)
        >>> t.transformPoint((10, 20))
        (42, 103)
        >>> it = t.inverse()
        >>> it.transformPoint((42, 103))
        (10.0, 20.0)
        >>>
)r   rK   )r!   r   r   r   r   r   r   Údets           r   ÚinverseÚTransform.inverse=  s�   € ð ”8ÓØˆKØ!%Ñˆ�˜Ø‰g˜™ÑˆØ™ B 3¨¡9¨r¨c°C©i¸¹ÐA‰ˆ�Ø��r‘˜B™GÑ# b S¨2¡X°±Ñ%7ˆBØ�~‰~˜b b¨bÓ5Ð5r   c                ó   • SU -  $ )zžReturn a PostScript representation

:Example:

        >>> t = Identity.scale(2, 3).translate(4, 5)
        >>> t.toPS()
        '[2 0 0 3 8 15]'
        >>>
z[%s %s %s %s %s %s]r    ©r!   s    r   ÚtoPSÚTransform.toPSQ  s   € ð % tÑ+Ð+r   c                ó,   • [         R                  U 5      $ )z%Decompose into a DecomposedTransform.)r
   ÚfromTransformrc   s    r   ÚtoDecomposedÚTransform.toDecomposed]  s   € ä"×0Ñ0°Ó6Ð6r   c                ó   • U [         :g  $ )ak  Returns True if transform is not identity, False otherwise.

:Example:

        >>> bool(Identity)
        False
        >>> bool(Transform())
        False
        >>> bool(Scale(1.))
        False
        >>> bool(Scale(2))
        True
        >>> bool(Offset())
        False
        >>> bool(Offset(0))
        False
        >>> bool(Offset(2))
        True
)r   rc   s    r   Ú__bool__ÚTransform.__bool__a  s   € ð( ”xÑÐr   c                ó<   • SU R                   R                  4U -   -  $ )Nz<%s [%g %g %g %g %g %g]>)rK   Ú__name__rc   s    r   Ú__repr__ÚTransform.__repr__w  s   € Ø)¨d¯n©n×.EÑ.EÐ-GÈ$Ñ-NÑOÐOr   r    ©r   r   )r#   r   r$   r   )r   N)r#   r   r$   úfloat | None)r@   r   )ÚreturnÚstr)rs   z'DecomposedTransform')rs   Úbool)rn   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Ú__annotations__r   r   r   r   r   r%   r)   r-   r1   r7   r:   rC   rG   r5   r\   r`   rd   rh   rk   ro   Ú__static_attributes__r    r   r   r   r   P   s�   ‡ ñLð\ €BˆƒMØ€BˆƒMØ€BˆƒMØ€BˆƒMØ€BˆƒMØ€BˆƒMò<òQò6ò
Nö	2ö2ô 3ö
Fò
ò*
ò06ô(
,ô7ô ÷,Pr   r   c                ó    • [        SSSSX5      $ )z…Return the identity transformation offset by x, y.

:Example:
        >>> Offset(2, 3)
        <Transform [1 0 0 1 2 3]>
        >>>
r   r   ©r   ©r#   r$   s     r   r   r   ~  s   € ô �Q˜˜1˜a Ó&Ð&r   c                ó,   • Uc  U n[        U SSUSS5      $ )zÒReturn the identity transformation scaled by x, y. The 'y' argument
may be None, which implies to use the x value for y as well.

:Example:
        >>> Scale(2, 3)
        <Transform [2 0 0 3 0 0]>
        >>>
r   r}   r~   s     r   r	   r	   ‰  s#   € ð 	�yØˆÜ�Q˜˜1˜a  AÓ&Ð&r   c                  ó¸   • \ rS rSr% SrSrS\S'   SrS\S'   SrS\S'   Sr	S\S	'   Sr
S\S
'   SrS\S'   SrS\S'   SrS\S'   SrS\S'   S r\S 5       rSS jrSrg)r
   i—  z�The DecomposedTransform class implements a transformation with separate
translate, rotation, scale, skew, and transformation-center components.
r   r   Ú
translateXÚ
translateYÚrotationr   ÚscaleXÚscaleYÚskewXÚskewYÚtCenterXÚtCenterYc                ó€  • U R                   S:g  =(       d©    U R                  S:g  =(       d“    U R                  S:g  =(       d}    U R                  S:g  =(       dg    U R                  S:g  =(       dQ    U R
                  S:g  =(       d;    U R                  S:g  =(       d%    U R                  S:g  =(       d    U R                  S:g  $ )Nr   r   )	r�   r‚   rƒ   r„   r…   r†   r‡   rˆ   r‰   rc   s    r   rk   ÚDecomposedTransform.__bool__§  s¥   € à�O‰O˜qÑ ÷ "Ø�‰ !Ñ#÷"à�}‰} Ñ!÷"ð �{‰{˜aÑ÷"ð �{‰{˜aÑ÷	"ð
 �z‰z˜Q‰÷"ð �z‰z˜Q‰÷"ð �}‰} Ñ!÷"ð �}‰} Ñ!ð
	
r   c                ó  • Uu  p#pEpg[         R                  " SU5      nUS:  a  X(-  nX8-  nX%-  X4-  -
  n	Sn
S=p¼SnUS:w  d  US:w  a|  [         R                  " X"-  X3-  -   5      nUS:¼  a  [         R                  " X.-  5      O[         R                  " X.-  5      * n
XéU-  pË[         R                  " X$-  X5-  -   Xî-  -  5      nO}US:w  d  US:w  ap  [         R                  " XD-  XU-  -   5      n[         R
                  S-  US:¼  a  [         R                  " U* U-  5      O[         R                  " XO-  5      * -
  n
XŸ-  UpËO [        UU[         R                  " U
5      X¸-  U[         R                  " U5      U-  SSS5	      $ )a-  Return a DecomposedTransform() equivalent of this transformation.
The returned solution always has skewY = 0, and angle in the (-180, 180].

:Example:
        >>> DecomposedTransform.fromTransform(Transform(3, 0, 0, 2, 0, 0))
        DecomposedTransform(translateX=0, translateY=0, rotation=0.0, scaleX=3.0, scaleY=2.0, skewX=0.0, skewY=0.0, tCenterX=0, tCenterY=0)
        >>> DecomposedTransform.fromTransform(Transform(0, 0, 0, 1, 0, 0))
        DecomposedTransform(translateX=0, translateY=0, rotation=0.0, scaleX=0.0, scaleY=1.0, skewX=0.0, skewY=0.0, tCenterX=0, tCenterY=0)
        >>> DecomposedTransform.fromTransform(Transform(0, 0, 1, 1, 0, 0))
        DecomposedTransform(translateX=0, translateY=0, rotation=-45.0, scaleX=0.0, scaleY=1.4142135623730951, skewX=0.0, skewY=0.0, tCenterX=0, tCenterY=0)
r   r   é   g        )r=   ÚcopysignÚsqrtÚacosÚatanÚpir
   Údegrees)r!   r5   ÚaÚbrA   Údr#   r$   ÚsxÚdeltarƒ   r„   r…   r†   ÚrrB   s                   r   rg   Ú!DecomposedTransform.fromTransform´  ss  € ð  %Ñˆˆa�Aä�]Š]˜1˜aÓ ˆØ�‹6Ø‰GˆAØ‰GˆAà‘˜™‘ˆàˆØÐˆØˆð �‹6�Q˜!“VÜ—	’	˜!™% !¡%™-Ó(ˆAØ+,°«6”t—y’y ¡Ô'¼¿	º	À!Á%Ó8HÐ7HˆHØ¨¡�FÜ—I’I˜q™u q¡u™}°±Ñ7Ó8‰EØ�!‹V�q˜A“vÜ—	’	˜!™% !¡%™-Ó(ˆAÜ—w‘w ‘{Ø%&¨!£V”—	’	˜1˜"˜q™&Ô!´$·)²)¸A¹EÓ2BÐ1BñˆHð $™i¨‘Fð ä"ØØÜ�LŠL˜Ó"Ø‰KØÜ�LŠL˜Ó "Ñ$ØØØó

ð 
	
r   c                ó0  • [        5       nUR                  U R                  U R                  -   U R                  U R
                  -   5      nUR                  [        R                  " U R                  5      5      nUR                  U R                  U R                  5      nUR                  [        R                  " U R                  5      [        R                  " U R                  5      5      nUR                  U R                  * U R
                  * 5      nU$ )zµReturn the Transform() equivalent of this transformation.

:Example:
        >>> DecomposedTransform(scaleX=2, scaleY=2).toTransform()
        <Transform [2 0 0 2 0 0]>
        >>>
)r   r7   r�   rˆ   r‚   r‰   rC   r=   Úradiansrƒ   r:   r„   r…   rG   r†   r‡   )r!   Úts     r   ÚtoTransformÚDecomposedTransform.toTransformí  s¸   € ô ‹KˆØ�K‰KØ�O‰O˜dŸm™mÑ+¨T¯_©_¸t¿}¹}Ñ-Ló
ˆð �H‰H”T—\’\ $§-¡-Ó0Ó1ˆØ�G‰G�D—K‘K §¡Ó-ˆØ�F‰F”4—<’< §
¡
Ó+¬T¯\ª\¸$¿*¹*Ó-EÓFˆØ�K‰K˜Ÿ™˜¨¯©¨Ó7ˆØˆr   r    N)rs   r   )rn   rv   rw   rx   ry   r�   rz   r‚   rƒ   r„   r…   r†   r‡   rˆ   r‰   rk   Úclassmethodrg   rž   r{   r    r   r   r
   r
   —  s‚   ‡ ñð €J�ÓØ€J�ÓØ€HˆeÓØ€FˆEÓØ€FˆEÓØ€Eˆ5ÓØ€Eˆ5ÓØ€HˆeÓØ€HˆeÓò
ð ñ6
ó ð6
÷pr   r
   Ú__main__)r   r   rs   r   rq   )r#   r   r$   r   rs   r   )N)r#   r   r$   rr   rs   r   )ry   Ú
__future__r   r=   Útypingr   Údataclassesr   Ú__all__r   r   r   r   r   r   r   r	   r
   rn   ÚsysÚdoctestÚexitÚtestmodÚfailedr    r   r   Ú<module>r«      s¯   ðñ4õl #ã Ý Ý !ò N€ð €Ø�8‰|€Ø˜(‘]Ð ôôhP�
ô hPñV	 ‹;€ö'ö'ð ÷eð eó ðeðP ˆzÓÛÛà‡H‚HˆW�_Š_Ó×%Ñ%Õ&ð	 r   