[Math] Smooth curve between 2 points with given gradient at first point

bezier-curvecurvesspline

I'm trying to create a smooth curve between 2 given points with a given gradient/tangent at the first point and any gradient at the last. The idea being to be able to join these to create a smooth overall curve. The reason I am not using the standard spline methods is that I do not know any of the future points when drawing each part of the curve.

What is the best/simplest way to achieve this?

Best Answer

Cubic Hermite curve seems to be right for the purpose. A cubic Hermite curve is defined by a series of points and first derivatives at these given points. A cubic Hermite curve is a piecewise continuous curve (in general only C1) and each segment (the portion between two successive points) is in fact a cubic polynomial. See this link for more details. It is easy to implement and the best thing is adding a new point will not affect the shape of the previous segments. If you do not know what first derivative value should be used for any point, you can use finite difference method to infer it.