Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calculation of tangents for cardinal spline curves

Tags:

math

I am reading an article about about cubic Hermite interpolation. In the cardinal spline curve section they give a formula to calculate tangents at end points given by:

Ti = a * ( Pi+1 - Pi-1 )  

However, if I have two points P1 and P2 then to find T1

T1 = a*(P2-P0).

I need to calculate this but what should be my P0 point be? Similarly to find T2 I will need to know P3. Can anyone clarify this?

like image 401
Tarun Avatar asked Oct 23 '25 18:10

Tarun


1 Answers

You're right, this formula only makes sense for inner points in your spline which have neighbours on both sides. For endpoints you have to get the tangent from other constraints. The common solutions are:

  • supply manually chosen tangent points
  • choose the tangent such that the curvature at the endpoint is zero, this is referred to as natural boundary condition
  • choose periodic boundary conditions, that is, the tangents of the start- and endpoint are equal. Then you only have to specify one of the tangents. For a closed spline, you can get the last tangent from the natural boundary condition.

These ideas are brought up in the context of cubic splines, which require to solve a system of linear equations in order to get the polynomial coefficients for any part of the spline, because they minimize the total curvature of the whole spline, but in your case of Hermite splines they should be applicable, too.

like image 97
Thies Heidecke Avatar answered Oct 27 '25 02:10

Thies Heidecke