I'm getting a little bit confused trying to write my own algorithm for calculating a Spline.

Let's start saying that for my application I need that the curve, interpolating between more points, must be $C^{0}, C^{1}, C^{2}$ continuous and that the curve is given in the following parametric form. $$ s_{i}(t) = a_{i} + b_{i}t + c_{i}t^{2} + d_{i}t^{3} $$ where $t \in [0;1($

Now: according to this page and this paper (page: 129) the first derivative of the spline should be: $$ s_{i}'(t) = b_{i} + 2c_{i}t + 3d_{i}t^{2} $$

but I found in internet this tutorial (page 9) which is saying that not the derivative of $t$ must be calculated:

enter image description here

because we are interested in derivative with respect to $x,y,z$ or whatelse and $t$ is just a parametrization of the curve, so the latter should be not taken into consideration. This sounds to be right to me. But since I ve to write an algorithm, I really have no idea on how to go further.

Which of the one is right?


1 Answer 1


I assume the spline you're trying to construct will be $y$ as a function of $x$, as in the notes you cited, and not a parametric spline where $x$ and $y$ are functions of some parameter $t$.

On each interval $[x_i, x_{i+1}]$, you can define a "local" parameter $t$ to simplify the algebra, where $t = (x-x_i)/(x_{i+1}-x_i)$. Then you can write the equation of the cubic segment as $s_{i}(t) = a_{i} + b_{i}t + c_{i}t^{2} + d_{i}t^{3}$, where $t \in [0,1]$.

The conditions to enforce continuity say that certain derivatives at the far end of one segment ought to be equal to certain derivatives at the start of the next segment. But the derivatives involved are derivatives with respect to $\mathbf{x}$. Your formula $s_{i}'(t) = b_{i} + 2c_{i}t + 3d_{i}t^{2}$ gives a derivative with respect to $t$. Written more carefully, it says that $$ \frac{ds_i}{dt}(t) = b_{i} + 2c_{i}t + 3d_{i}t^{2} $$ and so $$ \frac{ds_i}{dx}(x) = \frac{ds_i}{dt}(x) \frac{dt}{dx} = \frac{b_{i} + 2c_{i}t + 3d_{i}t^{2}}{x_{i+1}-x_i} $$ Then, the condition for $C_1$ continuity (for example) at $x = x_i$ is $$ \frac{ds_{i-1}}{dx}(x=x_i) = \frac{ds_{i}}{dx}(x=x_i) $$.

So, in short, the notes you cited are correct.

  • $\begingroup$ thank you very much for answering my question. But I have a misunderstanding feeling, since you say that the notes are right. But as far as I'm concern the two first documents (page 129), where $f(\boldsymbol{t})=\boldsymbol{t}\cdot\boldsymbol{c}$, the spline is parametric with the parameter $\boldsymbol{t}$. In short, the first paper and the link say different things than the last note I cited. So, even if your explanation is clear, they are to me different splines $\endgroup$
    – Dave
    Commented Jan 9, 2015 at 8:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .