How does tension relate to cubic spline interpolation?
How does tension relate to cubic spline开发者_运维技巧 interpolation? I am referring to this article for cubic spline interpolation. The tension factor t=0 is for the first and t=1 for the last knot point. But where can we substitute the other tension values, like 0.1, 0.2, etc., in the cubic spline? Can anyone direct me to any helpful references?
Cubic spline has no tension values, we calculate the first derivative and 2nd derivative to ensure continuity. Bezier curve (and tension spline) has tension value, tension determines "how sharply does the curve bend". Graphic designers on Photoshop are already playing with tensions when using bezier tool
Best place to start is Wikipedia's spline and run though some calculation with pen and paper (reading it mechanically wont help much with understanding). Start with cubic spline as they are usually introduced to 3rd yr math student.
This page on "Hermite Splines" claims "mathematical background of hermite curves will help you to understand the entire family of splines".
The link you are pointing to are using Bézier splines. Bézier splines are a special form of a polynomial spline. The Bézier spline may very well be of cubic order, but isn't "defined" using tension. A cubic Bézier curve is defined by four point p1, p2, p3, p4.
- p1 = starting point for curve
- p2 = the direction that the curve "heads" to when starting from p1 (derivative)
- p3 = the direction from which the curve arrives at p4 (derivative)*
- p4 = endpoint for the curve
Normally, the curve never goes through p2 and p3.
To say that a spline is cubic basicly mean that it approximates a polynomial of degree three, ie. f(x) = ax^3 + bx^2 + cx + d
where d iz nonzero.
Cubic Bézier splines is just one way of defining how the curve should behave. Tension splines may also be cubic but is defined with tensions instead of derivatives.
If you give some background to why you wan't to use that code, how much of the maths you would like to understand and what your background is i might be able to point you to some reading..
A Cubic Spline fits a curve through a set of X and Y values that you pass to it. The values must define a function, that means that each x values must be higher than the previous one. Another way to say this with some code is: X[i+1] > X[i], must be true. Otherwise the curve folds over itself and that is not a valid function in the strict mathematical sense. With a Cubic Spline fit to the data you can now ask for any value between the first and last X value. It will interpolate the answer if you do not ask for a value that is not right at an X value that you passed in. The results will be smooth and continuous with a continuous first derivative. If you haven’t had any calculus you could consult an online reference for the definition of first derivative, but honestly, if you’re just trying to find a Cubic Spline or a Tension Spline, you don’t need to know.
Here’s the difference between and Cubic Spline and a Tension Spline. A Cubic Spline can return results that wiggle up and down between the points that you passed in (it will always pass through the data you passed in). It could be said that those wiggles are not necessary. We really have no idea what is happening in between the data points and it may very well wiggle, it’s just not known. In this case we usually prefer not to add additional shape to the curve. A Tension Spline will suppress up and down wiggles between data points. Let me be clear, a normal Cubic Spline usually will not add up and down wiggles either, only when there is a very sharp change in the data ( Y[i+1] >> Y[i] ), is it possible that wiggles will be produced between point (i) and point (i+1).
精彩评论