KallistiOS  ##version##
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
bspline.h
Go to the documentation of this file.
1 /* KallistiOS ##version##
2 
3  bspline.h
4  Copyright (C) 2000 Dan Potter
5 
6 */
7 
8 #ifndef __KOS_BSPLINE_H
9 #define __KOS_BSPLINE_H
10 
11 /** \file kos/bspline.h
12  \brief B-Spline curve support.
13 
14  This module provides utility functions to generate b-spline curves in your
15  program. It is used by passing in a set of control points to
16  bspline_coeff(), and then querying for individual points using
17  bspline_get_point().
18 
19  Note that this module is NOT thread-safe.
20 
21  \author Dan Potter
22 */
23 
24 #include <sys/cdefs.h>
25 __BEGIN_DECLS
26 
27 #include <kos/vector.h>
28 
29 /** \brief Calculate and set b-spline coefficients.
30 
31  This function performs the initial setup work of calculating the
32  coefficients needed to generate a b-spline curve for the specified set of
33  points. The calculation is based on a total of 4 points: one previous point,
34  the current point, and two points that occur after the current point.
35 
36  The current point should be at pnt[0], the previous at pnt[-1], and the
37  future points should be at pnt[1], and pnt[2]. I repeat: pnt[-1] must be a
38  valid point for this to work properly.
39 
40  \param pnt The array of points used to calculate the b-spline
41  coefficients.
42 */
43 void bspline_coeff(const point_t *pnt);
44 
45 /** \brief Generate the next point for the current set of coefficients.
46 
47  Given a 't' (between 0.0f and 1.0f) this will generate the next point value
48  for the current set of coefficients.
49 
50  \param t The "t" value for the b-spline generation function.
51  \param p Storage for the generated point.
52 */
53 void bspline_get_point(float t, point_t *p);
54 
55 __END_DECLS
56 
57 #endif /* __KOS_BSPLINE_H */
void bspline_coeff(const point_t *pnt)
Calculate and set b-spline coefficients.
4-part vector type.
Definition: vector.h:34
Primitive matrix, vector, and point types.
void bspline_get_point(float t, point_t *p)
Generate the next point for the current set of coefficients.