HEX
Server: Apache
System: Linux opal14.opalstack.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
User: curbgloabal_opal (1234)
PHP: 8.1.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/share/inkscape/extensions/voronoi2svg.pyc
�
��Yc@s�dZddlZddlZddlZddlZddlZddlZddlZddlZdfd��YZ	dej
fd��YZedkr�e�Z
e
j�ndS(s

voronoi2svg.py
Create Voronoi diagram from seeds (midpoints of selected objects)

- Voronoi Diagram algorithm and C code by Steven Fortune, 1987, http://ect.bell-labs.com/who/sjf/
- Python translation to file voronoi.py by Bill Simons, 2005, http://www.oxfish.com/

Copyright (C) 2011 Vincent Nivoliers and contributors

Contributors
  ~suv, <suv-sf@users.sf.net>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

i����NtPointcBseZd�ZRS(cCs||_||_dS(N(txty(tselfRR((s-/usr/share/inkscape/extensions/voronoi2svg.pyt__init__+s	(t__name__t
__module__R(((s-/usr/share/inkscape/extensions/voronoi2svg.pyR*stVoronoi2svgcBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs	tjj|�|jjddddddd�|jjddddd	d
ddd
gdddddd�|jjddddd	d
ddgdddddd�|jjddddddtdddd�|jjddddddddddd�dS(Ns--tabtactiontstorettypetstringtdestttabs--diagram-typetchoicetchoicestVoronoitDelaunaytBothtdefaulttdiagramTypethelpsDefines the type of the diagrams
--clip-boxtPagesAutomatic from seedstclipBoxs/Defines the bounding box of the Voronoi diagrams--show-clip-boxtinkbooltshowClipBoxs*Set this to true to write the bounding boxs--delaunay-fill-optionssdelaunay-no-filltdelaunayFillOptionss(Set the Delaunay triangles color options(tinkextEffectRtOptionParsert
add_optiontFalse(R((s-/usr/share/inkscape/extensions/voronoi2svg.pyR0sD					cCs |d|d|d|dS(Nii((RRR((s-/usr/share/inkscape/extensions/voronoi2svg.pytdotYsc	Cs�|j||�|d}|j||�|d}||dkrQddtfS|j||�|j||�}|dkr�ddtfS|d|j||�|}d|}||d||d||d||dtfSdS(Niii(R RtTrue(	Rtlinetv1tv2ts1ts2ttmptutv((s-/usr/share/inkscape/extensions/voronoi2svg.pytintersectLineSegment\s
"

cCsg}|j|d|df�|j|d|df�|j|d|df�|j|d|df�||d}g}xStd�D]E}|j|||||dd�}	|	dr�|j|	�q�q�Wt|�dkr�gSt|�dkrtt|��}n||d}
|j|
d|
dtf�||d}|j|d|dtf�|dd}|dd}
|dd}|dd}xZ|D]R}t|d|�}t|d|
�}
t|d|�}t|d|�}q�W|
|||kr'|j	�n|j	dd��g}t}t}x�|D]�}|dr�|r�|r�|d|dg|d|dggSgSn|r�|}n|}qS|r�|r�|d|dg|d|dggSgSn|r�|}n|}qSWdS(NiiiiitkeycSs|dS(Ni((tpt((s-/usr/share/inkscape/extensions/voronoi2svg.pyt<lambda>�s(
tappendtrangeR*tlentlisttsetRtmintmaxtsort(RtverticestlinestedgetbboxtbbcR"tinterpointstitpR#R$tminxtmaxxtminytmaxytpointtstarttinsidet
startWrite((s-/usr/share/inkscape/extensions/voronoi2svg.pytclipEdgeisd%




&	
&	cCs�|j�}tj|jd��}|re|dk	r�|j|�}|r[tj||�S|Sq�n|dk	r~|j|�SdSdS(Nt	transform(t	getparenttsimpletransformtparseTransformtgettNonetgetGlobalTransformtcomposeTransform(RtnodetparenttmyTranstparentTrans((s-/usr/share/inkscape/extensions/voronoi2svg.pyRM�s

c2Cs�t|jj�dkr/tjtd��dSidd6t|jd��d6dd6d	d
6d	d6}idd6t|jd��d6dd6d	d
6d	d6}|j|j	|jjd�}|j
|�}d}|r�tj
|�}ng}g}g}g}	x�|jjD]�}
|j	|
}|j|�tj|g�}|rd|d|d
}
d|d|d}|
|g}|r�tj||�n|jt|d|d
��d}|jjdkr�|jjd�r�|jd�}|r�|jd�}x}t|�D]l\}}|jdd�}t|�dkr|\}}|j�j�}|dkr|j�}qqqWq�n|	j|�n|jt|
|��qqW|jjdkr!tjj|tjdd��}|jtjdd�d�|r!tj||�q!n|jjdkrstjj|tjdd��}|jtjdd�d�n|jjdkr�tj|�}d(}|jj dkr|j!j"�}|j|jd��}|j|jd��}d|d|f}nRd|d|d
d|d
|dd|d|dd|d|df}d|d|d
d|d
|dd|d|dd|d|df}|jt|d|d��|jt|d
|d��|jt|d
|d��|jt|d|d��|jj#r�tjj|tjdd��} | jdt|d��| jdt|d��| jdt|d
|d��| jdt|d|d��| jdt$j%|��q�n|jjdkr,t&j'|�\}!}"}#x|#D]}$|$d}%|$d
}&|$d}'|&dks|'dkrSqq|j(|!|"|$|�}(t|(�d
kr|(d})|(d
}*d |)d|)d
ggd!|*d|*d
ggg}+tjj)tjd"d��},|,jd#t*j+|+��|,jdt$j%|��|j|,�qqWn|jjdkr�t&j,|�}-d}|jjd$krut-j.d�nxw|-D]l}.||.d}/||.d
}0||.d}1d |/j/|/j0ggd!|0j/|0j0ggd!|1j/|1j0ggd%ggg}+|jjd$ks|jjd&kr�i|	|.t-j1dd�d6t|jd'��d6|	|.t-j1dd�d6d	d
6d	d6}ntjj)tjd"d��},|,jd#t*j+|+��|,jdt$j%|��|j|,�|d
7}q|WndS()NisPlease select objects!s#000000tstroket1pxsstroke-widthtnonetfilltroundsstroke-linecapsstroke-linejoing�?iiisdelaunay-no-filltstylet;t:RtgtsvgtlabeltinkscapeRRtwidththeighttrectRRtMtLtpathtds
delaunay-filltZsdelaunay-fill-randoms0.005px((2R0toptionstidsRterrormsgt_tstrtunittouut
getParentNodetselectedRMRLRItinvertTransformR.tcomputeBBoxtapplyTransformToPointRRtattribthas_keyRKtsplitt	enumeratetstriptlowerRtetreet
SubElementtaddNSR2tapplyTransformToNodeRtdocumenttgetrootRtsimplestyletformatStyletvoronoitcomputeVoronoiDiagramRFtElementt
simplepatht
formatPathtcomputeDelaunayTriangulationtrandomtseedRRt	randrange(2Rt	linestylet	facestyletparentGroupttranstinvtranstptstnodestseedstfillstidROR9tcxtcyR,RVRXtdeclarationsR<tdecltpartstproptvaltgroupVoronoit
groupDelaunaytgBboxRR\twthtsafeBoxRaR6R7tedgesR8R"tvindex1tvindex2tsegmentR#R$tcmdsRdt	trianglesttriangletp1tp2tp3((s-/usr/share/inkscape/extensions/voronoi2svg.pyteffect�s�

 

!!!""





4
$

(RRRR R*RFRMR�(((s-/usr/share/inkscape/extensions/voronoi2svg.pyR/s	)		
	K	t__main__(t__doc__tsystosRR~R�RIR�R�RRRRtetaffect(((s-/usr/share/inkscape/extensions/voronoi2svg.pyt<module>s�R