I have a cubic hermite spline path that I am using to move sprites around on the screen (2D). I use two end points and two tangents to define the curve and then I use the basis functions for interpolation:

\begin{equation*} h_1(t) = 2t^3 - 3t^2 + 1\\ h_2(t) = -2t^3 + 3t^2\\ h_3(t) = t^3 - 2t^2 + t\\ h_4(t) = t^3 - t^2 \end{equation*}

What I want to do is have my sprite point in the direction of the curve as it is traveling along it. As I understand it from searching, the tangent to the curve (which I am assuming is the direction I want my sprite to face) involves taking the derivative of the function, however my calculus is severely lacking and once I do have the derivative, what do I do with it? Will it give me a new set of basis functions where I can just plug in a time t and get the tangent at that location?


1 Answer 1


You just take the first derivative of your basis functions as


and this is your new set of basis functions for computing first derivative of the cubic Hermite curve. You will do the same computation as you would for computing points on the curve but using this new set of basis functions.

Once you have compute the first derivative vector, normalize it into a unit vector and that is your tangent vector.

  • $\begingroup$ Thank you very much. I had attempted to take the derivatives myself, but I had an error in H'3, missing the + 1. That makes a big difference. $\endgroup$
    – Murrgon
    Commented May 9, 2015 at 1:38

You must log in to answer this question.

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