403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.60
Web Server : Apache/2.4.62 (Ubuntu)
System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64
User : www-data ( 33)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/inkscape/extensions/inkex/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/inkscape/extensions/inkex/__pycache__/paths.cpython-310.pyc
o

0�aI��@sdZddlZddlZddlmZmZmZmZmZm	Z	m
Z
ddlmZm
Z
mZddlmZmZddlmZmZmZmZmZmZmZmZmZmZddlmZed	d
d�Zedd
d�ZdZ e�!d�Z"dd�Z#Gdd�de$�Z%Gdd
�d
�Z&Gdd�de&�Z'Gdd
�d
e&�Z(Gdd�de(�Z)Gdd�de'�Z*Gdd�de(�Z+Gdd�de'�Z,Gd d!�d!e(�Z-Gd"d#�d#e'�Z.Gd$d%�d%e(�Z/Gd&d'�d'e'�Z0Gd(d)�d)e(�Z1Gd*d+�d+e'�Z2Gd,d-�d-e(�Z3Gd.d/�d/e'�Z4Gd0d1�d1e(�Z5Gd2d3�d3e'�Z6Gd4d5�d5e(�Z7Gd6d7�d7e'�Z8Gd8d9�d9e(�Z9Gd:d;�d;e'�Z:Gd<d=�d=e(�Z;Gd>d?�d?e'�Z<id@e+�dAe)�dBe1�dCe/�dDe;�dEe3�dFe5�dGe-�dHe7�dIe9�dJe,�dKe*�dLe2�dMe0�dNe<�dOe4�dPe6�e.e8e:dQ��e&_=GdRdS�dSe>�Z?GdTdU�dUe>�Z@dVdW�ZAdXdY�ZBdZd[�ZCd\d]�ZDd^d_�ZEdS)`z<
functions for digesting paths into a simple list structure
�N)�atan2�cos�pi�sin�sqrt�acos�tan�)�	Transform�BoundingBox�Vector2d)�
classproperty�strargs)
�overload�Any�Type�Dict�Optional�Union�Tuple�List�Iterator�	Generator)�TypeVar�Pathlike�PathCommand)�bound�AbsolutePathlike�AbsolutePathCommand)�Path�CubicSuperPath�Line�line�Move�move�	ZoneClose�	zoneClose�Horz�horz�Vert�vert�Curve�curve�Smooth�smooth�	Quadratic�	quadratic�TepidQuadratic�tepidQuadratic�Arc�arc�InvalidPathz2([MLHVCSQTAZmlhvcsqtaz])([^MLHVCSQTAZmlhvcsqtaz]*)cCs|duS�N�)�objr7r7�-/usr/share/inkscape/extensions/inkex/paths.py�<lambda>7sr:c@seZdZdZdS)r5z(Raised when given an invalid path stringN)�__name__�
__module__�__qualname__�__doc__r7r7r7r9r5:sr5c@s�eZdZdZdZedd��Zedd��Zedd��Ze	dd	��Z
e	d
d��Zdd
�Zdd�Z
dd�ZdZiZedd��Ze	dd��Zdd�Zedd��Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Ze�fd%d&�Ze�fd'd(�Zd)d*�Zd+S),rz)
    Base class of all path commands
    ���cCs|jSr6)r;��clsr7r7r9r:GszPathCommand.<lambda>cCs
|jdS�Nr)�namer@r7r7r9r:Js
cCs|Sr6r7��selfr7r7r9�next_commandN�zPathCommand.next_commandcC�t�r6��NotImplementedErrorrDr7r7r9�is_relativeRrGzPathCommand.is_relativecCrHr6rIrDr7r7r9�is_absoluteVrGzPathCommand.is_absolutecCrH)zFReturn absolute counterpart for absolute commands or copy for relativerI�rE�prevr7r7r9�to_relativeZrGzPathCommand.to_relativecCrH)zFReturn relative counterpart for relative commands or copy for absoluterIrMr7r7r9�to_absolute^rGzPathCommand.to_absolutecC�
|�|�S)z(Return an absolute non-shorthand command)rP�rErN�prev_controlr7r7r9�to_non_shorthandb�
zPathCommand.to_non_shorthandz{:.6g}cCs
tj|S)z+Returns class for given path command letter)r�_letter_to_class)�letterr7r7r9�letter_to_classnrUzPathCommand.letter_to_classcC�t��)z1Returns path command arguments as tuple of floatsrIrDr7r7r9�argssszPathCommand.argscCrH)z+Returns list of path command control pointsrI�rE�firstrN�	prev_prevr7r7r9�control_pointsxszPathCommand.control_pointscCs|�|jg|j�Sr6)�join�number_template�nargs)rA�sepr7r7r9�_argt}�zPathCommand._argtcCs d�|j|�d�j|j����S)Nz{} {}� )�formatrWrcrZ�striprDr7r7r9�__str__�s zPathCommand.__str__cCs"d�|�d��j|jg|j�R�S)Nz{{}}({})z, )rfrcrCrZrDr7r7r9�__repr__��"zPathCommand.__repr__cCs�t�}t|�t|�kr|j|jkSt|t�r|j|kSt|t�s$td��z|j|jkr6|�|�|�|�kWSWdStyBYdSw)NzCan't compare typesF)	r�typerZ�
isinstance�tupler�
ValueErrorrK�to_curve)rE�other�previousr7r7r9�__eq__�s 


���zPathCommand.__eq__cCrY)z*Returns last control point of path commandrI�rEr\rNr7r7r9�	end_point��zPathCommand.end_pointcC�td|j����)a6
        Enlarges given bbox to contain path element.

        :param (tuple of float) first: first point of path. Required to calculate Z segment
        :param (list of tuple) last_two_points: list with last two control points in abs coords.
        :param (BoundingBox) bbox: bounding box to update
        z$Bounding box is not implemented for �rJrC�rEr\�last_two_points�bboxr7r7r9�update_bounding_box�s
