Right, here's something along the lines of an answer. I was implementing some of this stuff as part of the TeX-SX calligraphy package that involved manipulating soft paths and I'd begun spinning off the soft path manipulation into its own package file anyway. Here seems as good a place to record that as any!
The relevant file is spath.dtx and is available from the TeX-SX package project. Also useful is the file spath_test.tex because I haven't written any documentation yet! To produce the style file, run tex spath.dtx (if there were any documentation you'd get that from pdflatex spath.dtx).
It's an object-oriented approach, using Till Tantau's OO implementation that is bundled with PGF (so you might need the most recent version of PGF for it to work). Here's some sample code:
\documentclass{article}
\usepackage{tikz}
\usepackage{spath}
\begin{document}
\begin{tikzpicture}
\path[save path=\tmppath] (0,0) -- (1,1) (2,1) .. controls (3,1) and (4,2) .. (5,2);
\show\tmppath
\pgfoonew \mypath =new spath(\tmppath)
\mypath.show(path)
\mypath.length()
\mypath.initial point()
\mypath.show(initial point)
\mypath.final point()
\mypath.show(final point)
\mypath.show(length)
\mypath.translate path(\trpath,1cm,1cm)
\mypath.show(path)
\trpath.show(path)
\mypath.concatenate(\catpath,\trpath)
\catpath.show(path)
\mypath.weld(,\trpath)
\mypath.show(path)
\mypath.use path with tikz(draw,red,line width=.5cm)
\mypath.use path(stroke)
\end{tikzpicture}
\end{document}
We begin by defining a path using normal TikZ commands and saving it as \tmppath. Then we define a new instance of the spath class and initialise it with \tmppath. We do various manipulations on it, and find out some facts about it, before finally using it. The last two, \mypath.use path with tikz(options) and \mypath.use path, are the actual rendering commands. The first uses the same methods as TikZ for rendering the path so can take any TikZ options (I don't guarantee 100% that they will all work, but they should). The second uses the underlying PGF system so takes one of the basic options: stroke or fill.
This doesn't really qualify as an answer to your question as none of the things that you ask for are implemented (note that length refers to the number of commands in the soft path, not the path length). But it wouldn't be hard to adapt either of the two already-given answers to this setting. It does answer the question in the comments about reusing a path, though.
tikz-pgfpath? Can you give a pseudo-code of what you would like to be able to do? – Andrew Stacey Jun 06 '11 at 20:41name pathoption: I get a macro called\tikz@intersect@path@name@<name>, but then using this information is not trivial at all... – Marco Lombardi Jun 06 '11 at 20:42intersectionspackage this is possible, is there any other (better?) way of doing it? In general one might need to stroke several time a path w/o using post/pre action (for example because the second time I might want to work with a clipping and stroke only part of a path). – Marco Lombardi Jun 06 '11 at 20:46\newcommand\mypath[1][]{\draw[#1,...] ...;}) and then call it several times. – Caramdir Jun 06 '11 at 20:50\edef, I suppose. – Marco Lombardi Jun 06 '11 at 21:10\path[save path=\mypath] path-construction;will do that. Then you can reuse it as you like. As part of my calligraphy package, I'm currently writing a set of routines that will manipulate these paths (such as translating them or reversing them). But the best way to save it depends on how you want to use it, which is why I asked for pseudo-code. – Andrew Stacey Jun 06 '11 at 21:17save pathkey documented anywhere in the TikZ manual, or am I missing it? For the use, given a curve C represented as a list of coordinates (x_i,y_i), I want to calculate the number of points such that y_i > threshold and the integral of the curve in the same set (so, in practice, the sum of y_i for all y_i > threshold). – Marco Lombardi Jun 06 '11 at 21:40\path[save path=\mypath]construct, can I then use\mypathwith the higher level TikZ interface or am I forced to stick with pgf? In case I can use TikZ, what is the syntax (for example imagine I want to change the color and fill the path). – Marco Lombardi Jun 06 '11 at 22:41save pathis not documented. I only learnt about it from searching through the TikZ/PGF code for examples of\pgfsyssoftpath@getcurrentpath(which is documented). To use the path with the normal TikZ options, you would need to write a wrapper macro. But that wouldn't be very hard to do. I'll have a go later today if I get a moment. – Andrew Stacey Jun 07 '11 at 06:54