a
    èÝEbë  ã                   @   sN   d dl mZ d dlZd dlZd dlZdgZG dd„ deƒZdd„ Zdd„ Z	dS )	é    )ÚNumberNÚVectorc                       s  e Zd ZdZdZd4‡ fdd„	Z‡ fdd„Zdd	„ Zd
d„ Zdd„ Z	dd„ Z
e
Zdd„ Zdd„ Zdd„ ZeZdd„ Zdd„ Zdd„ Zdd„ Zedœdd „Z‡ fd!d"„Zd#d$„ Zd%d&„ ZeZd'd(„ Zd)d*„ Zd+d,„ Zd-d.„ Zd/d0„ Zed1d2„ ƒZ e j!d3d2„ ƒZ ‡  Z"S )5r   zÛA 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.
    © Fc                    s2   |durt  dt¡ t|ƒtkr$|S tƒ  | |¡S )NFz'the 'keep' argument has been deprecated)ÚwarningsÚwarnÚDeprecationWarningÚtyper   ÚsuperÚ__new__)ÚclsÚvaluesZkeep©Ú	__class__r   úU/home/ja/django-apps/lartica_env/lib/python3.9/site-packages/fontTools/misc/vector.pyr
      s    þzVector.__new__c                    s   | j j› dtƒ  ¡ › d�S )Nú(ú))r   Ú__name__r	   Ú__repr__©Úselfr   r   r   r       s    zVector.__repr__c                    sj   t ˆtƒr<t| ƒtˆƒksJ ‚|  ‡ fdd„t| ˆƒD ƒ¡S t ˆtƒr`|  ‡ ‡fdd„| D ƒ¡S tƒ ‚d S )Nc                 3   s   | ]\}}ˆ ||ƒV  qd S ©Nr   ©Ú.0ÚaÚb©Úopr   r   Ú	<genexpr>&   ó    z#Vector._vectorOp.<locals>.<genexpr>c                 3   s   | ]}ˆ |ˆƒV  qd S r   r   ©r   Úv©r   Úotherr   r   r   (   r   )Ú
isinstancer   Úlenr   Úzipr   ÚNotImplementedError©r   r"   r   r   r!   r   Ú	_vectorOp#   s    

zVector._vectorOpc                    s.   t ˆtƒr$|  ‡ ‡fdd„| D ƒ¡S tƒ ‚d S )Nc                 3   s   | ]}ˆ |ˆƒV  qd S r   r   r   r!   r   r   r   -   r   z#Vector._scalarOp.<locals>.<genexpr>)r#   r   r   r&   r'   r   r!   r   Ú	_scalarOp+   s    
zVector._scalarOpc                    s   |   ‡ fdd„| D ƒ¡S )Nc                 3   s   | ]}ˆ |ƒV  qd S r   r   r   r   r   r   r   1   r   z"Vector._unaryOp.<locals>.<genexpr>r   )r   r   r   r   r   Ú_unaryOp0   s    zVector._unaryOpc                 C   s   |   |tj¡S r   )r(   ÚoperatorÚadd©r   r"   r   r   r   Ú__add__3   s    zVector.__add__c                 C   s   |   |tj¡S r   )r(   r+   Úsubr-   r   r   r   Ú__sub__8   s    zVector.__sub__c                 C   s   |   |t¡S r   )r(   Ú_operator_rsubr-   r   r   r   Ú__rsub__;   s    zVector.__rsub__c                 C   s   |   |tj¡S r   )r)   r+   Úmulr-   r   r   r   Ú__mul__>   s    zVector.__mul__c                 C   s   |   |tj¡S r   )r)   r+   Útruedivr-   r   r   r   Ú__truediv__C   s    zVector.__truediv__c                 C   s   |   |t¡S r   )r)   Ú_operator_rtruedivr-   r   r   r   Ú__rtruediv__F   s    zVector.__rtruediv__c                 C   s   |   tj¡S r   )r*   r+   Úposr   r   r   r   Ú__pos__I   s    zVector.__pos__c                 C   s   |   tj¡S r   )r*   r+   Únegr   r   r   r   Ú__neg__L   s    zVector.__neg__)Úroundc                C   s
   |   |¡S r   )r*   )r   r=   r   r   r   Ú	__round__O   s    zVector.__round__c                    s   t |tƒrt|ƒ}tƒ  |¡S r   )r#   ÚlistÚtupler	   Ú__eq__r-   r   r   r   rA   R   s    
zVector.__eq__c                 C   s   |   |¡ S r   )rA   r-   r   r   r   Ú__ne__X   s    zVector.__ne__c                 C   s   t | ƒS r   )Úanyr   r   r   r   Ú__bool__[   s    zVector.__bool__c                 C   s   t  tdd„ | D ƒƒ¡S )Nc                 s   s   | ]}|| V  qd S r   r   )r   Úxr   r   r   r   a   r   z!Vector.__abs__.<locals>.<genexpr>)ÚmathÚsqrtÚsumr   r   r   r   Ú__abs__`   s    zVector.__abs__c                 C   s   t | ƒS )z;Return the length of the vector. Equivalent to abs(vector).©Úabsr   r   r   r   Úlengthc   s    zVector.lengthc                 C   s   | t | ƒ S )z+Return the normalized vector of the vector.rJ   r   r   r   r   Ú
normalizedg   s    zVector.normalizedc                 C   s,   t | ƒt |ƒksJ ‚tdd„ t| |ƒD ƒƒS )z[Performs vector dot product, returning the sum of
        ``a[0] * b[0], a[1] * b[1], ...``c                 s   s   | ]\}}|| V  qd S r   r   r   r   r   r   r   o   r   zVector.dot.<locals>.<genexpr>)r$   rH   r%   r-   r   r   r   Údotk   s    z
Vector.dotc                 C   s   t  dt¡ |  ¡ S )NzAthe 'toInt' method has been deprecated, use round(vector) instead)r   r   r   r>   r   r   r   r   ÚtoInts   s
    þzVector.toIntc                 C   s   t  dt¡ t| ƒS )NzPthe 'values' attribute has been deprecated, use the vector object itself instead)r   r   r   r?   r   r   r   r   r   z   s
    ýzVector.valuesc                 C   s   t dƒ‚d S )Nz?can't set attribute, the 'values' attribute has been deprecated)ÚAttributeError)r   r   r   r   r   r   ƒ   s    ÿ)F)#r   Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r
   r   r(   r)   r*   r.   Ú__radd__r0   r2   r4   Ú__rmul__r6   r8   r:   r<   r=   r>   rA   rB   rD   Ú__nonzero__rI   rL   rM   rN   rO   Úpropertyr   ÚsetterÚ__classcell__r   r   r   r   r   
   s>   
c                 C   s   t  || ¡S r   )r+   r/   ©r   r   r   r   r   r1   Š   s    r1   c                 C   s   t  || ¡S r   )r+   r5   r[   r   r   r   r7   Ž   s    r7   )
Únumbersr   rF   r+   r   Ú__all__r@   r   r1   r7   r   r   r   r   Ú<module>   s    