Spline derivation

Started by
4 comments, last by John Schultz 18 years ago
Hello! Source: http://www.bergen.org/AAST/projects/3DSMaxTutorial/mathematics.html That's the curve: and the formulas: . How do I get the x1', x2', y1', y2' derivations for the formulas? Thank you,
Advertisement
Cubic splines use a weighted (blended) sum of 4 points: you supply them.

You can also evaluate a Bezier curve using repeated linear interpolation using DeCasteljau.

Firstly, those formulas aren't entirely accurate. For example, when the interpolation variable t is 0, you'd expect to end up at one of the end points of the curve, while in fact you end up at the point (x1 + x2, y1 + y2)

As to your actual question, it seems a bit off... To get those derivatives, derive each function by the specific variable...
I think that what you're looking for is the derivative of the curve. ie. deriving with respect to t instead of x1
If the OP needs the derivative (tangent) of the Bezier curve at t, it is P12 - P02 (the last DeCasteljua segment). More info here. The first and last control segments are tangents to the points P0 and P3, respectively (when evaluated, t=0, t=1).

See also section 2.5, parametric derivative which is a degree n-1 curve (n = 3: cubic => new curve is n = 2: quadratic, etc.). The first derivative curve is also called a hodograph.
I would use the following curve equation:
P(t) = (1 - t)3P0 + 3t(1 - t)2P1 + 3t2(1 - t)P2 + t3P3

It uses actual control points, instead of two end points and their derivative vectors 3(P1 - P0) and 3(P3 - P2).
Quote:Original post by Zipster
I would use the following curve equation:
P(t) = (1 - t)3P0 + 3t(1 - t)2P1 + 3t2(1 - t)P2 + t3P3

It uses actual control points, instead of two end points and their derivative vectors 3(P1 - P0) and 3(P3 - P2).


That's a good point. The OP's diagram's tangent/derivative vectors are a bit short (the end of the vectors appear to be the inner geometric control points)...

The matrix evaluation form:

flt Mat4::evalSpline(flt a,flt controlPoints[4]) {  Vec4 s = *this ^ *(Vec4 *)controlPoints; // ^ = Mat4 transform Vec4  return ((s.x*a + s.y)*a + s.z)*a + s.w;} // Mat4::evalSpline


allows evaluation of many different spline types (Bezier, b-spline, Hermite, Catmull-Rom, etc.).

This topic is closed to new replies.

Advertisement