parent
1f074d5adc
commit
b54bf778b4
Binary file not shown.
Binary file not shown.
2
setup.py
2
setup.py
|
@ -3,7 +3,7 @@ import codecs
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
VERSION = '1.3.2beta'
|
VERSION = '1.3.2'
|
||||||
AUTHOR_NAME = 'Andy Port'
|
AUTHOR_NAME = 'Andy Port'
|
||||||
AUTHOR_EMAIL = 'AndyAPort@gmail.com'
|
AUTHOR_EMAIL = 'AndyAPort@gmail.com'
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
Metadata-Version: 1.1
|
Metadata-Version: 1.1
|
||||||
Name: svgpathtools
|
Name: svgpathtools
|
||||||
Version: 1.3.1
|
Version: 1.3.2
|
||||||
Summary: A collection of tools for manipulating and analyzing SVG Path objects and Bezier curves.
|
Summary: A collection of tools for manipulating and analyzing SVG Path objects and Bezier curves.
|
||||||
Home-page: https://github.com/mathandy/svgpathtools
|
Home-page: https://github.com/mathandy/svgpathtools
|
||||||
Author: Andy Port
|
Author: Andy Port
|
||||||
Author-email: AndyAPort@gmail.com
|
Author-email: AndyAPort@gmail.com
|
||||||
License: MIT
|
License: MIT
|
||||||
Download-URL: http://github.com/mathandy/svgpathtools/tarball/1.3.1
|
Download-URL: http://github.com/mathandy/svgpathtools/tarball/1.3.2
|
||||||
Description: svgpathtools
|
Description-Content-Type: UNKNOWN
|
||||||
|
Description:
|
||||||
|
svgpathtools
|
||||||
============
|
============
|
||||||
|
|
||||||
svgpathtools is a collection of tools for manipulating and analyzing SVG
|
svgpathtools is a collection of tools for manipulating and analyzing SVG
|
||||||
|
@ -46,11 +48,6 @@ Description: svgpathtools
|
||||||
- compute **inverse arc length**
|
- compute **inverse arc length**
|
||||||
- convert RGB color tuples to hexadecimal color strings and back
|
- convert RGB color tuples to hexadecimal color strings and back
|
||||||
|
|
||||||
Note on Python 3
|
|
||||||
----------------
|
|
||||||
While I am hopeful that this package entirely works with Python 3, it was born from a larger project coded in Python 2 and has not been thoroughly tested in
|
|
||||||
Python 3. Please let me know if you find any incompatibilities.
|
|
||||||
|
|
||||||
Prerequisites
|
Prerequisites
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
|
@ -94,8 +91,6 @@ Description: svgpathtools
|
||||||
module <https://github.com/regebro/svg.path>`__. Interested svg.path
|
module <https://github.com/regebro/svg.path>`__. Interested svg.path
|
||||||
users should see the compatibility notes at bottom of this readme.
|
users should see the compatibility notes at bottom of this readme.
|
||||||
|
|
||||||
Also, a big thanks to the author(s) of `A Primer on Bézier Curves <http://pomax.github.io/bezierinfo/>`_, an outstanding resource for learning about Bézier curves and Bézier curve-related algorithms.
|
|
||||||
|
|
||||||
Basic Usage
|
Basic Usage
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
@ -126,11 +121,11 @@ Description: svgpathtools
|
||||||
on discontinuous Path objects. A simple workaround is provided, however,
|
on discontinuous Path objects. A simple workaround is provided, however,
|
||||||
by the ``Path.continuous_subpaths()`` method. `↩ <#a1>`__
|
by the ``Path.continuous_subpaths()`` method. `↩ <#a1>`__
|
||||||
|
|
||||||
.. code:: python
|
.. code:: ipython2
|
||||||
|
|
||||||
from __future__ import division, print_function
|
from __future__ import division, print_function
|
||||||
|
|
||||||
.. code:: python
|
.. code:: ipython2
|
||||||
|
|
||||||
# Coordinates are given as points in the complex plane
|
# Coordinates are given as points in the complex plane
|
||||||
from svgpathtools import Path, Line, QuadraticBezier, CubicBezier, Arc
|
from svgpathtools import Path, Line, QuadraticBezier, CubicBezier, Arc
|
||||||
|
@ -167,7 +162,7 @@ Description: svgpathtools
|
||||||
list. So segments can **append**\ ed, **insert**\ ed, set by index,
|
list. So segments can **append**\ ed, **insert**\ ed, set by index,
|
||||||
**del**\ eted, **enumerate**\ d, **slice**\ d out, etc.
|
**del**\ eted, **enumerate**\ d, **slice**\ d out, etc.
|
||||||
|
|
||||||
.. code:: python
|
.. code:: ipython2
|
||||||
|
|
||||||
# Let's append another to the end of it
|
# Let's append another to the end of it
|
||||||
path.append(CubicBezier(250+350j, 275+350j, 250+225j, 200+100j))
|
path.append(CubicBezier(250+350j, 275+350j, 250+225j, 200+100j))
|
||||||
|
@ -234,7 +229,7 @@ Description: svgpathtools
|
||||||
| Note: Line, Polyline, Polygon, and Path SVG elements can all be
|
| Note: Line, Polyline, Polygon, and Path SVG elements can all be
|
||||||
converted to Path objects using this function.
|
converted to Path objects using this function.
|
||||||
|
|
||||||
.. code:: python
|
.. code:: ipython2
|
||||||
|
|
||||||
# Read SVG into a list of path objects and list of dictionaries of attributes
|
# Read SVG into a list of path objects and list of dictionaries of attributes
|
||||||
from svgpathtools import svg2paths, wsvg
|
from svgpathtools import svg2paths, wsvg
|
||||||
|
@ -271,7 +266,7 @@ Description: svgpathtools
|
||||||
automatically attempt to open the created svg file in your default SVG
|
automatically attempt to open the created svg file in your default SVG
|
||||||
viewer.
|
viewer.
|
||||||
|
|
||||||
.. code:: python
|
.. code:: ipython2
|
||||||
|
|
||||||
# Let's make a new SVG that's identical to the first
|
# Let's make a new SVG that's identical to the first
|
||||||
wsvg(paths, attributes=attributes, svg_attributes=svg_attributes, filename='output1.svg')
|
wsvg(paths, attributes=attributes, svg_attributes=svg_attributes, filename='output1.svg')
|
||||||
|
@ -303,7 +298,7 @@ Description: svgpathtools
|
||||||
that ``path.point(T)=path[k].point(t)``.
|
that ``path.point(T)=path[k].point(t)``.
|
||||||
| There is also a ``Path.t2T()`` method to solve the inverse problem.
|
| There is also a ``Path.t2T()`` method to solve the inverse problem.
|
||||||
|
|
||||||
.. code:: python
|
.. code:: ipython2
|
||||||
|
|
||||||
# Example:
|
# Example:
|
||||||
|
|
||||||
|
@ -333,11 +328,11 @@ Description: svgpathtools
|
||||||
True
|
True
|
||||||
|
|
||||||
|
|
||||||
Tangent vectors and Bezier curves as numpy polynomial objects
|
Bezier curves as NumPy polynomial objects
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
| Another great way to work with the parameterizations for Line,
|
| Another great way to work with the parameterizations for ``Line``,
|
||||||
QuadraticBezier, and CubicBezier objects is to convert them to
|
``QuadraticBezier``, and ``CubicBezier`` objects is to convert them to
|
||||||
``numpy.poly1d`` objects. This is done easily using the
|
``numpy.poly1d`` objects. This is done easily using the
|
||||||
``Line.poly()``, ``QuadraticBezier.poly()`` and ``CubicBezier.poly()``
|
``Line.poly()``, ``QuadraticBezier.poly()`` and ``CubicBezier.poly()``
|
||||||
methods.
|
methods.
|
||||||
|
@ -369,9 +364,10 @@ Description: svgpathtools
|
||||||
\end{bmatrix}
|
\end{bmatrix}
|
||||||
\begin{bmatrix}P_0\\P_1\\P_2\\P_3\end{bmatrix}
|
\begin{bmatrix}P_0\\P_1\\P_2\\P_3\end{bmatrix}
|
||||||
|
|
||||||
QuadraticBezier.poly() and Line.poly() are defined similarly.
|
``QuadraticBezier.poly()`` and ``Line.poly()`` are `defined
|
||||||
|
similarly <https://en.wikipedia.org/wiki/B%C3%A9zier_curve#General_definition>`__.
|
||||||
|
|
||||||
.. code:: python
|
.. code:: ipython2
|
||||||
|
|
||||||
# Example:
|
# Example:
|
||||||
b = CubicBezier(300+100j, 100+100j, 200+200j, 200+300j)
|
b = CubicBezier(300+100j, 100+100j, 200+200j, 200+300j)
|
||||||
|
@ -401,15 +397,25 @@ Description: svgpathtools
|
||||||
(-400 + -100j) t + (900 + 300j) t - 600 t + (300 + 100j)
|
(-400 + -100j) t + (900 + 300j) t - 600 t + (300 + 100j)
|
||||||
|
|
||||||
|
|
||||||
To illustrate the awesomeness of being able to convert our Bezier curve
|
The ability to convert between Bezier objects to NumPy polynomial
|
||||||
objects to numpy.poly1d objects and back, lets compute the unit tangent
|
objects is very useful. For starters, we can take turn a list of Bézier
|
||||||
vector of the above CubicBezier object, b, at t=0.5 in four different
|
segments into a NumPy array
|
||||||
ways.
|
|
||||||
|
|
||||||
Tangent vectors (and more on polynomials)
|
Numpy Array operations on Bézier path segments
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. code:: python
|
`Example available
|
||||||
|
here <https://github.com/mathandy/svgpathtools/blob/master/examples/compute-many-points-quickly-using-numpy-arrays.py>`__
|
||||||
|
|
||||||
|
To further illustrate the power of being able to convert our Bezier
|
||||||
|
curve objects to numpy.poly1d objects and back, lets compute the unit
|
||||||
|
tangent vector of the above CubicBezier object, b, at t=0.5 in four
|
||||||
|
different ways.
|
||||||
|
|
||||||
|
Tangent vectors (and more on NumPy polynomials)
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
.. code:: ipython2
|
||||||
|
|
||||||
t = 0.5
|
t = 0.5
|
||||||
### Method 1: the easy way
|
### Method 1: the easy way
|
||||||
|
@ -451,7 +457,7 @@ Description: svgpathtools
|
||||||
Translations (shifts), reversing orientation, and normal vectors
|
Translations (shifts), reversing orientation, and normal vectors
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. code:: python
|
.. code:: ipython2
|
||||||
|
|
||||||
# Speaking of tangents, let's add a normal vector to the picture
|
# Speaking of tangents, let's add a normal vector to the picture
|
||||||
n = b.normal(t)
|
n = b.normal(t)
|
||||||
|
@ -481,7 +487,7 @@ Description: svgpathtools
|
||||||
Rotations and Translations
|
Rotations and Translations
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. code:: python
|
.. code:: ipython2
|
||||||
|
|
||||||
# Let's take a Line and an Arc and make some pictures
|
# Let's take a Line and an Arc and make some pictures
|
||||||
top_half = Arc(start=-1, radius=1+2j, rotation=0, large_arc=1, sweep=1, end=1)
|
top_half = Arc(start=-1, radius=1+2j, rotation=0, large_arc=1, sweep=1, end=1)
|
||||||
|
@ -514,7 +520,7 @@ Description: svgpathtools
|
||||||
``CubicBezier.length()``, and ``Arc.length()`` methods, as well as the
|
``CubicBezier.length()``, and ``Arc.length()`` methods, as well as the
|
||||||
related inverse arc length methods ``.ilength()`` function to do this.
|
related inverse arc length methods ``.ilength()`` function to do this.
|
||||||
|
|
||||||
.. code:: python
|
.. code:: ipython2
|
||||||
|
|
||||||
# First we'll load the path data from the file test.svg
|
# First we'll load the path data from the file test.svg
|
||||||
paths, attributes = svg2paths('test.svg')
|
paths, attributes = svg2paths('test.svg')
|
||||||
|
@ -556,7 +562,7 @@ Description: svgpathtools
|
||||||
Intersections between Bezier curves
|
Intersections between Bezier curves
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
.. code:: python
|
.. code:: ipython2
|
||||||
|
|
||||||
# Let's find all intersections between redpath and the other
|
# Let's find all intersections between redpath and the other
|
||||||
redpath = paths[0]
|
redpath = paths[0]
|
||||||
|
@ -580,7 +586,7 @@ Description: svgpathtools
|
||||||
Here we'll find the `offset
|
Here we'll find the `offset
|
||||||
curve <https://en.wikipedia.org/wiki/Parallel_curve>`__ for a few paths.
|
curve <https://en.wikipedia.org/wiki/Parallel_curve>`__ for a few paths.
|
||||||
|
|
||||||
.. code:: python
|
.. code:: ipython2
|
||||||
|
|
||||||
from svgpathtools import parse_path, Line, Path, wsvg
|
from svgpathtools import parse_path, Line, Path, wsvg
|
||||||
def offset_curve(path, offset_distance, steps=1000):
|
def offset_curve(path, offset_distance, steps=1000):
|
||||||
|
@ -638,6 +644,7 @@ Description: svgpathtools
|
||||||
|
|
||||||
This module is under a MIT License.
|
This module is under a MIT License.
|
||||||
|
|
||||||
|
|
||||||
Keywords: svg,svg path,svg.path,bezier,parse svg path,display svg
|
Keywords: svg,svg path,svg.path,bezier,parse svg path,display svg
|
||||||
Platform: OS Independent
|
Platform: OS Independent
|
||||||
Classifier: Development Status :: 4 - Beta
|
Classifier: Development Status :: 4 - Beta
|
||||||
|
|
|
@ -15,23 +15,26 @@ test.svg
|
||||||
vectorframes.svg
|
vectorframes.svg
|
||||||
svgpathtools/__init__.py
|
svgpathtools/__init__.py
|
||||||
svgpathtools/bezier.py
|
svgpathtools/bezier.py
|
||||||
svgpathtools/directional_field.py
|
|
||||||
svgpathtools/misctools.py
|
svgpathtools/misctools.py
|
||||||
svgpathtools/parser.py
|
svgpathtools/parser.py
|
||||||
svgpathtools/path.py
|
svgpathtools/path.py
|
||||||
svgpathtools/paths2svg.py
|
svgpathtools/paths2svg.py
|
||||||
svgpathtools/pathtools.py
|
|
||||||
svgpathtools/polytools.py
|
svgpathtools/polytools.py
|
||||||
svgpathtools/smoothing.py
|
svgpathtools/smoothing.py
|
||||||
svgpathtools/svg2paths.py
|
svgpathtools/svg2paths.py
|
||||||
svgpathtools.egg-info/PKG-INFO
|
svgpathtools.egg-info/PKG-INFO
|
||||||
svgpathtools.egg-info/SOURCES.txt
|
svgpathtools.egg-info/SOURCES.txt
|
||||||
svgpathtools.egg-info/dependency_links.txt
|
svgpathtools.egg-info/dependency_links.txt
|
||||||
|
svgpathtools.egg-info/requires.txt
|
||||||
svgpathtools.egg-info/top_level.txt
|
svgpathtools.egg-info/top_level.txt
|
||||||
|
test/circle.svg
|
||||||
|
test/ellipse.svg
|
||||||
|
test/polygons.svg
|
||||||
|
test/rects.svg
|
||||||
test/test.svg
|
test/test.svg
|
||||||
test/test_bezier.py
|
test/test_bezier.py
|
||||||
test/test_generation.py
|
test/test_generation.py
|
||||||
test/test_parsing.py
|
test/test_parsing.py
|
||||||
test/test_path.py
|
test/test_path.py
|
||||||
test/test_pathtools.py
|
|
||||||
test/test_polytools.py
|
test/test_polytools.py
|
||||||
|
test/test_svg2paths.py
|
|
@ -0,0 +1,2 @@
|
||||||
|
numpy
|
||||||
|
svgwrite
|
Loading…
Reference in New Issue