Bezier Curve Help

Blitz3D Forums/Blitz3D Programming/Bezier Curve Help

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....