求贝赛尔 曲线的长度
来源:互联网 发布:淘宝我订购的服务 编辑:程序博客网 时间:2024/06/05 04:21
Quadratic Bezier curves are defined by second order polynominal, andcan be written as
,
where t is real parameter with values in range [0,1]. P'sare respectively curve starting point, anchor point and the end point.Derivative of the quadratic Bezier curve can be written as
.
Length of any parametric (in general length of any well defined curve) curve can be computated using curve length integral.In case of 2nd order Bezier curve, using its derivatives, this integral can be written as
.
To simplify this integral we can make some substitutions. In this case it we will look like this
.
Next after doing some algebra and grouping elements in order to parameter t we will do another substitutions (to make this integral easier)
.
This integral can be 'easily' simplified and calculated using relation
,
but we need to do some more substitutions
.
After doing elementary algebra we finaly get our expression. To calculate length of quadratic Bezier curve with thisexpression all we need arecoordinates of end points and control point. We dont need to use iterative methods anymore.
.
Accuracy of this evaluation
To check accuracy we will evalute length of quadric Bezier curve using previously calculated expression and approximation algorithm.Used algorithm approximates a Bezier curve with a set of line segments and calculates curve length as a sum over lengths of all that line segments.
In this case we will use a series of quadric Bezier curves. All curves have the same end points. For each curve control point is taken from a set ofpoints equally spaced on a circle, with given radius and centered in the middle between end points.
Presented plot shows comparison of curve length calculated using both (our expression and line approximation) methods for a set of Bezier quadriccurves.Green line shows results from approximation method, curve lengths calculated using our expression are drawn withred cross
Implementation
Implementation in c language can look as follows
float blen(v* p0, v* p1, v* p2)
{
v a,b;
a.x = p0->x - 2*p1->x + p2->x;
a.y = p0->y - 2*p1->y + p2->y;
b.x = 2*p1->x - 2*p0->x;
b.y = 2*p1->y - 2*p0->y;
float A = 4*(a.x*a.x + a.y*a.y);
float B = 4*(a.x*b.x + a.y*b.y);
float C = b.x*b.x + b.y*b.y;
float Sabc = 2*sqrt(A+B+C);
float A_2 = sqrt(A);
float A_32 = 2*A*A_2;
float C_2 = 2*sqrt(C);
float BA = B/A_2;
return ( A_32*Sabc + A_2*B*(Sabc-C_2) + (4*C*A-B*B)*log( (2*A_2+BA+Sabc)/(BA+C_2) ) )/(4*A_32);
};
- 求贝赛尔 曲线的长度
- 【微积分】曲线的长度
- 自适应辛普森迭代求曲线的长度
- 求任意曲线的长度(C#)
- cocos2dx Bezier 曲线 长度
- VTK曲线长度测量
- 二次贝塞尔曲线长度
- 1854: H-曲线长度
- 如何得到贝塞尔曲线的曲线长度和 t 的近似关系?
- 动画曲线的加速度曲线
- 取一些点,通过相应算法形成拟合曲线,求出拟合曲线长度
- 团结的曲线
- 平滑的曲线
- bezier曲线的实现
- VC 曲线的绘制
- 迷人的“创业曲线”
- Julia曲线的生成
- Bezier曲线的绘制
- 一个简单的static类型的初始化问题
- java访问.net webservice返回对象操作
- jsp防止重复提交
- 23种设计模式之命令模式2
- oracle笔记4-简单sql查询
- 求贝赛尔 曲线的长度
- 客户端的IP地址伪造、CDN、反向代理、获取的那些事儿
- 转:Windows Shell 编程 第五章_1
- hdu 3853 概率DP
- VB.NET修饰符详细概念总结
- Android一些实用的函数
- nagios工作原理
- IPicture、BITMAP、HBITMAP和CBitmap的关系
- FordFulkerson算法求网络最大流(java)