如何计算三次贝塞尔曲线控制点 [英] How to calculate cubic bezier curve control points

查看:1410
本文介绍了如何计算三次贝塞尔曲线控制点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一条曲线,该曲线由与线连接的点的集合显示.我必须用一条三次贝塞尔曲线代替这种曲线.我有起点和终点,但是我不知道如何计算两个控制点.

问题已改善:

我的曲线包含4个点(p0,p1,p2和p3). p0是起点,p3是终点. p1和p2是中间的两个点.如果我连接这4个点,我将得到3条线.我想用三次贝塞尔曲线代替那条三线曲线.为此,我必须计算三次贝塞尔曲线的两个控制点的位置.我的问题是如何?
同时,我发现的文章很少( http://www.moshplant.com/direct-or/bezier/math .html [^ ] ),它描述了如何绘制三次贝塞尔曲线,因此我将尝试对这些公式进行逆向工程以获得控制点.

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.

推荐答案

请在此处查看:通过带有Bezier基本体的一组2D点绘制平滑曲线 [
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


这篇关于如何计算三次贝塞尔曲线控制点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