00001 /*
00002 File: Hermite.h
00003
00004 Function: Provides cubic interpolation functions
00005
00006 Author: Andrew Willmott
00007
00008 Copyright: (c) 1998-2000, Andrew Willmott
00009 */
00010
00011 #ifndef __Hermite__
00012 #define __Hermite__
00013
00014 #include "gcl/Geometry.h"
00015
00016 /*
00017 Calculate hermite coefficients.
00018
00019 t0, y0, ySlope0 are start time, value, and slope.
00020 t1, y1, ySlope1 are end time, value, and slope.
00021 t1 had better not equal t0.
00022
00023 For automatic slope control, set
00024 ySlope1 = (y2 - y0) / (t2 / t0);
00025 ySlope0 = (y1 - y-1) / (t1 / t-1);
00026 */
00027
00028 typedef Vector4 Cubic;
00029
00030 Void CalcHermiteCoeffs(
00031 GCLReal t0,
00032 GCLReal t1,
00033 GCLReal y0,
00034 GCLReal y1,
00035 GCLReal ySlope0,
00036 GCLReal ySlope1,
00037 Cubic &result
00038 );
00039
00040 /*
00041 Evaluate y(t), using coeffs computed by CalcHermiteCoeffs().
00042 t0, t1 have to be same as you supplied to CalcHermiteCoeffs,
00043 and t should be between t0 and t1, inclusive.
00044 */
00045
00046 GCLReal EvalCubic(Cubic &cubicCoeffs, GCLReal t, GCLReal t0, GCLReal t1);
00047
00048 #endif