如何找到定义贝塞尔曲线的数学函数 [英] How to find the mathematical function defining a bezier curve

查看:80
本文介绍了如何找到定义贝塞尔曲线的数学函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实施贝塞尔曲线和线段相交测试.我搜索出的最接近的结果是采用贝塞尔曲线(为简单起见,将其限制为三个控制点)找到生成该曲线的数学函数并将其放置在origo上.然后,将线段的函数用作另一个函数,让它们相等并求解方程.

Im trying to implement a bezier curve and line segment intersection test. The closest thing my searching has turned up is to take the bezier curve (lets limit it to three control points for simplicity) find the mathematical function generating that curve and place it on origo. Then, using the function for the line segment as another function and let them be equal and solve the equation.

许多资料都陈述了上述解决方案(除非Ive误解了它们),我的问题是我找不到找到生成贝塞尔曲线的数学函数的方法.

Many sources state the above solution (unless Ive misunderstood them), my problem is I cant find the way to calculate the mathematical function that generates the bezier curve.

哦,请指出我在寻找相交点时是否完全偏离了轨道.

Oh, and please point out if Im completely off track with finding the intersection point(s).

推荐答案

贝塞尔曲线是参数函数.二次贝塞尔曲线(即三个控制点)可以表示为: F(t)= A(1- t)^ 2 + 2B(1- t)t + Ct ^ 2 其中, A B C 是点, t 从零变到一.

A Bezier curve is a parametric function. A quadratic Bezier curve (i.e. three control points) can be expressed as: F(t) = A(1 - t)^2 + 2B(1 - t)t + Ct^2 where A, B and C are points and t goes from zero to one.

这将为您提供两个方程式:

This will give you two equations:

x = a(1-t)^ 2 + 2b(1-t)t + ct ^ 2

y = d(1-t)^ 2 + 2e(1-t)t + ft ^ 2

例如,如果将线性方程式( y = kx + m )添加到其中,则会得到三个方程式和三个未知数( x y t ).

If you add for instance the line equation (y = kx + m) to that, you'll end up with three equations and three unknowns (x, y and t).

这篇关于如何找到定义贝塞尔曲线的数学函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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