Degrafa – Introduction to Splines V
Continuing from Part IV, today’s topic is spline parameterization. The cubic Bezier spline in Degrafa is a parameteric curve. Like other parameteric curves (quadratic and cubic Beziers, for example), the spline has a natural parameter whose domain is zero to one. The parameter t = 0 corresponds to the first knot and t = 1 corresponds to the last knot. Parameter values between 0 and 1 correspond to interior points of the spline.
However, each spline segment is composed of independent parameteric curves, each of which have their own local domain in [0,1]. So, if we ask the question, ‘where is t = 0.5 on the spline’, how do we locate that point on the curve? Any value in [0,1] is first mapped into one of the individual cubic Bezier curves. This mapping depends on the spline’s parameterization.
The two most common parameterization algorithms are uniform and arc-length. The most common and least computatinoally expensive approach is uniform parameterization. This is the default in Degrafa. Uniform parameterization simply distributes the parameter values based on the total number of knots. Geometric placement of the knots is not considered. This approach is illustrated in the following diagram.
An example of mapping the spline’s t-parameter into a local curve’s t-paramter is illustrated in red. The parameter value t = 0.35 is mapped into the second cubic Bezier curve at the local parameter value t = 0.6.
Arc-length parameterization distributes parameter values based on length along the curve. Uniform parameterization distributes parameter value based entirely on the total number of knots. If you had a curve whose length were constant, but changed the knot distribution, you would see different locations of a sprite that was positioned at t = 0.5. With arc-length parameterization, t = 0.5 would always map to halfway along the length of the spline.
Arc-length parameterzation is more computationally expensive. Supporting this parameterization in Degrafa will require modification to the cubic Bezier class on top of which the spline is built.