Engines that Interpolate Values
113
Keys and Key Values
In Figure 10-3, the X axis represents keys, such as time, and the Y axis represents any
attribute or set of attributes, such as location, color, or transparency. Y axis values are
called key values. Notice that the interval between the key values is nonuniform. After
setting the key values, csSpline fills in the values between the key values.
The difference between the piecewise linear and cubic splines is created by the different
weight factors.
Values outside of the maximum and minimum keys are clamped to the maximum and
minimum keys and key values.
Key values, such as colors or coordinates, are not kept in a csSpline object. Consequently,
a single csSpline object can define the animation spline for many keys. Key values are
typically kept in a csMorphEng engine, which calculates the weighted sum of key values
to produce the final result.
csSpline Fields
The following fields set the spline values:
csMFFloat* key() const;
csMFFloat* weight() const;
void setFraction(csFloat fraction);
csFloat getFraction();
void setBasis(const csMatrix4f& basis);
void getBasis(csMatrix4f& basis);
For an explanation of key() and setFraction(), see, “Interpolator Engine Terminology” on
page 111.
weight() specifies the multiplication factor that changes the linear graph into a spline
curve.
setBasis() specifies the matrix by which you multiply the four key values (closest to the
fraction) to get the weight values.
Note: setBasis() is ignored in Cosmo 3D release 1.0 and 1.1. All splines are piecewise
linear.