Curves – Bézier Control Points for Drawing an Interpolating Cubic Spline Function

bezier-curvecurves

Related to my previous question about the type of curve Photoshop's Curves interface uses, it seems it uses an interpolating cubic spline function: for a set of xi, yi pairs defined by the user, we can find a cubic spline f(x) such that f(xi) = yi for all the points.

On the other hand, this clear explanation has helped me draw the basis spline (Section 4) and the natural spline (Section 5) for the xi, yi pairs with SVG Bézier paths, but these are parametric curves where x and y are both functions of t.

I feel like I may be circling the obvious, but I'm having a hard time applying this knowledge to derive the Bézier control points for a non-parametric curve, where y = f(x). (Section 7 of the aforementioned paper makes it sound like it should be apparent how to do it)

Edit 1: Looks like my question may be overlapping with this one, where one answer suggests either a Catmull-Rom or a Natural spline. So I guess what's not clear is how to use any of these techniques to obtain curves that still retain the aspect of a function (i.e. no multiple y values for a single x)?

Best Answer

Catmull-Rom and Natural spline are both ways for creating a cubic spline curve interpolating a given set of points. Typically, the curve will be in parametric form where x and y are both function of t. For parametric spline interpolation, assigning a parameter to each data point is the most essential step, which is often referred as parametrization. Typically, we will use either chord-length or centripetal parametrization.

If you need "cubic spline function", all you need to do is to use $t=(x-x_{min})/(x_{max}-x_{min})$ for parametrization where $x_{min}$ is the smallest $x$ value and $x_{max}$ the largest $x$ value among your data points. You can choose either Catmull-Rom or Natural spline to construct your "spline function". Afterwards, evaluating the spline function will simply require an additional step to convert $x_i$ to $t_i$ as $t_i=(x_i-x_{min})/(x_{max}-x_{min})$.