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/wireframe_sphere.pyc
�
��Yc@s�dZddlTddlZddlZddlmZddefdd�Zd	ejfd
��YZ	e
dkr�e	�Zej�ndS(sh	
Copyright (C) 2009 John Beard john.j.beard@gmail.com

######DESCRIPTION######

This extension renders a wireframe sphere constructed from lines of latitude
and lines of longitude.

The number of lines of latitude and longitude is independently variable. Lines 
of latitude and longtude are in separate subgroups. The whole figure is also in
its own group.

The whole sphere can be tilted towards or away from the veiwer by a given 
number of degrees. If the whole sphere is then rotated normally in Inkscape,
any position can be acheived.

There is an option to hide the lines at the back of the sphere, as if the 
sphere were opaque.
    #FIXME: Lines of latitude only have an approximation of the function needed
            to hide the back portion. If you can derive the proper equation,
            please add it in.
            Line of longitude have the exact method already.
            Workaround: Use the Inkscape ellipse tool to edit the start and end
            points of the lines of latitude to end at the horizon circle.
            
           
#TODO:  Add support for odd numbers of lines of longitude. This means breaking
        the line at the poles, and having two half ellipses for each line.
        The angles at which the ellipse arcs pass the poles are not constant and
        need to be derived before this can be implemented.
#TODO:  Add support for prolate and oblate spheroids

######LICENCE#######
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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

######VERSION HISTORY#####
    Ver.       Date                       Notes
    
    0.10    2009-10-25  First version. Basic spheres supported.
                        Hidden lines of latitude still not properly calculated.
                        Prolate and oblate spheroids not considered.
i����(t*N(tcomputePointInNodeiitc
CsB|\}}|\}}	idd6t|�d6dd6}
i
tj|
�d6t|�tjdd�6t|	�tjd	d�6t|�tjd
d�6t|�tjdd�6t|d�tjd
d�6t|d�tjdd�6dtjdd�6dtjdd�6|d6}tjj|tjdd�|�}dS(Ns#000000tstrokesstroke-widthtnonetfilltstyletcxtsodipoditcytrxtryitstartitendttruetopentarcttypet	transformtpathtsvg(tstrtsimplestyletformatStyletinkextaddNStetreet
SubElement(
t.0t.1twidthtparentt	start_endRR
RRR	Rtcirc_attribstcirc((s2/usr/share/inkscape/extensions/wireframe_sphere.pytdraw_SVG_ellipseBs



tWireframe_SpherecBseZd�Zd�ZRS(c
Cstjj|�|jjddddddddd	�|jjd
dddddddd�|jjd
dddddddd�|jjddddddddd�|jjddddddddd�|jjddddddddt�dS(Ns	--num_lattactiontstoreRtinttdesttNUM_LATtdefaultis
--num_longtNUM_LONGis--radiustfloattRADIUSgY@s--tilttTILTg�A@s
--rotationt
ROT_OFFSETis--hide_backtinkboolt	HIDE_BACK(RtEffectt__init__tOptionParsert
add_optiontFalse(tself((s2/usr/share/inkscape/extensions/wireframe_sphere.pyR3Vs&




cCs�|j}|jddkr2tjtd��n�|jdkrJd}nd}|jt|j�d�|_t	|j�t
d|_|jt
d|_|jd�}d	}tt
t|j�|j��}d
t|�|}d}i|tjdd
�6|d6}tjj|jd|�}	|jdkr�d}i|tjdd
�6}tjj|	d|�}
d|j}xmtd|jd�D]R}|j||t
d}
|
t
kr�|
dt
8}
n|jt|
�}|jt|
�t|j�}t	t|
��t|j�}|j|}||}t||�dt
}dt|�d}ddt
f}|jr�|
t
dkr�t
ddt
df}q�dt
dt
df}nt||jfd||
||�q�Wn|jdkr�d}i|tjdd
�6}tjj|	d|�}|jd|_d|j}x�td|j�D]k}||t
d}|jt|�}|jt|�t|j�}||}|jt|�t|j�}d}|jr�||jkr�|t
|jkr)t||f||f||�q�tt|t
d�tt
d|j��t
d}t
d|t
t
d|t
f}t||f||f|||�q�qat||f||f||�qaWnt|j|jfd||	�dS(Niis2Please enter an even number of lines of longitude.s
 scale(1, -1)Rtpxi�t1pxg����MbP?t	translatetWireframeSpheretlabeltinkscapeRtgsLines of Longitudeg�v@g�f@srotate(t)isLines of Latitudei(ii(ii(toptionsR+Rterrormsgt_R.tunittouuRR-tabstpiR/ttupleRtlisttview_centert
current_layerRRRtrangetcostsintatanR1R#R)tacosttan(R7tsotfliptstroke_widthtEPSILONtcentret
grp_transformtgrp_nametgrp_attribstgrptgrp_longt
delta_longtit
long_angleRtheighttinversetminorRadtrotationRR tgrp_latt	delta_latt	lat_angletmajorRadR	Rt
proportion((s2/usr/share/inkscape/extensions/wireframe_sphere.pyteffectmsz		!

 

	)
 
 	"8$(&(t__name__t
__module__R3Rf(((s2/usr/share/inkscape/extensions/wireframe_sphere.pyR$Us	t__main__(
t__doc__tmathRRtsimpletransformRRER#R2R$Rgtetaffect(((s2/usr/share/inkscape/extensions/wireframe_sphere.pyt<module>8s
