/**

  * Bezier functions written by Justin Klein, 2003

  * Revised in 2004

  *

  * This file contains two Bezier-Curve functions:

  * pointOnBezierCurve returns a point on a curve; this should be used, for instance, for making a camera move along

  *                              a bezier curve, but not for actually drawing a curve;

  * glDrawBezierCurve  actually draws an entire curve.

  **/

 

typedef struct BezVector

{

      float x;

      float y;

      float z;

} BezVector;

 

 

 

/**

  * Uses the equasion for a Bezier curve to return a point on the curve that is specified by:

  * -numControlPoints specifies the number of control points contained in points[], an array of VECTORS

  *  (each with an X,Y,Z value).

  *

  * -points is an array that specifies the control points for the curve

  *

  * -t is a floating point number between 0 and 1 that specifies how far along the line a point is

  *  to be specified (0 specifies a point on the far left of the line, 1 is the far right)

  *

  * The Bezier Curve equasion is:

  * B(t) = P1 * ( 1 - t )^3 + P2 * 3 * t * ( 1 - t )^2 + P3 * 3 * t^2 * ( 1 - t ) + P4 * t^3

  * ->B(t) is a point on the curve

  * ->Points P1, P2, P3, P4 specify the curve (control points on the curve)

  * ->t ranges from 0 to 1, 0 will specify a point at the beginning, .3 will specify a point 30%

  *   of the way down the curve.  So T is like the "distance" along the curve to the point that B(t) will specify.

  *

  * GENERALLY: (http://astronomy.swin.edu.au/~pbourke/curves/bezier/)

  * B(t) = SUM(from k = 0 to N){Pk*[ N!/[k!*(N-k)!] ] * t^k * (1-t)^(N-k)} for 0 <= t <= 1

  **/

BezVector pointOnBezierCurve(BezVector points[], int numControlPoints, float t);

 

 

 

 

/**

  * Draws a Bezier Curve by calling pointOnBezierCurve to draw a LINE_STRIP; its parameters are:

  *

  * -numControlPoints specifies the number of control points contained in points[], an array of VECTORS

  *  (each with an X,Y,Z value).

  *

  * -points is an array that specifies the control points for the curve

  *

  * -numSteps is the number of points to calculate along the line; two points will result in a straight line

  *  (2 endpoints), 3 points will result in a jagged, curved line, and so forth...the higer the number, the smoother the curve.

  *

  **/

void glDrawBezierCurve(BezVector points[], int numControlPoints, int numSteps);