Outline of cubic bezier curve stroke

前端 未结 3 1495
天涯浪人
天涯浪人 2020-12-05 00:56

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 out

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-05 01:51

    To do is accurately is as others have explained very difficult. The offset curve is not a cubic Bezier and is very intractable. Then concavities that are deeper than the offset cause intersection problems.

    The good news is that normally you want to calculate a stroke offset for rendering, so only need pixel accuracy. Also, the various intersections still create a filled polygon, if you observe the winding rule for polygon filling. So you flatten the curve first, then offset in a linear fashion, and it becomes a straight line polygon problem.

    Some code here can be used as a reference implementation: https://github.com/memononen/nanosvg

提交回复
热议问题