zPathCommand.update_bounding_boxcCrv)zWConvert command to :py:class:`Curve`
        Curve().to_curve() returns a copy
        zTo curve not supported for rw�rErNr]r7r7r9ro��zPathCommand.to_curvecCs|�||�gS)z6Convert command to list of :py:class:`Curve` commands �ror|r7r7r9�	to_curves��zPathCommand.to_curvescCst|�t�|��S)z:Converts this segment to a line (copies if already a line))r!rtrrMr7r7r9�to_line�szPathCommand.to_lineN) r;r<r=r>rar
rCrWrF�propertyrKrLrOrPrTr`rV�staticmethodrXrZr^�classmethodrcrhrirrrtr{rrorr�r7r7r7r9r>s>





c@sdeZdZdZedd��Zedd��Zdd�Zdd	�Zd
d�Z	dd
�Z
e�fdd�Ze�fdd�Z
dS)�RelativePathCommandz�
    Abstract base class for relative path commands.

    Implements most of methods of :py:class:`PathCommand` through
    conversion to :py:class:`AbsolutePathCommand`
    cC�dS�NTr7rDr7r7r9rK�rGzRelativePathCommand.is_relativecCr��NFr7rDr7r7r9rL�rGzRelativePathCommand.is_absolutecCs|�|��|||�Sr6)rPr^r[r7r7r9r^�rdz"RelativePathCommand.control_pointscC�|j|j�Sr6��	__class__rZrMr7r7r9rO��zRelativePathCommand.to_relativecCs|�|d��|||�dS�Nr?)rPr{rxr7r7r9r{�sz'RelativePathCommand.update_bounding_boxcCs|�|��||�Sr6)rPrtrsr7r7r9rt��zRelativePathCommand.end_pointcC�|�|��||�Sr6)rPror|r7r7r9ro�r�zRelativePathCommand.to_curvecCr�r6)rPrr|r7r7r9r�r�zRelativePathCommand.to_curvesN)r;r<r=r>r�rKrLr^rOr{rtrrorr7r7r7r9r��s

r�c@sPeZdZdZedd��Zedd��Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�ZdS)rzd
    Absolute path command. Unlike :py:class:`RelativePathCommand` can be transformed directly.
    cCr�r�r7rDr7r7r9rK�rGzAbsolutePathCommand.is_relativecCr�r�r7rDr7r7r9rL�rGzAbsolutePathCommand.is_absolutecCr�r6r�)rErqr7r7r9rP��zAbsolutePathCommand.to_absolutecCrY)z]Returns new transformed segment

        :param transform: a transformation to apply
        rI�rE�	transformr7r7r9r��szAbsolutePathCommand.transformcCs|�t||d|dfd��S)z�
        Returns new transformed segment

        :param degrees: rotation angle in degrees
        :param center: invariant point of rotation
        rr	��rotate�r�r
)rE�degrees�centerr7r7r9r��szAbsolutePathCommand.rotatecC�|�t|d��S)z*Translate or scale this path command by dr��	translater�)rE�drr7r7r9r��zAbsolutePathCommand.translatecCr�)z\Returns new transformed segment

        :param factor: scale or (scale_x, scale_y)
        ��scaler�)rE�factorr7r7r9r�r}zAbsolutePathCommand.scaleN)r;r<r=r>r�rKrLrPr�r�r�r�r7r7r7r9r�s

	c@�feZdZdZdZedd��Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Ze
�fdd�Zdd�ZdS)r!zLine segment�cC�|j|jfSr6��x�yrDr7r7r9rZr�z	Line.argscC�||_||_dSr6r��rEr�r�r7r7r9�__init__�
z
Line.__init__cCs*|t|dj|jf|dj|jf�7}dSr��rr�r�rxr7r7r9r{�*zLine.update_bounding_boxcc��t|j|j�VdSr6�rr�r�r[r7r7r9r^��zLine.control_pointscC�t|j|j|j|j�Sr6�r"r�r�rMr7r7r9rO �zLine.to_relativecC�t|�|j|jf��Sr6)r!�apply_to_pointr�r�r�r7r7r9r�$�zLine.transformcC�t|j|j�Sr6r�rsr7r7r9rt(�zLine.end_pointcCst|j|j|j|j|j|j�Sr6)r+r�r�r|r7r7r9ro,sz
Line.to_curvecC�t|j|j�Sr6�r!r�r�rsr7r7r9�reverse0�zLine.reverseN�r;r<r=r>rar�rZr�r{r^rOr�rtrror�r7r7r7r9r!s
r!c@�8eZdZdZdZedd��Zdd�Zdd�Zd	d
�Z	dS)r"zRelative line segmentr�cCr�r6��dx�dyrDr7r7r9rZ8r�z	line.argscCr�r6r��rEr�r�r7r7r9r�<r�z
line.__init__cC�t|j|j|j|j�Sr6)r!r�r�r�r�rMr7r7r9rP@�zline.to_absolutecC�t|j|j�Sr6)r"r�r�rsr7r7r9r�C�zline.reverseN�
r;r<r=r>rar�rZr�rPr�r7r7r7r9r"3s
r"c@sjeZdZdZdZeZedd��Zdd�Z	dd�Z
d	d
�Zdd�Zd
d�Z
dd�Ze�fdd�Zdd�ZdS)r#zMove pen segment without a liner�cCr�r6r�rDr7r7r9rZLr�z	Move.argscCr�r6r�r�r7r7r9r�Pr�z
Move.__init__cCs|t|j|j�7}dSr6r�rxr7r7r9r{T�zMove.update_bounding_boxccr�r6r�r[r7r7r9r^Wr�zMove.control_pointscCr�r6�r$r�r�rMr7r7r9rO[r�zMove.to_relativecCr�r6)r#r�r�r�r�r7r7r9r�_r�zMove.transformcCr�r6r�rsr7r7r9rtcr�zMove.end_pointcC�td��)Nz-Move segments can not be changed into curves.�rnr|r7r7r9rog�z
Move.to_curvecC�t|j|j�Sr6)r#r�r�rsr7r7r9r�kr�zMove.reverseN)r;r<r=r>rar!rFr�rZr�r{r^rOr�rtrror�r7r7r7r9r#Fs
r#c@s<eZdZdZdZeZedd��Zdd�Z	dd�Z
d	d
�ZdS)r$zRelative move segmentr�cCr�r6r�rDr7r7r9rZtr�z	move.argscCr�r6r�r�r7r7r9r�xr�z
move.__init__cCr�r6)r#r�r�r�r�rMr7r7r9rP|r�zmove.to_absolutecCr�r6r�rsr7r7r9r�r�zmove.reverseN)r;r<r=r>rar"rFr�rZr�rPr�r7r7r7r9r$ns
r$c@sbeZdZdZdZeZedd��Zdd�Z	dd�Z
d	d
�Zdd�Zd
d�Z
e�fdd�Zdd�ZdS)r%zClose segment to finish a pathrcCr��Nr7r7rDr7r7r9rZ�rGzZoneClose.argscCsdSr6r7rxr7r7r9r{�szZoneClose.update_bounding_boxcC�t�Sr6�r%r�r7r7r9r��ruzZoneClose.transformccs�|VdSr6r7r[r7r7r9r^�s�
zZoneClose.control_pointscCr�r6)r&rMr7r7r9rO�ruzZoneClose.to_relativecCs|Sr6r7rsr7r7r9rt�rGzZoneClose.end_pointcCr�)Nz2ZoneClose segments can not be changed into curves.r�r|r7r7r9ro�r�zZoneClose.to_curvecCr�r6r�rsr7r7r9r��r�zZoneClose.reverseN)r;r<r=r>rar#rFr�rZr{r�r^rOrtrror�r7r7r7r9r%�s
r%c@s4eZdZdZdZeZedd��Zdd�Z	dd�Z
d	S)
r&z&Same as above (svg says no difference)rcCr�r�r7rDr7r7r9rZ�rGzzoneClose.argscCr�r6r�rMr7r7r9rP�szzoneClose.to_absolutecCs*t|j|j|j|j|j|j�Sr6r�rsr7r7r9r��r�zzoneClose.reverseN)r;r<r=r>rar#rFr�rZrPr�r7r7r7r9r&�s
r&c@�veZdZdZdZedd��Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
e�fdd�Zdd�Zdd�ZdS)r'zHorizontal Line segmentr	cC�|jfSr6�r�rDr7r7r9rZ�r�z	Horz.argscC�
||_dSr6r�)rEr�r7r7r9r���
z
Horz.__init__cCs$|t|dj|jf|dj�7}dSr�r�rxr7r7r9r{��$zHorz.update_bounding_boxccs�t|j|j�VdSr6r�r[r7r7r9r^�r�zHorz.control_pointscC�t|j|j�Sr6)r(r�rMr7r7r9rO�r�zHorz.to_relativecCrQr6�r�rRr7r7r9rT��
zHorz.to_non_shorthandcCr�)Nz/Horizontal lines can't be transformed directly.r�)rE�transformationr7r7r9r��r�zHorz.transformcCst|j|j�Sr6r�rsr7r7r9rt�r�zHorz.end_pointcC�|�|��|�S�z&Convert a horizontal line into a curve�r�ror|r7r7r9ro�sz
Horz.to_curvecCst|j|j�S�z*Return this path command as a Line insteadr�rMr7r7r9r��r�zHorz.to_linecC�
t|j�Sr6)r'r�rsr7r7r9r��r�zHorz.reverseN)r;r<r=r>rar�rZr�r{r^rOrTr�rtrror�r�r7r7r7r9r'�s
r'c@�HeZdZdZdZedd��Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�ZdS)r(zRelative horz line segmentr	cCr�r6�r�rDr7r7r9rZ�r�z	horz.argscCr�r6r�)rEr�r7r7r9r��r�z
horz.__init__cC�t|j|j�Sr6)r'r�r�rMr7r7r9rP��zhorz.to_absolutecCrQr6r�rRr7r7r9rT�r�zhorz.to_non_shorthandcCst|j|j|j�Sr�)r!r�r�r�rMr7r7r9r��rdzhorz.to_linecC�t|j�Sr6)r(r�rsr7r7r9r��r�zhorz.reverseN�r;r<r=r>rar�rZr�rPrTr�r�r7r7r7r9r(��
r(c@sveZdZdZdZedd��Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Ze�fdd�Zdd�ZdS)r)zVertical Line segmentr	cCr�r6�r�rDr7r7r9rZr�z	Vert.argscCr�r6r�)rEr�r7r7r9r�r�z
Vert.__init__cCs$|t|dj|dj|jf�7}dSr�r�rxr7r7r9r{r�zVert.update_bounding_boxcCr�)Nz-Vertical lines can't be transformed directly.r�r�r7r7r9r�szVert.transformccs�t|j|j�VdSr6r�r[r7r7r9r^r�zVert.control_pointscCrQr6r�rRr7r7r9rTr�zVert.to_non_shorthandcCr�r6)r*r�rMr7r7r9rOr�zVert.to_relativecCst|j|j�Sr6r�rsr7r7r9rtr�zVert.end_pointcCst|j|j�S�z*Return this path command as a line insteadr�rMr7r7r9r�!r�zVert.to_linecCr�r�r�r|r7r7r9ro&r�z
Vert.to_curvecCr�r6)r)r�rsr7r7r9r�*r�zVert.reverseN)r;r<r=r>rar�rZr�r{r�r^rTrOrtr�rror�r7r7r7r9r)�s
r)c@r�)r*zRelative vertical line segmentr	cCr�r6�r�rDr7r7r9rZ2r�z	vert.argscCr�r6r�)rEr�r7r7r9r�6r�z
vert.__init__cCr�r6)r)r�r�rMr7r7r9rP9r�zvert.to_absolutecCrQr6r�rRr7r7r9rT<r�zvert.to_non_shorthandcCst|j|j|j�Sr�)r!r�r�r�rMr7r7r9r�@rdzvert.to_linecCr�r6)r*r�rsr7r7r9r�Dr�zvert.reverseNr�r7r7r7r9r*-r�r*c@sneZdZdZdZedd��Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Ze
�fdd�Zdd�Zdd�ZdS)r+zAbsolute Curved Line segment�cC�|j|j|j|j|j|jfSr6��x2�y2�x3�y3�x4�y4rDr7r7r9rZK�z
Curve.argscC�(||_||_||_||_||_||_dSr6r�)rEr�r�r�r�r�r�r7r7r9r�O�
zCurve.__init__c
Cs�ddlm}|dj|j|j|jf\}}}}|dj|j|j|j	f\}	}
}}||jvr:||jvr:||jvr:||jvsF|j|||||�7_|	|jvrZ|
|jvrZ||jvrZ||jvsh|j||	|
||�7_dSdS)Nr	)�
cubic_extremar?)
�
transformsr�r�r�r�r�r�r�r�r�)
rEr\ryrzr��x1r�r�r��y1r�r�r�r7r7r9r{Ys  







�zCurve.update_bounding_boxcCsT|�|j|jf�\}}|�|j|jf�\}}|�|j|jf�\}}t||||||�Sr6)r�r�r�r�r�r�r�r+)rEr�r�r�r�r�r�r�r7r7r9r�kszCurve.transformccs6�t|j|j�Vt|j|j�Vt|j|j�VdSr6)rr�r�r�r�r�r�r[r7r7r9r^rs�zCurve.control_pointscCsBt|j|j|j|j|j|j|j|j|j|j|j|j�Sr6)	r,r�r�r�r�r�r�r�r�rMr7r7r9rOx�
�zCurve.to_relativecCr�r6�rr�r�rsr7r7r9rtr�zCurve.end_pointcCs
t|j�S)z0No conversion needed, pass-through, returns self)r+rZr|r7r7r9ro�r�zCurve.to_curvecCs4t|jdd��t|jdd��t|jdd��gS)z(Returns the list of coords for SuperPathNr��r�)�listrZrDr7r7r9�to_bez�s4zCurve.to_bezcCst|j|j|j|j|j|j�Sr6)r+r�r�r�r�r�r�rsr7r7r9r��sz
Curve.reverseN)r;r<r=r>rar�rZr�r{r�r^rOrtrror�r�r7r7r7r9r+Gs

r+c@r�)r,zRelative curved line segmentr�cCr�r6��dx2�dy2�dx3�dy3�dx4�dy4rDr7r7r9rZ�r�z
curve.argscCr�r6r�)rEr�r�rrrrr7r7r9r��r�zcurve.__init__cCsBt|j|j|j|j|j|j|j|j|j|j|j|j�Sr6)	r+r�r�r�r�rrrrrMr7r7r9rP�r�zcurve.to_absolutecCsBt|j|j|j|j|j|j|j|j|j|j�Sr6)r,rrrrr�r�rsr7r7r9r��s
�z
curve.reverseNr�r7r7r7r9r,�s

r,c@sneZdZdZdZedd��Zdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
e�fdd�Zdd�ZdS)r-z%Absolute Smoothed Curved Line segmentr�cC�|j|j|j|jfSr6�r�r�r�r�rDr7r7r9rZ�rdzSmooth.argscC�||_||_||_||_dSr6r)rEr�r�r�r�r7r7r9r���
zSmooth.__init__cC�"|�|d|d��|||�dS�Nr?���)ror{rxr7r7r9r{�rjzSmooth.update_bounding_boxccsz�|j|j|j|jf\}}}}|j|j|j|jf\}}	}
}d||}d|	|}	t||	�Vt||
�Vt||�VdS�Nr�)r�r�r�r�r�r�r)rEr\rNr]r�r�r�r�r�r�r�r�r7r7r9r^�s�zSmooth.control_pointscC�|�||�Sr6r~rRr7r7r9rT�r�zSmooth.to_non_shorthandcC�.t|j|j|j|j|j|j|j|j�Sr6)r.r�r�r�r�r�r�rMr7r7r9rO���zSmooth.to_relativecC�:|�|j|jf�\}}|�|j|jf�\}}t||||�Sr6)r�r�r�r�r�r-)rEr�r�r�r�r�r7r7r9r���zSmooth.transformcCr�r6r�rsr7r7r9rt�r�zSmooth.end_pointc	Cs2|�|||�\\}}\}}\}}t||||||�S)z�
        Convert this Smooth curve to a regular curve by creating a mirror
        set of nodes based on the previous node. Previous should be a curve.
        )r^r+)	rErNr]r�r�r�r�r�r�r7r7r9ro�s zSmooth.to_curvecC�t|j|j|j|j�Sr6)r-r�r�r�r�rsr7r7r9r��r�zSmooth.reverseN)r;r<r=r>rar�rZr�r{r^rTrOr�rtrror�r7r7r7r9r-�s
	r-c@�@eZdZdZdZedd��Zdd�Zdd�Zd	d
�Z	dd�Z
d
S)r.z%Relative smoothed curved line segmentr�cCrr6�rrrrrDr7r7r9rZ�rdzsmooth.argscCrr6r)rErrrrr7r7r9r��s
zsmooth.__init__cC�.t|j|j|j|j|j|j|j|j�Sr6)r-rr�rr�rrrMr7r7r9rP�rzsmooth.to_absolutecCr�r6�rPrTrRr7r7r9rTr�zsmooth.to_non_shorthandcC�*t|j|j|j|j|j|j�Sr6)r.rrrrrsr7r7r9r�r�zsmooth.reverseN�r;r<r=r>rar�rZr�rPrTr�r7r7r7r9r.�s
r.c@r�)r/z&Absolute Quadratic Curved Line segmentr�cCrr6�r�r�r�r�rDr7r7r9rZrdzQuadratic.argscCrr6r)rEr�r�r�r�r7r7r9r�rzQuadratic.__init__cCs�ddlm}|dj|j|j}}}|dj|j|j}}	}
||jvr/||jvr/||jvs:|j||||�7_||jvrI|	|jvrI|
|jvsV|j|||	|
�7_dSdS)Nr	)�quadratic_extremar?)r�rr�r�r�r�r�r�)rEr\ryrzrr�r�r�r�r�r�r7r7r9r{s





�zQuadratic.update_bounding_boxccs&�t|j|j�Vt|j|j�VdSr6)rr�r�r�r�r[r7r7r9r^*s�zQuadratic.control_pointscCr
r6)r0r�r�r�r�r�r�rMr7r7r9rO/s�zQuadratic.to_relativecCrr6)r�r�r�r�r�r/)rEr�r�r�r�r�r7r7r9r�6rzQuadratic.transformcCr�r6�rr�r�rsr7r7r9rt<r�zQuadratic.end_pointcCsnt|�}d|jd|j}d|jd|j}d|jd|j}d|jd|j}t|||||j|j�S)z)Attempt to convert a quadratic to a curvegUUUUUU�?gUUUUUU�?)rr�r�r�r�r�r�r+)rErNr]r�r�r�r�r7r7r9ro@szQuadratic.to_curvecCrr6)r/r�r�r�r�rsr7r7r9r�Jr�zQuadratic.reverseNr�r7r7r7r9r/
s

r/c@r�)r0zRelative quadratic line segmentr�cCrr6)r�r�rrrDr7r7r9rZRrdzquadratic.argscCs||_||_||_||_dSr6)r�rr�r)rEr�r�rrr7r7r9r�V�
zquadratic.__init__cCrr6)r/r�r�r�r�rrrMr7r7r9rP\rzquadratic.to_absolutecCrr6)r0r�r�r�r�rsr7r7r9r�br�zquadratic.reverseNr�r7r7r7r9r0Ns
r0c@r�)r1z Continued Quadratic Line segmentr�cCr�r6�r�r�rDr7r7r9rZir�zTepidQuadratic.argscCr�r6r)rEr�r�r7r7r9r�mr�zTepidQuadratic.__init__cCrr	)�to_quadraticr{rxr7r7r9r{qrjz"TepidQuadratic.update_bounding_boxc
csb�|j|j|j}}}|j|j|j}}}	d||}d||}t||�Vt||	�VdSr)r�r�r�r�r)
rEr\rNr]r�r�r�r�r�r�r7r7r9r^ts�zTepidQuadratic.control_pointscCrr6)rrRr7r7r9rT�r�zTepidQuadratic.to_non_shorthandcCst|j|j|j|j�Sr6)r2r�r�r�r�rMr7r7r9rO�s�zTepidQuadratic.to_relativecCs |�|j|jf�\}}t||�Sr6)r�r�r�r1)rEr�r�r�r7r7r9r��s
zTepidQuadratic.transformcCr�r6rrsr7r7r9rt�r�zTepidQuadratic.end_pointcCs|�||��|�Sr6)rror|r7r7r9ro�r�zTepidQuadratic.to_curvecCs(|�|||�\\}}\}}t||||�S)zH
        Convert this continued quadratic into a full quadratic
        )r^r/)rErNr]r�r�r�r�r7r7r9r�szTepidQuadratic.to_quadraticcCr�r6)r1r�r�rsr7r7r9r��r�zTepidQuadratic.reverseN)r;r<r=r>rar�rZr�r{r^rTrOr�rtrrorr�r7r7r7r9r1es

r1c@r)r2z)Relative continued quadratic line segmentr�cCr�r6�rrrDr7r7r9rZ�r�ztepidQuadratic.argscCr�r6r)rErrr7r7r9r��r�ztepidQuadratic.__init__cCst|j|j|j|j�Sr6)r1rr�rr�rMr7r7r9rP�s�ztepidQuadratic.to_absolutecCr�r6rrRr7r7r9rT�r�ztepidQuadratic.to_non_shorthandcCr�r6)r2rrrsr7r7r9r��r�ztepidQuadratic.reverseNrr7r7r7r9r2�s
r2c@sfeZdZdZdZedd��Zdd�Zdd�Zd	d
�Z	e
�fdd�Zd
d�Zdd�Z
dd�Zdd�ZdS)r3zSpecial Arc segment�cC� |j|j|j|j|j|j|jfSr6��rx�ry�x_axis_rotation�	large_arc�sweepr�r�rDr7r7r9rZ�� zArc.argscC�.||_||_||_||_||_||_||_dSr6r!)rEr"r#r$r%r&r�r�r7r7r9r���
zArc.__init__cCs<|d}|j|d�D]}|�|d|g|�|�||�}q
dS)Nr?)rN)rr{rt)rEr\ryrzrN�segr7r7r9r{�s
�zArc.update_bounding_boxccr�r6r�r[r7r7r9r^�r�zArc.control_pointscCs.ttt|�|j�g�jdd�}t|�dd�S)z#Convert this arc into bezier curvesT)�curves_onlyr	N)r �arc_to_pathr�rZ�to_path)rErNr]�pathr7r7r9r�sz
Arc.to_curvescCs|�|j|jf�\}}|}|jdkr|t|jd�}t|���\}}}}}	}	||||}
|
d}t|j�}t|j	�}
|dksH|
dksH|dkrWt
|j|j	|j|j|j||�S|d|d|d|
d|}|||d|||
d|}|d|d|d|
d|}t
d|||�d}|dt}||}d|d|d}|dkr�d}nd|dd|dt|�}||d}d	t||�}d	t||�}|�|j|jf�\}}|
dkr�|j}n	|jdkr�dnd
}t
||||j|||�S)Nrr�r��r
��f@r�g�?��?r	)r�r�r�r$r
r��to_hexad�floatr"r#r3r%r&rrr)rEr��x_�y_�T�a�c�b�d�_�detT�detT2r"r#�A�B�D�theta�	theta_deg�DA�l2�delta�half�rx_�ry_r&r7r7r9r��s:


$&$"z
Arc.transformc	Cs.t|j|j|j|j|j|j|j|j|j�Sr6)r4r"r#r$r%r&r�r�rMr7r7r9rOs.zArc.to_relativecCr�r6r�rsr7r7r9rtr�z
Arc.end_pointcCs$t|j|j|j|j|j|j|j�Sr6)r3r"r#r$r%r&r�r�rsr7r7r9r�r�zArc.reverseN)r;r<r=r>rar�rZr�r{r^rrr�rOrtr�r7r7r7r9r3�s
	2r3c@r�)r4zRelative Arc line segmentrcCr r6�r"r#r$r%r&r�r�rDr7r7r9rZ!r'zarc.argscCr(r6rI)rEr"r#r$r%r&r�r�r7r7r9r�%r)zarc.__init__c	Cs2|\}}t|j|j|j|j|j|j||j|�Sr6)r3r"r#r$r%r&r�r�)rErNr�r�r7r7r9rP.s*zarc.to_absolutecCs(t|j|j|j|j|j|j|j�Sr6)r4r"r#r$r%r&r�r�rsr7r7r9r�2s(zarc.reverseNr�r7r7r7r9r4s
	r4�M�L�V�Hr>�C�S�Z�Qr6�m�l�v�hr7r8�s)�z�q�tcs�eZdZdZGdd�d�Zd2�fdd�	Zedd��Zd	d
�Z�fdd�Z	d3dd�Z
d3dd�Zd4dd�Ze
dd��Ze
dd��Zd3dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Z�ZS)5rz8A list of segment commands which combine to draw a shapec@s�eZdZdZdd�Zedd��Zedd��Zedd	��Zed
d��Z	edd
��Z
edd��Zedd��Zedd��Z
dd�Zdd�Zdd�Zdd�Zdd�ZdS)zPath.PathCommandProxyz�
        A handy class for Path traverse and coordinate access

        Reduces number of arguments in user code compared to bare :py:class:`PathCommand` methods
        cCrr6)�command�first_point�previous_end_point�prev2_control_point)rErZr[r\r]r7r7r9r�XrzPath.PathCommandProxy.__init__cC�|jjSr6)rZrCrDr7r7r9rC^r�zPath.PathCommandProxy.namecCr^r6)rZrWrDr7r7r9rWbr�zPath.PathCommandProxy.lettercCr^r6)rZrFrDr7r7r9rFfr�z"Path.PathCommandProxy.next_commandcCr^r6)rZrKrDr7r7r9rKjr�z!Path.PathCommandProxy.is_relativecCr^r6)rZrLrDr7r7r9rLnr�z!Path.PathCommandProxy.is_absolutecCr^r6)rZrZrDr7r7r9rZrr�zPath.PathCommandProxy.argscCs|j�|j|j|j�Sr6)rZr^r[r\r]rDr7r7r9r^vr�z$Path.PathCommandProxy.control_pointscC�|j�|j|j�Sr6)rZrtr[r\rDr7r7r9rtzr�zPath.PathCommandProxy.end_pointcCr_r6)rZr�rtr\rDr7r7r9r�~r�zPath.PathCommandProxy.reversecCr_r6)rZror\r]rDr7r7r9ro�r�zPath.PathCommandProxy.to_curvecCr_r6)rZrr\r]rDr7r7r9r�r�zPath.PathCommandProxy.to_curvescCs
t|j�Sr6)�strrZrDr7r7r9rh�r�zPath.PathCommandProxy.__str__cCsd|jjdt|j�S)N�<�>)r�r;�reprrZrDr7r7r9ri�r�zPath.PathCommandProxy.__repr__N)r;r<r=r>r�r�rCrWrFrKrLrZr^rtr�rorrhrir7r7r7r9�PathCommandProxyQs0







rdNcs�t���t|t�r|�|�}n	t|t�r|��}|pdD]L}t|t�r*|�|�qt|t	t
f�rWt|�dkrWt|dt	t
f�rO|�t�|d�|d��q|�t
|��qtdt|�j�dt|�j�d|����dS)Nr7r�r	rzBad path type: �(z, ...): )�superr�rlr`�parse_stringr r-r�appendr�rm�lenrXr!�	TypeErrorrkr;)rE�path_d�item�r�r7r9r��s



