# Curvature of a Spline

## Recommended Posts

MtSMox    132
Hi, While doing research on the subjects of splines (cubic b-splines with uniform knots in my case), I found the following posts on calculating the curvature of a spline. Spline Radius of Curvature
Quote:
 K(t) = Length(Cross(X'(t),X"(t)))/pow(Length(X'(t)),3)
Curvature of a Bezier *SOLVED*
Quote:
 dT/ds = (v' / |v|^2) - (v * (v.v') / |v|^4)
I also found the first equation on http://mathworld.wolfram.com/Curvature.html That was the first equation I tried, but it gave weird results. Most of the time it showed promissing results, but it looked like it was not really working. It kinda looks like it is dT/dt instead of dT/ds, as it gives high values were the curve isn't changing that much. The second equation works better, but I'm not sure if it is correct, since I can't seem to produce the same equation following the steps taken in that thread. It's a bit hard to describe the differences, because the problem only becomes evident when you apply the equation on a complete curve to test if is working. I'll look if I can generate a rendering of the outcome to make it clear. So my first question is: what is the difference between the two equations? And the second question: Why wouldn't the first one work? Could it be a problem with my implementation? Or does the equation require a spline parameterized to arc length (mine isn't right now, but this doesn't seem to stop equation 2). Hope somebody can help me clearify this. Thanks, Joren [EDIT] Of course it turns out it's just a bug in my code that made the difference. I devided by |X''|^3 instead of |X'|^3 I would still like to know if equation 2 is correct. As I can only get to something like this: dT/ds = (v'*|v| - |v|'*v)/|v|3 But I don't really know what |v|' is. All I could think of that |v|' might be rewritten as: d|v|/dt = d|v|/ds * ds/dt = 1 * ds/dt = |v| but I don't know if this is correct as this doesn't lead to equation 2. I assume d|v|/ds is 1 as I want constant speed for arc length, but don't know if this is valid. I do like equation 2 better as it returns a vector and for equation 1 I don't know how to get the direction of the curve. Joren [Edited by - MtSMox on February 12, 2010 5:03:58 PM]