5.2 Keyframe Compression 325
5.2.2 Evaluation of a B-Spline Curve
The B-spline curve control points are computed off-line, so the efficiency of the
evaluation of Equation (5.6) is not of concern for the construction. However, the B-
spline curve must be evaluated frequently during the program’s execution, so it is
important to minimize the amount of computation time for each evaluation.
The straightforward method for evaluation of X(u) in Equation (5.6) is to com-
pute all of N
i , d
(u) for 0 ≤ i ≤ n using the recursive formulas from Equations (5.7)
and (5.8). The pseudocode to compute the basis function values follows. The number
n,degreed, and control points Q[i] are assumed to be globally accessible.
float N (int i, int j, float u)
{
if (j > 0)
{
c0