dnaxx 100 Report post Posted April 3, 2006 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, 0 Share this post Link to post Share on other sites
John Schultz 811 Report post Posted April 3, 2006 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. 0 Share this post Link to post Share on other sites
Ksero 262 Report post Posted April 3, 2006 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 0 Share this post Link to post Share on other sites
John Schultz 811 Report post Posted April 3, 2006 If the OP needs the derivative (tangent) of the Bezier curve at t, it is P_{1}^{2} - P_{0}^{2} (the last DeCasteljua segment). More info here. The first and last control segments are tangents to the points P_{0} and P_{3}, 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. 0 Share this post Link to post Share on other sites
Zipster 2377 Report post Posted April 4, 2006 I would use the following curve equation:P(t) = (1 - t)^{3}P_{0} + 3t(1 - t)^{2}P_{1} + 3t^{2}(1 - t)P_{2} + t^{3}P_{3}It uses actual control points, instead of two end points and their derivative vectors 3(P_{1} - P_{0}) and 3(P_{3} - P_{2}). 0 Share this post Link to post Share on other sites
John Schultz 811 Report post Posted April 4, 2006 Quote:Original post by ZipsterI would use the following curve equation:P(t) = (1 - t)^{3}P_{0} + 3t(1 - t)^{2}P_{1} + 3t^{2}(1 - t)P_{2} + t^{3}P_{3}It uses actual control points, instead of two end points and their derivative vectors 3(P_{1} - P_{0}) and 3(P_{3} - P_{2}).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::evalSplineallows evaluation of many different spline types (Bezier, b-spline, Hermite, Catmull-Rom, etc.). 0 Share this post Link to post Share on other sites