File: //usr/share/inkscape/extensions/wireframe_sphere.pyc
�
��Yc @ s� d Z d d l Td d l Z d d l Z d d l m Z d d e f d d � Z d e j f d
� � YZ e
d k r� e � Z e j � n d S( 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( t computePointInNodei i t c
C sB | \ } } | \ } } i d d 6t | � d 6d d 6}
i
t j |
� d 6t | � t j d d � 6t | � t j d d � 6t | � t j d
d � 6t | � t j d d � 6t | d � t j d
d � 6t | d � t j d d � 6d t j d d � 6d t j d d � 6| d 6} t j j | t j d d � | � } d S( Ns #000000t strokes stroke-widtht nonet fillt stylet cxt sodipodit cyt rxt ryi t starti t endt truet opent arct typet transformt patht svg( t strt simplestylet formatStylet inkext addNSt etreet
SubElement(
t .0t .1t widtht parentt start_endR R
R R R R t circ_attribst circ( ( s2 /usr/share/inkscape/extensions/wireframe_sphere.pyt draw_SVG_ellipseB s
t Wireframe_Spherec B s e Z d � Z d � Z RS( c
C s t j j | � | j j d d d d d d d d d �| j j d
d d d d d d d d �| j j d
d d d d d d d d �| j j d d d d d d d d d �| j j d d d d d d d d d �| j j d d d d d d d d t �d S( Ns --num_latt actiont storeR t intt destt NUM_LATt defaulti s
--num_longt NUM_LONGi s --radiust floatt RADIUSg Y@s --tiltt TILTg �A@s
--rotationt
ROT_OFFSETi s --hide_backt inkboolt HIDE_BACK( R t Effectt __init__t OptionParsert
add_optiont False( t self( ( s2 /usr/share/inkscape/extensions/wireframe_sphere.pyR3 V s&