&�z
Path.__init__ccs��t�|�D]=\}}tt|��}t�|�}d}|t|�ks"|jdkrC|||||j��}||j7}|j}|V|t|�ks"|jdks"qdS)z0Parse a path string and generate segment objectsrN)	�LEX_REX�findallr�rrrXrirarF)rArk�cmd�numbersrZ�ir*r7r7r9rg�s�

���zPath.parse_stringcCsh|sdS|��}t|�}t|jj|jj�}z	t|�}|j�|j|j|j	g|�qt
y3|YSw)zReturn bounding box of the PathN)�proxy_iterator�nextrr[r�r�rZr{r]r\�
StopIteration)rE�iterator�proxyrzr7r7r9�bounding_box�s$
����zPath.bounding_boxcs:t|t�r|�|�dSt|t�rtt|��|�dSdS)z<Append a command to this path including any chained commandsN)rlr��extendrrfrrh)rErprmr7r9rh�s


�zPath.appendFcC�|jt||fd�|d�S)z0Move all coords in this path by the given amountr���inplacer��rEr�r�r|r7r7r9r���zPath.translatecCrz)z2Scale all coords in this path by the given amountsr�r{r�r}r7r7r9r��r~z
Path.scalecCsH|dur|��}|r|j}nt�}t|�}|jt||j|jfd�|d�S)z&Rotate the path around the given pointNr�r{)rxr�rr�r
r�r�)rE�degr�r|rzr7r7r9r��szPath.rotateccs`�t�}t�}t�}t|�D]\}}|dkr|�||�}|�|||�D]	}|}|}|Vq#qdSrB)r�	enumeratertr^)rErNr]r\rrr*�cpr7r7r9r^�s���zPath.control_pointsccsN�t�}t�}t|�D]\}}|dkr|�||�}|�||�}|}|VqdSrB)rr�rt)rErNr\rrr*rtr7r7r9�
end_points�s��zPath.end_pointscCs�t�}t�}t�}d}t�}t�}t|�D]U\}	}
|r!|
�||�}t|
ttttf�r/|
�	|�}
|
j
r>|
�|��|��
|�}n|
�|�}|rK|�||�}|rR|||	<n|�|�|
�||�}|�||�}t|
ttf�}q|ro|S|S)zConvert to new pathT)rrr�rtrlr(r'r)r*r�rKrPr�rOrhr&r%)rEr�r|�resultrq�previous_new�
start_zoner\�	first_newrrr*�new_segr7r7r9r��s2



zPath.transformcCs�t�}|j�^}}ttt|�����D]1\}}|dkr=|jdkr,|�dt|j	|j
��q|jdkr<|�dt|j	|j
��q|�|�
��q|dj��dkrU|�|d�|S)zReturns a reversed pathrrJrRr?rW)rr��reversedr�r�rsrW�insertr#r�r�r$rhr��lower)rEr�r;r\�indexrZr7r7r9r�s

�zPath.reversecCs.|rt|dttf�s|�t��dSdSdS)z&Attempt to close the last path segmentr?N)rlr&r%rhrDr7r7r9�close-s�z
Path.closeccs��t�}t�}t�}t|�D]9\}}|dkr |�||�}}}t�||||�Vt|tttt	t
ttt
f�rAt|�|||��d}|�||�}qdS)zm
        Yields :py:class:`AugmentedPathIterator`

        :rtype: Iterator[ Path.PathCommandProxy ]
        rr
N)rr�rtrrdrlr,r2r0r.r+r1r/r-r�r^)rErqr]r\rrr*r7r7r9rs2s���zPath.proxy_iteratorcC�
|�d�S)z2Convert this path to use only absolute coordinatesT��_to_absoluterDr7r7r9rPFr�zPath.to_absolutecCr�)z@Convert this path to use only absolute non-shorthand coordinatesFr�rDr7r7r9rTJrUzPath.to_non_shorthandcCs�t�}t�}t�}|D]D}t|ttf�r|�||�}|r%|�|�|��n$|r>t|dtt	f�r>t
|d�ddd��d}n|}|�|�||��|�||�}q|S)zj
        :param (bool) shorthand: If false, then convert all shorthand commands to non-shorthand.
        r?Nr
)
rrrlr$r#rtrhrPr+r/r�r^rT)rE�	shorthand�abspathrqr\r*rSr7r7r9r�OszPath._to_absolutecCsVt�}t�}t�}|D]}t|ttf�r|�||�}|�|�|��|�||�}q|S)z2Convert this path to use only relative coordinates)rrrlr$r#rtrhrO)rEr�rqr\r*r7r7r9rOjszPath.to_relativecCsd�dd�|D��S)NrecSsg|]}t|��qSr7)r`��.0r*r7r7r9�
<listcomp>{sz Path.__str__.<locals>.<listcomp>)r_rDr7r7r9rhzszPath.__str__cCs4t�|�}t|t�rt|�}t|t�r|�|�|Sr6)�copy�deepcopyrlr`rr�ry)rErp�acopyr7r7r9�__add__}s



zPath.__add__cCsdd�|��D�S)z�Returns path in format of parsePath output, returning arrays of absolute command data

        .. deprecated:: 1.0
            This is compatibility function for older API. Should not be used in new code

        cSsg|]
}|jt|j�g�qSr7)rWr�rZr�r7r7r9r��sz"Path.to_arrays.<locals>.<listcomp>)rTrDr7r7r9�	to_arrays�szPath.to_arrayscCst|�S)z)Convert this path into a cubic super path)r rDr7r7r9�to_superpath�r�zPath.to_superpathcCs
t�|�S)zMake a copy)r�r�rDr7r7r9r��r�z	Path.copyr6�Fr�)r;r<r=r>rdr�r�rgrxrhr�r�r�r�r^r�r�r�r�rsrPrTr�rOrhr�r�r�r��
__classcell__r7r7rmr9rNs8<






#	rcspeZdZdZ�fdd�Zdd�Z�fdd�Zdd	�Zed
d��Z	dd
d�Z
ddd�Zdd�Ze
dd��Z�ZS)r a>
    A conversion of a path into a predictable list of cubic curves which
    can be operated on as a list of simplified instructions.

    When converting back into a path, all lines, arcs etc will be converted
    to curve instructions.

    Structure is held as [SubPath[(point_a, bezier, point_b), ...]], ...]
    cs\t���d|_t�|_t�|_t|t�rt|�}t|t�r"|�	�}|D]}|�
|�q$dSr�)rfr��_closedr�_prev�
_prev_prevrlr`rrPrh)rE�itemsrlrmr7r9r��s


