o
    h                     @   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d8 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 d4d d5e"fd6d7Z#  Z$S )9r   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.
     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valueskeep	__class__r   i/var/www/html/construction_image-detection-poc/venv/lib/python3.10/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                    sf   t trt| tksJ |  fddt| D S t tr0|  fdd| D S t )Nc                 3   s    | ]
\}} ||V  qd S Nr   .0abopr   r   	<genexpr>%   s    z#Vector._vectorOp.<locals>.<genexpr>c                 3       | ]} |V  qd S r   r   r   vr   otherr   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 )Nc                 3   r   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   0       z"Vector._unaryOp.<locals>.<genexpr>r   )r   r   r   r   r   _unaryOp/      zVector._unaryOpc                 C      |  |tjS r   )r*   operatoraddr   r#   r   r   r   __add__2      zVector.__add__c                 C   r/   r   )r*   r0   subr2   r   r   r   __sub__7   r4   zVector.__sub__c                 C      |  |tS r   )r*   _operator_rsubr2   r   r   r   __rsub__:      zVector.__rsub__c                 C   r/   r   )r+   r0   mulr2   r   r   r   __mul__=   r4   zVector.__mul__c                 C   r/   r   )r+   r0   truedivr2   r   r   r   __truediv__B   r4   zVector.__truediv__c                 C   r7   r   )r+   _operator_rtruedivr2   r   r   r   __rtruediv__E   r:   zVector.__rtruediv__c                 C      |  tjS r   )r-   r0   posr   r   r   r   __pos__H   r:   zVector.__pos__c                 C   rA   r   )r-   r0   negr   r   r   r   __neg__K   r:   zVector.__neg__)roundc                C   s
   |  |S r   )r-   )r   rF   r   r   r   	__round__N   s   
zVector.__round__c                    s   t |tr	t|}t |S r   )r%   listtupler	   __eq__r2   r   r   r   rJ   Q   s   
zVector.__eq__c                 C   s   |  | S r   )rJ   r2   r   r   r   __ne__W   r:   zVector.__ne__c                 C      t | S r   )anyr   r   r   r   __bool__Z   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   `   r,   z!Vector.__abs__.<locals>.<genexpr>)mathsqrtsumr   r   r   r   __abs___   r.   zVector.__abs__c                 C   rL   )z;Return the length of the vector. Equivalent to abs(vector).absr   r   r   r   lengthb   s   zVector.lengthc                 C   s   | t |  S )z+Return the normalized vector of the vector.rT   r   r   r   r   
normalizedf   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   n   s    zVector.dot.<locals>.<genexpr>)r&   rR   r'   r2   r   r   r   dotj   s   z
Vector.dotc                 C   s   t dt |  S )NzAthe 'toInt' method has been deprecated, use round(vector) instead)r   r   r   rG   r   r   r   r   toIntr   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   rH   r   r   r   r   r   y   s
   zVector.valuesc                 C   s   t d)Nz?can't set attribute, the 'values' attribute has been deprecated)AttributeError)r   r   r   r   r   r      s   r#   returnc                    s0   t | t |ks
J t fddt| |D S )z5Return True if the vector is close to another Vector.c                 3   s(    | ]\}}t j||fi  V  qd S r   )rP   iscloser   kwargsr   r   r      s   & z!Vector.isclose.<locals>.<genexpr>)r&   allr'   )r   r#   r^   r   r]   r   r\      s   zVector.isclose)F)%r   
__module____qualname____doc__	__slots__r
   r   r*   r+   r-   r3   __radd__r6   r9   r<   __rmul__r>   r@   rC   rE   rF   rG   rJ   rK   rN   __nonzero__rS   rV   rW   rX   rY   propertyr   setterboolr\   __classcell__r   r   r   r   r   
   sB    

c                 C      t || S r   )r0   r5   r   r   r   r   r   r8      r:   r8   c                 C   rk   r   )r0   r=   rl   r   r   r   r?      r:   r?   )
numbersr   rP   r0   r   __all__rI   r   r8   r?   r   r   r   r   <module>   s     