Curvature of bezier curve

Started by
10 comments, last by tsuraan 21 years, 10 months ago
So, the curvature of a bezier curve is defined to be (||x'' ^ x''''||) / (||x''||^3). The first derivative of the curve is easily found using the forward difference method, and I suppose the second derivatives could be found by using the second forward differences. However, I would think that there is an easier way to get the curvature of a bezier curve. Does anyone know of one?
Advertisement
A bezier is just a polynomial. Is there a need for an easier way than the power rule to find the derivatives of a polynomial? A cubic bezier is just A*t^3+B*t^2+C*t+D where A, B, C and D are vectors. A=(-PO+P1-P2+P3), B=(3*P0-2*P1+P2), C=(-3*P0+P1) and D=P0. Or perhaps I don''t understand your question.
Keys to success: Ability, ambition and opportunity.
The problem is that my curves are of arbitrary order. The user can keep adding points to their heart''s content, and I don''t really think it would be efficient to create a generic differentiator for polynomials.
It seems like that would be difficult for the user to control since the curve only actually goes through the start and end points. It seems like it would be a whole lot easier for them if each point was the end point for a cubic bezier with control handles. That seems to be how most software does it.
Keys to success: Ability, ambition and opportunity.
Yep... for an arbitrary set of points, just use generic cubic splines.

Timkin
For a useful bezier curve-based art program, I would agree. However, this program is designed to demonstrate how bezier curves of arbitrary degree behave, so arbitrary degree curves are a must. I can make do with the equation above, but it would be cool if anyone knew of a shortcut. Thanks for the help.
Considering the relatively fixed nature of the equation and purpose symbolic differentiation seems reasonable. Every term is (1-t)^(o-n)*t^n where o is the order and n is the term. You don''t need to generate the formula for the curvature as a function of t. You only have to find the vectors for the first and second derivative for a given value of t.
Keys to success: Ability, ambition and opportunity.
Yeah, I suppose that would work. I''ll give it a shot
Actually, I''m not sure where you got your formula from tsuraan but I understood curvature to be defined as
       | T''(u) |K(u) = ---------       | r''(u) | 


where T is the unit tangent vector at the point u on the curve and r is the radius vector to u from the coordinate origin...

From which it can be shown that
       |r''(u)xr"(u)|K(u) = -------------         | r''(u) |3 


You should also note that |r''(u)| is equivalent to the parametic velocity of the curve:

          ds|r''(u)| = --          du 


If this is what you meant when you were using x above, then please ignore this post. Otherwise, be careful that you use the correct derivatives, noting that
ds         dx      dy-- = SQRT[(--)2 + (--)2]du         du      du 



Cheers,

Timkin
Yeah, when I wrote x, I meant r, rather than x as in the (x,y) coordinate of the given point. The ^ symbol is what my reference was using for cross product, whereas you use x. Other than that, it looks like we have the same equation. I did a little more work on it, and it looks like the initial method I posted (using forward differences to calculate the tangent and derivative of the tangent) should work fine.

The only problem I have now is figuring out the sign of the curvature. The curvature of a bezier curve can be shown as a vector K(t) * N(t), where K is curvature scalar and N is the unit normal. Using this convention, and assuming the the normal vector is always found using the ninety degree rotation of the unit tangent, then a negative curvature is necessary at times. Any idea how to figure out what the sign of the thing should be?

This topic is closed to new replies.

Advertisement