�zCubicSuperPath.__init__cCst|���Sr6)r`r-rDr7r7r9rh�r�zCubicSuperPath.__str__cs4t|t�rt|�dkrt|dt�rt�|d�|d�}d}t|t�r�t|t�rC|jdur4t��	g�t|j
�t|j
�t|j
�g}n�t|t�r�|r�|dr�|d�	|ddddd�|ddddd�|ddddd�g�d|_|j�
|j�dSt|t�r�|�|j|j�D] }|j
\}}}}}}	|�	||g||g||	gg�|j�
||�q�dSt|ttttf�}t|ttf�r�|�|j�}|j}
|r�t|�|j|j|
��dd�d|_|�|j|
�}t|t�r�|��}t|t�s�td	|����t|�d
k�stdd�|D���sIt|d�d
k�rBtd
d�|dD���rBt��	|�|��t |ddd�|_t |ddd�|_dStd|����|j�rVd|_t��	g�|d�ri|ddd�|ddd<|d�	|dd�t!�"|�dd��t |ddd�|_|�s�t |ddd�|_dSdS)z.Accept multiple different formats for the datar�rr	Fr?NTr
zUnknown super curve item type: �cS�g|]}t|�dk�qS�r��ri�r��bitr7r7r9r���z)CubicSuperPath.append.<locals>.<listcomp>cSr�r�r�r�r7r7r9r��r�z!Unknown super curve list format: )#rlr�rir`rrXr#r�rfrhrZr%r��assign�_firstr3rr�r/r1r0r2r'r)r�r^ror+r�rn�all�_cleanrr�r�)rErl�is_quadratic�	arc_curver�r�r�r�r�r��pprmr7r9rh�s^$


