GClasses

GClasses::GBezier Class Reference

Represents a Bezier curve. More...

#include <GBezier.h>

List of all members.

Public Member Functions

 GBezier (int nControlPoints)
 GBezier (GBezier *pThat)
 ~GBezier ()
int controlPointCount ()
 Returns the number of control points in this curve (which is always one more than the degree of the curve).
void point (double t, G3DVector *pOutPoint)
 Returns a point on the curve.
void controlPoint (G3DVector *pOutPoint, double *pOutWeight, int n)
 Returns a control point.
void setControlPoint (int n, G3DVector *pPoint, double weight)
 Sets a control point.
GBeziercopy ()
void elevateDegree ()
 Increases the degree (and number of control points) of the curve by one without changing the curve. (Only the control points are changed.)
void segment (double t, bool bTail)
 Crops the curve. If bTail is true, only the end of the curve remains. If bTail is false, only the beginning of the curve remains.
void derivativeAtZero (G3DVector *pOutPoint)
 Returns the tangeant to the curve at t=0.
double curvatureAtZero ()
 todo: this method is not reliable--there's a bug in this method somewhere
void toPolynomial (G3DVector *pOutCoefficients)
 This expects you to pass in a pointer to an array of G3DVector of size m_nControlPoints.

Static Public Member Functions

static void test ()
 Performs unit tests for this class. Throws an exception if there is a failure.
static GBezierfromPolynomial (G3DVector *pCoefficients, int nCoefficients)
 Example: If you have the three equations: x=1+2t+3t*t, y=4+5t+6t*t, z=7+8t+9t*t then you would pass in this array of points: { (1, 4, 7), (2, 5, 8), (3, 6, 9) } to get the equivalent Bezier curve.

Protected Member Functions

struct GBezierPoint * deCasteljau (double t, bool bTail)

Protected Attributes

int m_nControlPoints
struct GBezierPoint * m_pPoints

Detailed Description

Represents a Bezier curve.


Constructor & Destructor Documentation

GClasses::GBezier::GBezier ( int  nControlPoints)
GClasses::GBezier::GBezier ( GBezier pThat)
GClasses::GBezier::~GBezier ( )

Member Function Documentation

void GClasses::GBezier::controlPoint ( G3DVector pOutPoint,
double *  pOutWeight,
int  n 
)

Returns a control point.

int GClasses::GBezier::controlPointCount ( )

Returns the number of control points in this curve (which is always one more than the degree of the curve).

GBezier* GClasses::GBezier::copy ( )
double GClasses::GBezier::curvatureAtZero ( )

todo: this method is not reliable--there's a bug in this method somewhere

struct GBezierPoint* GClasses::GBezier::deCasteljau ( double  t,
bool  bTail 
) [read, protected]
void GClasses::GBezier::derivativeAtZero ( G3DVector pOutPoint)

Returns the tangeant to the curve at t=0.

void GClasses::GBezier::elevateDegree ( )

Increases the degree (and number of control points) of the curve by one without changing the curve. (Only the control points are changed.)

static GBezier* GClasses::GBezier::fromPolynomial ( G3DVector pCoefficients,
int  nCoefficients 
) [static]

Example: If you have the three equations: x=1+2t+3t*t, y=4+5t+6t*t, z=7+8t+9t*t then you would pass in this array of points: { (1, 4, 7), (2, 5, 8), (3, 6, 9) } to get the equivalent Bezier curve.

void GClasses::GBezier::point ( double  t,
G3DVector pOutPoint 
)

Returns a point on the curve.

void GClasses::GBezier::segment ( double  t,
bool  bTail 
)

Crops the curve. If bTail is true, only the end of the curve remains. If bTail is false, only the beginning of the curve remains.

void GClasses::GBezier::setControlPoint ( int  n,
G3DVector pPoint,
double  weight 
)

Sets a control point.

static void GClasses::GBezier::test ( ) [static]

Performs unit tests for this class. Throws an exception if there is a failure.

void GClasses::GBezier::toPolynomial ( G3DVector pOutCoefficients)

This expects you to pass in a pointer to an array of G3DVector of size m_nControlPoints.


Member Data Documentation

struct GBezierPoint* GClasses::GBezier::m_pPoints [protected]