Bezier Curve Help
Blitz3D Forums/Blitz3D Programming/Bezier Curve Help
| ||
Hi all, anyone know how to compute the length of a 2d and 3d bezier curve? Need help quick fanx. |
| ||
Well, if you want an exact answer you'll probably need calculus to find the right equation. :| But if you just do this you should get a good approx: Function BezierLength(x1#,y1#,z1# ,x2#,y2#,z2# ,x3#,y3#,z3# ,x4#,y4#,z4#) px#=x1 py#=y1 pz#=z1 For t#=0 to 1 step .01 x#=Bezier#(t,x1,x2,x3,x4) y#=Bezier#(t,y1,y2,y3,y4) z#=Bezier#(t,z1,z2,z3,z4) td#=td#+Sqr((x-px)*(x-px)+(y-py)*(y-py)+(z-pz)*(z-pz)) px=x py=y pz=z Next Return td# End Function Function Bezier#(t#,x1#,x2#,x3#,x4#) Return x1*(1-t)^3 + 3*v2*(1-t)^2*t + 3*vx3*(1-t)*t^2 + x4*t^3 End Function Note that its untested, as I wrote it in firefox.... |
| ||
I've got some good news. The equation is simply: Maple refuses to integrate it though, and I don't think I'll be able to integrate it by hand... |
| ||
Jeez guys, thanks for your replies. Sorry I have'nt responded sooner as I've been working the old night shifts. I'll try both your equations. Thanks again. ;-) |
| ||
The equation is simply: LOL |
| ||
Perhaps this site could help... http://stevehollasch.com/cgindex/curves/cbezarclen.html Barney |