2
$\begingroup$

If I have a cubic Bezier curve specified by two endpoints and two control points, how can I find an offset curve which is "parallel" to the original at some given distance, after i have determined the other 2 endpoints ? The red dots in the image http://s11.postimg.org/n44nmqzoj/bezier_question.png are the endpoints, and the red squares are the control points of the initial bezier segment. Everything red is known, and i need to find the blue squares, that is, the control points of the second curve, such that the second curve is parallel to the first one(must also take into account that the dimension varies, as if it was below the original bezier, the second curve would be smaller).

I am sorry for the graphics of the image, it has only a illustrative purpose and i am not good at drawing. Thank you for the help!

$\endgroup$
3
  • $\begingroup$ Take a look at this: math.stackexchange.com/questions/302076/… $\endgroup$
    – bubba
    Commented Jul 24, 2014 at 13:14
  • $\begingroup$ I found another reference which mentions this: the very old (2003) comp.graphics.algorithms FAQ at faqs.org/faqs/graphics/algorithms-faq says in question 4.01: "How do I generate a Bezier curve that is parallel to another Bezier? You can't. The only case where this is possible is when the Bezier can be represented by a straight line. And then the parallel 'Bezier' can also be represented by a straight line." $\endgroup$ Commented Feb 4, 2016 at 15:40
  • 1
    $\begingroup$ See also mathoverflow.net/q/60902/5340 "Formulas for equidistant curves" $\endgroup$ Commented Jun 8, 2017 at 14:36

1 Answer 1

3
$\begingroup$

There's no simple solution for this. I think the parallel curve is usually not exactly a Bezier curve: just think of how even a circle is not a Bezier curve.

As a practical solution, computer programs simply approximate Bezier curves with polygons (made of straight line segments), and compute polygons parallel to those. See the article Maxim Shemanarev, "Adaptive Subdivision of Bezier Curves" at http://antigrain.com/research/adaptive_bezier/ which explains the difficulties quite well.

I believe vector to pixel rendering engines (such as Postscript interpreters or Cairo or METAFONT) draw thick strokes around paths made of Bezier curves using a similar polygonal approximation, they never compute parallel Bezier curves, though I'm not sure of the details. This is the reason why MetaType1 (a modification of Metapost that outputs type 1 fonts) cannot handle strokes: the type 1 fonts must represent glyphs as cubic Bezier curves. Vector drawing editor programs such as CorelDraw or Inkscape have a feature where they compute the parallel curves as Bezier curve, but I think that's only an approximation, just like how these same drawing programs will convert a circle to a Bezier curve as well, see eg. http://www.angelfire.com/mi/kevincharles/inkscape/p7c7.html .
If you want to search for software approximation stuff, keywords to look for are: Minkowski sum, contour, inset/outset, bloat/shrink, stroke, pen, brush. Sorry if the search keywords are too general, and sorry for giving a reply that doesn't have much mathematics.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .