Hi,
I'm trying to come up with some closed form characterizations of cubic beziers.
Currently, I'm exploring algorithms to quantify the "bendi-ness" of a curve. (yeah, its a bogus term... maybe "curviness"?)
Essentially, what I want to do is indicate how much "effort" there is to follow the curve. I.e., a curve with low bendiness would require less effort to follow than one with
*high* bendiness.E.g., a bezier that is essentially *straight* would have no bendiness. OTOH, a curve that zigs and zags would have HIGH bendiness.
I have closed form solutions for the overall/cumulative "turning" that a curve experiences (e.g., a circle is 360 degrees of turning, an L is 90 degrees, a C is ~270 degrees, etc.).
Note that an S is bendier than a C -- and a figure-of-eight beats them all!
What I've come up with, so far, is to evaluate the tangent vector over the entire of the curve. I.e., this tells you which way the curve is "headed" at this instant.
Simultaneously, evaluate the derivative of the tangent vector to see how the tangent is *changing* at this instant. When the two coincide (for non-pathological cases), then the tangent is about to swing towards the other "side" of the curve -- i.e., a curve that had been turning "anticlockwise" is shifting to clockwise direction (if you were standing on the curve facing "forward", you'd previously been turning towards YOUR left and now are shifting to your RIGHT).
At this point, split the curve (de Casteljau). The bezier curve that is now "behind" you is guaranteed to consist solely of turns towards one "side" of the curve. Since it is also a cubic bezier, I have a closed form means for evaluating it's "bendiness". (assume the bendiness of a composite curve is the sum of the bendinesses of the component curves)
The curve ahead of you can contain, at most, one more of these points where the curve changes direction. Find it as above. Sum the two results.
This *seems* like it should work. The only possible problem I can see is for pathological cases like a cusp in the curve (where there is a discontinuity in the curve/tangent function).
Any other obvious vulnerabilities? Or, any more efficient algorithms? (this *seems* pretty straightforward... hard to imagine anything faster without constraining the curve itself)
Thx!