Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Library for SVG path calculations [closed]

Tags:

python

svg

I'm looking for a library with Python bindings that can do calculations on SVG paths, such as calculating the length, and finding the coordinates of a point on the paths (ie, say the coordinates of the point 24.4% the length of the path).

Is there something around already?

A C-library would be acceptable as well, as I can easily make my own Python bindings.

like image 450
Lennart Regebro Avatar asked Dec 14 '12 13:12

Lennart Regebro


People also ask

Which of the following SVG path commands automatically closes a path?

The "closepath" command. The "closepath" (Z or z) ends the current subpath by connecting it back to its initial point. An automatic straight line is drawn from the current point to the initial point of the current subpath.

Is it possible to draw any path in SVG?

The element in SVG is the ultimate drawing element. It can draw anything! I've heard that under the hood all the other drawing elements ultimately use path anyway. The path element takes a single attribute to describe what it draws: the d attribute.

How do I curve an SVG?

An SVG quadratic curve will probably suffice. To draw it, you need the end points (which you have) and a control point which will determine the curve. To make a symmetrical curve, the control point needs to be on the perpendicular bisector of the line between the end points.


1 Answers

OK, so I wrote it, and released it as a library.

http://pypi.python.org/pypi/svg.path

like image 177
Lennart Regebro Avatar answered Nov 15 '22 07:11

Lennart Regebro