
    h                     P    S SK Jr  S SKrS SKrS SKrS/r " S S\5      rS rS r	g)    )NumberNVectorc                     ^  \ rS rSrSrSrS U 4S jjrU 4S jrS rS r	S r
S	 r\rS
 rS rS r\rS rS rS rS r\S.S jrU 4S jrS rS r\rS rS rS rS rS r\ S 5       r!\!RD                  S 5       r!SS S\#4S jr$Sr%U =r&$ )!r   
   zA math-like vector.

Represents an n-dimensional numeric vector. ``Vector`` objects support
vector addition and subtraction, scalar multiplication and division,
negation, rounding, and comparison tests.
 c                    > USLa  [         R                  " S[        5        [        U5      [        :X  a  U$ [
        TU ]  X5      $ )NFz'the 'keep' argument has been deprecated)warningswarnDeprecationWarningtyper   super__new__)clsvalueskeep	__class__s      G/var/www/html/env/lib/python3.13/site-packages/fontTools/misc/vector.pyr   Vector.__new__   s?    uMM9" <6!Mws++    c                 T   > U R                   R                   S[        TU ]  5        S3$ )N())r   __name__r   __repr__)selfr   s    r   r   Vector.__repr__   s*    ..))*!EG,<,>+?qAAr   c                 $  ^^ [        T[        5      (       a?  [        U 5      [        T5      :X  d   eU R                  U4S j[	        U T5       5       5      $ [        T[
        5      (       a  U R                  UU4S jU  5       5      $ [        5       e)Nc              3   8   >#    U  H  u  pT" X5      v   M     g 7fNr   ).0abops      r   	<genexpr>#Vector._vectorOp.<locals>.<genexpr>%   s     !H7Gtq"Q((7Gs   c              3   6   >#    U  H  nT" UT5      v   M     g 7fr   r   r    vr#   others     r   r$   r%   '        !=1"Q,,   )
isinstancer   lenr   zipr   NotImplementedErrorr   r)   r#   s    ``r   	_vectorOpVector._vectorOp"   sm    eV$$t9E
***>>!Hs47G!HHHeV$$>>!=!===!##r   c                 |   ^^ [        T[        5      (       a  U R                  UU4S jU  5       5      $ [        5       e)Nc              3   6   >#    U  H  nT" UT5      v   M     g 7fr   r   r'   s     r   r$   #Vector._scalarOp.<locals>.<genexpr>,   r*   r+   )r,   r   r   r/   r0   s    ``r   	_scalarOpVector._scalarOp*   s.    eV$$>>!=!===!##r   c                 :   ^ U R                  U4S jU  5       5      $ )Nc              3   4   >#    U  H  nT" U5      v   M     g 7fr   r   )r    r(   r#   s     r   r$   "Vector._unaryOp.<locals>.<genexpr>0   s     2TbeeTs   r   )r   r#   s    `r   _unaryOpVector._unaryOp/   s    ~~2T222r   c                 B    U R                  U[        R                  5      $ r   )r1   operatoraddr   r)   s     r   __add__Vector.__add__2       ~~eX\\22r   c                 B    U R                  U[        R                  5      $ r   )r1   r?   subrA   s     r   __sub__Vector.__sub__7   rD   r   c                 .    U R                  U[        5      $ r   )r1   _operator_rsubrA   s     r   __rsub__Vector.__rsub__:   s    ~~e^44r   c                 B    U R                  U[        R                  5      $ r   )r6   r?   mulrA   s     r   __mul__Vector.__mul__=   rD   r   c                 B    U R                  U[        R                  5      $ r   )r6   r?   truedivrA   s     r   __truediv__Vector.__truediv__B   s    ~~eX%5%566r   c                 .    U R                  U[        5      $ r   )r6   _operator_rtruedivrA   s     r   __rtruediv__Vector.__rtruediv__E   s    ~~e%788r   c                 @    U R                  [        R                  5      $ r   )r<   r?   posr   s    r   __pos__Vector.__pos__H       }}X\\**r   c                 @    U R                  [        R                  5      $ r   )r<   r?   negr[   s    r   __neg__Vector.__neg__K   r^   r   )roundc                $    U R                  U5      $ r   )r<   )r   rc   s     r   	__round__Vector.__round__N   s    }}U##r   c                 b   > [        U[        5      (       a  [        U5      n[        TU ]  U5      $ r   )r,   listtupler   __eq__)r   r)   r   s     r   rj   Vector.__eq__Q   s(    eT""%LEw~e$$r   c                 .    U R                  U5      (       + $ r   )rj   rA   s     r   __ne__Vector.__ne__W   s    ;;u%%%r   c                     [        U 5      $ r   )anyr[   s    r   __bool__Vector.__bool__Z   s    4yr   c                 N    [         R                  " [        S U  5       5      5      $ )Nc              3   *   #    U  H	  oU-  v   M     g 7fr   r   )r    xs     r   r$   !Vector.__abs__.<locals>.<genexpr>`   s     1DqUDs   )mathsqrtsumr[   s    r   __abs__Vector.__abs___   s    yy1D1122r   c                     [        U 5      $ )z;Return the length of the vector. Equivalent to abs(vector).absr[   s    r   lengthVector.lengthb   s    4yr   c                     U [        U 5      -  $ )z+Return the normalized vector of the vector.r}   r[   s    r   
normalizedVector.normalizedf   s    c$ir   c                 l    [        U 5      [        U5      :X  d   e[        S [        X5       5       5      $ )zSPerforms vector dot product, returning the sum of
``a[0] * b[0], a[1] * b[1], ...``c              3   .   #    U  H  u  pX-  v   M     g 7fr   r   )r    r!   r"   s      r   r$   Vector.dot.<locals>.<genexpr>n   s     6%5TQ15%5s   )r-   ry   r.   rA   s     r   dot
Vector.dotj   s0     4yCJ&&&6S%5666r   c                 X    [         R                  " S[        5        U R                  5       $ )NzAthe 'toInt' method has been deprecated, use round(vector) instead)r	   r
   r   re   r[   s    r   toIntVector.toIntr   s#    O	
 ~~r   c                 N    [         R                  " S[        5        [        U 5      $ )NzPthe 'values' attribute has been deprecated, use the vector object itself instead)r	   r
   r   rh   r[   s    r   r   Vector.valuesy   s"    /	

 Dzr   c                     [        S5      e)Nz?can't set attribute, the 'values' attribute has been deprecated)AttributeError)r   r   s     r   r   r      s    M
 	
r   r)   returnc                 t   ^ [        U 5      [        U5      :X  d   e[        U4S j[        X5       5       5      $ )z5Return True if the vector is close to another Vector.c              3   V   >#    U  H  u  p[         R                  " X40 TD6v   M      g 7fr   )rw   isclose)r    r!   r"   kwargss      r   r$   !Vector.isclose.<locals>.<genexpr>   s#     M<LDA4<<//<Ls   &))r-   allr.   )r   r)   r   s     `r   r   Vector.isclose   s/    4yCJ&&&MC<LMMMr   )F)'r   
__module____qualname____firstlineno____doc__	__slots__r   r   r1   r6   r<   rB   __radd__rG   rK   rO   __rmul__rS   rW   r\   ra   rc   re   rj   rm   rq   __nonzero__rz   r   r   r   r   propertyr   setterboolr   __static_attributes____classcell__r;   s   @r   r   r   
   s     I	,B$$
33 H353 H79++ "' $%& K3 7    ]]
 

NX ND N Nr   c                 .    [         R                  " X5      $ r   )r?   rF   r!   r"   s     r   rJ   rJ      s    <<r   c                 .    [         R                  " X5      $ r   )r?   rR   r   s     r   rV   rV      s    A!!r   )
numbersr   rw   r?   r	   __all__ri   r   rJ   rV   r   r   r   <module>r      s5        *ANU ANH"r   