天天看点

三阶贝塞尔曲线选点,如何计算三次贝塞尔曲线控制点

三阶贝塞尔曲线选点,如何计算三次贝塞尔曲线控制点

I have curve that is displayed by collection of points connected with lines. I have to replace that kind of curve with one cubic bezier curve. I have origin and destination point, but I don''t know how to calculate two control points.

Question improved:

I have curve consisting of 4 points (p0, p1, p2 and p3). p0 is origin point and p3 is destination point. p1 and p2 are two point in the middle. If I connect these 4 points I will get 3 lines. I want to replace that 3-line-curve with cubic bezire curve. To get that, I have to calculate positions of two control points of cubic bezier curve. My question is how?

In meantime I found few articles (http://www.moshplant.com/direct-or/bezier/math.html[^]) that describes how to draw cubic bezier curve, so I will try to reverse-engineer these formulas to get control points.

解决方案

Please have a look here: Draw a Smooth Curve through a Set of 2D Points with Bezier Primitives[^]. The article is for C# but since you didn''t specify any language I thought I just post this.

Best regards,

-MRB