![](https://secure.gravatar.com/avatar/61ce0f8abd1c597e4644d406b802f097.jpg?s=120&d=mm&r=g)
On 5/26/06, Justin Wikinator <touchmewithsynchronicpulses@...400...> wrote:
Specifically, I want to write a method that outputs a list of equally spaced points along a bezier BUT, I don't mean equally spaced t-values for the bezier -- I can already do this -- I mean points that are of equal distance along the bezier. I'm almost certain the two are distinct. Any suggestions ?
Yes, the two are distinct. The concept you are interested in is called arc-length, and has a calculus definition:
Integral( sqrt( dx/dt ^ 2 + dy/dt ^ 2 ), t )
Here, dx/dt and dy/dt are the derivatives of the Bezier x(t) and y(t) functions. The trouble is, by the time you square them and add them together, you have a quartic equation. Integrating the square root of a quartic equation is insanely hard. I expect the solution would take a few pages of paper just to print out, if it's even possible to get a symbolic solution in the first place.
In practice, the best you can get is an approximation. Just divide the curve into several tiny line segments and sum their lengths. From there, some sort of binary-search algorithm could find the midpoint. It could be pretty straightforward to get working, but might take some serious tweaking to make it both accurate and fast.
Feel free to email me if you have any more Bezier math questions, or even just more help with the arc-length stuff.
-William Swanson