2 * Copyright (C) Volition, Inc. 1999. All rights reserved.
4 * All source code herein is the property of Volition, Inc. You may not sell
5 * or otherwise commercially exploit the source or things you created based on
10 * $Logfile: /Freespace2/code/Math/spline.h $
17 * Revision 1.2 2002/06/09 04:41:15 relnev
18 * added copyright header
20 * Revision 1.1.1.1 2002/05/03 03:28:12 root
24 * 3 7/08/99 10:53a Dave
25 * New multiplayer interpolation scheme. Not 100% done yet, but still
26 * better than the old way.
28 * 2 7/06/99 4:24p Dave
29 * Mid-level checkin. Starting on some potentially cool multiplayer
36 #ifndef __FS2_SPLINE_HEADER_FILE
37 #define __FS2_SPLINE_HEADER_FILE
41 // -------------------------------------------------------------------------------------------------
42 // SPLINE DEFINES/VARS
47 // max bezier degree - note the # of points directly corresponds to the degree (degree == n_points - 1).
48 // more points means more expensive!
54 vector pts[MAX_BEZ_PTS];
60 bez_spline(int _num_pts, vector *_pts[MAX_BEZ_PTS]);
63 void bez_set_points(int _num_pts, vector *_pts[MAX_BEZ_PTS]);
65 // bezier blend function
66 float BEZ(int k, int n, float u);
68 // get a point on the bez curve. u goes from 0.0 to 1.0
69 void bez_get_point(vector *out, float u);
72 void bez_render(int divs, color *c);
75 // hermite splines. cool cubic stuff
76 #define MAX_HERM_PTS 3
79 vector pts[MAX_HERM_PTS]; // control points
80 vector d_pts[MAX_HERM_PTS]; // derivative of control points (think of as velocity)
85 herm_spline(int _num_pts, vector *_pts[MAX_HERM_PTS], vector *_d_pts[MAX_HERM_PTS]);
88 void herm_set_points(int _num_pts, vector *_pts[MAX_HERM_PTS], vector *_d_pts[MAX_HERM_PTS]);
90 // get a point on the hermite curve.
91 void herm_get_point(vector *out, float u, int k);
93 // the derivative of a point on the hermite curve
94 void herm_get_deriv(vector *deriv, float u, int k);
97 void herm_render(int divs, color *c);
101 // -------------------------------------------------------------------------------------------------