Think of a simple curve as one with no trouble spots.
INKSCAPE STROKE TO PATH ONLY OUTLINE SERIES
Most methods have degenerate cases, especially when dealing with a series of curves. There is no mathematical answer, because the curve parallel to a bezier curve is not generally a bezier curve. This page has a fairly good tutorial on bezier curves in general with a nice section on offset curves.Ī less precise but possibly faster method can be found here. Sorry if I cause a lot of confusion with this and maybe am not of much help.
But I'm not sure right now whether this really covers all the potential pitfalls. For closed paths, you probably need the two "delimiting" paths to run in opposite orientation. This might not be an issue for open paths when using nonzero winding rule, but I'd be cautious about this. the "crossing area" of a black path might become white. I thought that self-intersecting paths might be tricky because you might get hollow areas inside the path, i.e. (That's also basically what comes out when you use the strokepath command in Ghostscript.) You can then find delimiting parallel line segments, but have to join them correctly, using the appropriate linejoin and miterlimit rules. De Casteljau's Algorithm is typically used for turning Bézier curves into line segments. The classic way of rendering vector paths with curves/arcs in them is to approximate everything with a polyline that is sufficiently smooth. For straight line segments, the exact solution can be found comparatively easily. So you would have to approximate it one way or the other. The "simplest" case would be if you only have non-self-intersecting polylines, polygons or paths that don't contain curves because in general, you can't draw exact "parallel" Bézier curves to the right and the left of a non-trivial Bézier curve that would delimit the stroked area - it's mathematically non-existent. I just tried Path => Outline stroke in Inkscape (I think that's what the English captions should say), and what came out didn't really look the same as the stroked path.
And even Inkscape doesn't really do a good job.
INKSCAPE STROKE TO PATH ONLY OUTLINE CODE
If you look at what Ghostscript spits out when you run the code I posted at the linked question, it's pretty ugly. As mentioned in my answer to the linked question, PostScript has a command for generating paths that produce basically the same output as a stroke, called strokepath. There has been a similar question recently:Īll in all, this is a non-trivial task. To put it another way, what does the browser do when you tell it to stroke a path – how does it work out what shape the stroke should be? Or, even better: if someone could explain to me the geometry theory about how I would do this task manually, by taking the list of line coordinates I have and working out a new path that effectively 'strokes' it, that would be amazing. Does anyone know of a library/function that would do this? I can't find any function that does this – I've looked through the docs of D3.js and Raphaël, but no luck. So I'm trying to manually 'thicken' a line into a solid shape. but I'm trying to get a filled shape rather than a stroked line, so that I can do further modifications on it, such as warping it, so the resulting 'stroke' might vary in thickness or have custom bits cut out of it (neither of these things are possible with a real SVG stroke, as far as I can tell). I can render this line as a path, and give it a stroke of a certain thickness. The line is just a simple curved line, a sequence of coordinates. Inkscape changes the width of the stroke.I want to convert a stroked path to a filled object.
Inkscape changes the stroke to the color you selected.
Inkscape changes the fill to the color you selected.