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

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

问题描述

通过三次beizer曲线程序时
我发现它使用端点为(10,10,0)和(0,1,0),其他控制点为(5,10,2)和(-10,-5,-2).了解他们如何获得其他控制点
请通过任何公式或方法帮助我
-
如果要通过N> 2的N个点平滑地绘制Bézier曲线,那么如何获得中间控制点.

While going through a cubic beizer curve program
I found it uses end points as(10,10,0) and (0,1,0) and other control points as(5,10,2) and (-10,-5,-2).I am not able to understand how did they get this other control points
please help me with any formula or method to fins them
-
if you want to put a Bézier curve smoothly through N points with N>2, how do you get the intermediate control points.

推荐答案

正如belisarius在他的评论中所说,控制点实际上是贝塞尔曲线的输入参数. 维基百科文章有一些漂亮的动画,这些动画使绘制曲线的过程可视化以及如何使用控制点.

As belisarius said in his comment, the control points are actually input parameters for a Bézier curve. The wikipedia article has some nice animations that visualize the process of drawing the curve and how the control points are used for it.

作为总结,三次贝塞尔曲线由4个点组成.我们将它们命名为StartEndControl1Control2.曲线从StartControl1的线开始于Start.但是,要到达终点End,它必须偏离该路径并接近从Control2End的线,直到到达End点.

As a summary, a cubic Bézier curve consists of 4 points. Let's name them Start, End, Control1 and Control2. The curve starts at Start, following the line from Start to Control1. But to reach the end point End, it has to deviate from that path and approaches the line from Control2 to End until it reaches the End point.

因此,您可以计算"特定曲线所需的控制点,例如通过在一张纸上绘制所需的曲线.控制点必须位于起点和终点的曲线切线的某处,以创建贝塞尔曲线类似于您的草图的曲线.

So you can "calculate" the control points you'll need for a specific curve f.e. by drawing the desired curve on a piece of paper. The control points have to lie somewhere on the curve tangents at the start and end point to create a Bézier curve similar to your sketch.

这是我用Paint绘制的插图(实际上非​​常适合玩此游戏,因为它具有创建三次贝塞尔曲线的工具).在左侧,我绘制了粗略的徒手绘制的曲线草图(黑色),然后添加了切线的估计值(灰色).最后,我选择线上的两个点作为控制点(绿色).在右侧,您会看到相同的图像,但是曲线是使用Paint'sBézier工具创建的,它从起点到终点画一条线,然后单击两个控制点.

Here is a illustration I've done with Paint (which is actually good for playing with this because it has a tool to create cubic Bézier curves). On the left side I've drawn a rough freehand sketch of the curve (black), then added my estimate of the tangents (gray). Finally I chose two points on the lines to be the control points (green). On the right side you see the same, but the curve has been created using Paint's Bézier tool drawing a line from the start to the end point and then clicking the two control points.

尝试此操作可以使您对控制点如何构建曲线有更好的感觉.例如,如果您选择的控制点距离曲线的起点/终点更远,它将沿着灰色的控制线"变紧".

Playing around with this should give you a better feeling about how the control points build your curve. For example, if you choose control points farther away from the start/end point of your curve, it will run "tighter" along the gray "control lines".

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

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