2 * $Logfile: /Freespace2/code/Math/spline.h $
9 * Revision 1.1 2002/05/03 03:28:12 root
13 * 3 7/08/99 10:53a Dave
14 * New multiplayer interpolation scheme. Not 100% done yet, but still
15 * better than the old way.
17 * 2 7/06/99 4:24p Dave
18 * Mid-level checkin. Starting on some potentially cool multiplayer
25 #ifndef __FS2_SPLINE_HEADER_FILE
26 #define __FS2_SPLINE_HEADER_FILE
30 // -------------------------------------------------------------------------------------------------
31 // SPLINE DEFINES/VARS
36 // max bezier degree - note the # of points directly corresponds to the degree (degree == n_points - 1).
37 // more points means more expensive!
43 vector pts[MAX_BEZ_PTS];
49 bez_spline(int _num_pts, vector *_pts[MAX_BEZ_PTS]);
52 void bez_set_points(int _num_pts, vector *_pts[MAX_BEZ_PTS]);
54 // bezier blend function
55 float BEZ(int k, int n, float u);
57 // get a point on the bez curve. u goes from 0.0 to 1.0
58 void bez_get_point(vector *out, float u);
61 void bez_render(int divs, color *c);
64 // hermite splines. cool cubic stuff
65 #define MAX_HERM_PTS 3
68 vector pts[MAX_HERM_PTS]; // control points
69 vector d_pts[MAX_HERM_PTS]; // derivative of control points (think of as velocity)
74 herm_spline(int _num_pts, vector *_pts[MAX_HERM_PTS], vector *_d_pts[MAX_HERM_PTS]);
77 void herm_set_points(int _num_pts, vector *_pts[MAX_HERM_PTS], vector *_d_pts[MAX_HERM_PTS]);
79 // get a point on the hermite curve.
80 void herm_get_point(vector *out, float u, int k);
82 // the derivative of a point on the hermite curve
83 void herm_get_deriv(vector *deriv, float u, int k);
86 void herm_render(int divs, color *c);
90 // -------------------------------------------------------------------------------------------------