P
$

"*
(�zCubicSuperPath.appendcs$t|ttf�r�fdd�|D�S|S)z2Recursively clean lists so they have the same typecsg|]}��|��qSr7)r�)r��childrDr7r9r��sz)CubicSuperPath._clean.<locals>.<listcomp>)rlrmr�)rE�lstr7rDr9r��szCubicSuperPath._cleancCs0zt|ddd�WStyt�YSw)Nr?r)r�
IndexErrorrDr7r7r9r��s

�zCubicSuperPath._firstFcCstt|�|���S)z*Convert the super path back to an svg path)rr��to_segments)rEr+r7r7r9r-r�zCubicSuperPath.to_pathccs��|D]`}g}|D]Y}|st|ddd��VnG|�||�rE|sE||dur9t|d��|dd�r9t�Vn't|ddd��Vnt|ddd�|ddd�|ddd��V|}q	qdS)z4Generate a set of segments for this cubic super pathr	Nr?rr�)r#�is_liner�is_closer%r!r+)rEr+�subpathrq�segmentr7r7r9r�s�&
6��zCubicSuperPath.to_segmentscCs|���|���S)z0Apply a transformation matrix to this super path)r-r�r�r�r7r7r9r�r�zCubicSuperPath.transformcCs,t|d��|d�ot|d��|d�S)z=Check whether csp segment (two points) has retracted handles.r	r�r)rr�)rqr�r7r7r9r�s�zCubicSuperPath.is_liner�)r;r<r=r>r�rhrhr�r�r�r-r�r�r�r�r�r7r7rmr9r �s
B


r cCs|dd�}|dd�\}}}}}}}	|td}||	g}
|dks)|dks)||
krK|dd�|dd�|dd�g|
dd�|
dd�|
dd�ggStt|�d|dgdd|ggt|�f�}t||�t||
�|
d|d|
d|dg}|d|d|d|d}
|dt|
�<|dt|
�<ttdd|
d��}
||kr�|
d9}
|
d|dd	|
|d|
d|dd	|
|dg}|d|d|d|dg}|
d|d|
d|dg}t|dt|��}|ddk�r|d9}t|dt|��}|ddk�r|d9}|�r+||k�r+|d
t7}|�s9||k�r9|d
t8}tt	||�d
t�d}|||}dt
|d�d}g}td|dd�D][}|||}|dt|�|t
|�|dt
|�|t|�g}|dt|�|dt
|�g}|dt|�|t
|�|dt
|�|t|�g}|�|||g��qa|dddd�|dd<|dddd�|dd
<tt|�|dgd|ggt|�f�}|D]}t||d�t||d�t||d
��q�|S)
a�Approximates an arc with cubic bezier segments.

    Arguments:
    point:  Starting point (absolute coords)
    params: Arcs parameters as per
              https://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands

    Returns a list of triplets of points : [control_point_before, node, control_point_after]
    (first and last returned triplets are [p1, p1, *] and [*, p2, p2])
    Nr0rr1r/r	g@r?g@r�r�g@)r�matprod�rotmat�applymatr�maxr�norm�int�absr�rangerrrh)�point�paramsr>r"r#�teta�longflag�	sweepflagr�r�r?�mat�kr:�O�OA�OB�start�end�	NbSectors�dTetarT�prr�angle�v1�pt�v2�ptsr7r7r9r,"s^D,

" @  < 8$r,cCs�|d}|dd�D]j}|dd|dd|dd|dd}|dd|dd|dd|dd}|dd|dd|dd|dd}|dd|dd|dd|dd}||g||gg}q
|S)zGet the product of the matrr	Nr7)�mlist�prodr��a00�a01�a10�a11r7r7r9r�ms0000r�cCs"t|�t|�gt|�t|�ggS)zRotate the mat)rr)r�r7r7r9r�ys"r�cCsd|dd|d|dd|d}|dd|d|dd|d}||d<||d<dS)zApply the given matrr	Nr7)r�r�r�r�r7r7r9r�~s((r�cCs$t|d|d|d|d�S)�	Normaliserr	)r)r�r7r7r9r��s$r�)Fr>�rer��mathrrrrrrrr�r
rr�utilsr
r�typingrrrrrrrrrrrrr�__all__�compilern�NONErnr5rr�rr!r"r#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4rVr�rr r,r�r�r�r�r7r7r7r9�<module>s�$0
z(,'(#/.F AD>`��������	�
���
�����
�KK

Youez - 2016 - github.com/yon3zu
LinuXploit