tags:

views:

847

answers:

4

By stroke of the cubic bezier curve I mean rendering a curve 'A' with a specific line width 'w'.

How can I derive other cubic bezier curves that describe the outline of the stroke of bezier 'A' ?

+2  A: 

Ohhh. You want to get the offset-curves of an bezier curve.

Bad news. this is hard because these curves can't be simply derived numerical. They contain all kinds of intersections, loops and other nasty stuff.

There are some approximations though. The best approach I've read so far is from a paper by Thomas F. Hain (Fast, Precise Flattening of Cubic Bézier Path and Offset Curves). It's on his homepage.

http://www.cis.usouthal.edu/~hain/old%20hainweb/BezierFlattening.pdf

He does flattening, so his paper is mostly about decomposes the offset curves into line-segments and circular arc-segments, but you can merge them back to beziers later.

For better understanding you may want to read his other bezier related papers as well.

Nils Pipenbrinck
That link seems to be 404. If you have access trough some company or university, or are willing to pay, you can access the paper trough this link: http://dx.doi.org/10.1016/j.cag.2005.08.002
MizardX
Indeed. Half a year ago they still worked. I think it's just a minor web-hickup. I suggest you just contact Mr. Hain and ask for the paper. (I did so for some source-code). http://www.cis.usouthal.edu/~hain/
Nils Pipenbrinck
That article was exactly what I needed. If anyone is interested I've implemented an offset bezier curve demo in JavaScript using Raphael so you can drag it around and play:http://www-personal.une.edu.au/~bheywood/phototopo/offset.html
Brendan Heywood
A: 

Unfortunately, I don't have enough reputation to comment on the previous answer, however the paper in question, as well as a few others related to Bezier curves, can be found here:

http://www.cis.usouthal.edu/~hain/general/Publications/Bezier/

kibibu
A: 

Qt's QPainterPathStroker (it's open source and fairly readable code) uses the algorithm described in the aforementioned paper to do what you want.

Ringding
A: 

The above link is not working any more. The paper can be found at at

http://www.cis.usouthal.edu/~hain/general/Publications/Bezier/BezierFlattening.pdf

toka