random_racer::Nurbs Class Reference

This NURBS class implements the Algorithm of Cox and de Boor, which calculate depending on the Control Points the final Points of the Surface. More...

#include <Nurbs.h>

Inheritance diagram for random_racer::Nurbs:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 Nurbs (unsigned int dimension, float spacing, unsigned int bufferZone=1)
 This Nurbs class is adjusted to our Requirements:
  • The Order of the NURBS Object is always 3.

virtual ~Nurbs ()
void clear ()
 Sets the Z-Component (this is the height) of the Controlpoint to 0.0.
void evaluate (unsigned int levelOfDetail, std::vector< VRS::Vector > *target)
 Evaluate all the Controlpoints with the specified Level of Detail and save the final Point of the Surface in the Target Array.
template<class T>
void fill (T pointIteratorBegin, T pointIteratorEnd, double offsetX, double offsetY)
 Modify the Z-Compnent of the Controlpoint specified by the X- and Y-Value of the Controlpoint.
void setCorrection (float correctX, float correctY)
 Sets correction values for compensating that the NURBS may not be aligned to the controlpoint grid.

Private Member Functions

void fillKnotsVector (unsigned int order, unsigned int numPoints, float *knots)
float coxDeBoor (float u, int i, int k, const float *knots)
 This is the Algorithm from Cox and de Boor, which calculates the final Points on the Surface.
Point calculateU (float t, int row)
Point calculateV (float t, Point *pnts)
Point calculate (float u, float v, Point *tempPoints)
float min ()
float max ()
unsigned int mapsArrayIndex (int row, int column)
 Maps the index of a two dimensional Array to an index of an one dimensional Array.
unsigned int mapsIndex (unsigned int row, unsigned int column)

Private Attributes

unsigned int m_dimension
unsigned int m_bufferZone
float m_spacing
float m_correctX
float m_correctY
float * m_controlPoints
unsigned int m_degree
unsigned int m_order
unsigned int m_numCvs
unsigned int m_numKnots
float * m_knots
Pointm_tempPoints

Classes

struct  Point
 A Simple Container to store to a Point the X-, Y- and Z-Component. More...

Detailed Description

This NURBS class implements the Algorithm of Cox and de Boor, which calculate depending on the Control Points the final Points of the Surface.

Definition at line 17 of file Nurbs.h.


Constructor & Destructor Documentation

random_racer::Nurbs::Nurbs ( unsigned int  dimension,
float  spacing,
unsigned int  bufferZone = 1 
)

This Nurbs class is adjusted to our Requirements:

Definition at line 11 of file Nurbs.cpp.

References clear(), fillKnotsVector(), m_bufferZone, m_controlPoints, m_correctX, m_correctY, m_degree, m_dimension, m_knots, m_numCvs, m_numKnots, m_order, m_spacing, and m_tempPoints.

Here is the call graph for this function:

random_racer::Nurbs::~Nurbs (  )  [virtual]

Definition at line 40 of file Nurbs.cpp.

References m_controlPoints, m_knots, and m_tempPoints.


Member Function Documentation

void random_racer::Nurbs::clear (  ) 

Sets the Z-Component (this is the height) of the Controlpoint to 0.0.

Definition at line 69 of file Nurbs.cpp.

References m_bufferZone, m_controlPoints, and m_dimension.

Referenced by Nurbs().

Here is the caller graph for this function:

void random_racer::Nurbs::evaluate ( unsigned int  levelOfDetail,
std::vector< VRS::Vector > *  target 
)

Evaluate all the Controlpoints with the specified Level of Detail and save the final Point of the Surface in the Target Array.

Parameters:
levelOfDetail Specify the Level of Detail
target Points to the Destination where the final Points are saved.

Definition at line 79 of file Nurbs.cpp.

References calculate(), m_bufferZone, m_correctX, m_correctY, m_dimension, m_spacing, m_tempPoints, max(), min(), random_racer::Nurbs::Point::x, random_racer::Nurbs::Point::y, and random_racer::Nurbs::Point::z.

Here is the call graph for this function:

template<class T>
void random_racer::Nurbs::fill ( pointIteratorBegin,
pointIteratorEnd,
double  offsetX,
double  offsetY 
)

Modify the Z-Compnent of the Controlpoint specified by the X- and Y-Value of the Controlpoint.

You have to use a VRS Vector and pass a Iterator to this method to modify the Controlpoint. To map the Controlpoints from Global Coordinates to Local Coordinates, you have to pass an Offset.

Parameters:
pointIteratorBegin Specify the Beginning of the Iterator
pointIteratorEnd Specify the End of the Iterator
offsetX Specify the Offset of the X-Component
offsetY Specify the Offset of the Y-Component

void random_racer::Nurbs::setCorrection ( float  correctX,
float  correctY 
) [inline]

Sets correction values for compensating that the NURBS may not be aligned to the controlpoint grid.

Definition at line 65 of file Nurbs.h.

References m_correctX, and m_correctY.

void random_racer::Nurbs::fillKnotsVector ( unsigned int  order,
unsigned int  numPoints,
float *  knots 
) [private]

Definition at line 48 of file Nurbs.cpp.

Referenced by Nurbs().

Here is the caller graph for this function:

float random_racer::Nurbs::coxDeBoor ( float  u,
int  i,
int  k,
const float *  knots 
) [private]

This is the Algorithm from Cox and de Boor, which calculates the final Points on the Surface.

A simple example on which the following functions are based, is written by Rob Bateman and can be found at: http://www.robthebloke.org/opengl_programming.html

Definition at line 171 of file Nurbs.cpp.

Referenced by calculateU(), and calculateV().

Here is the caller graph for this function:

Nurbs::Point random_racer::Nurbs::calculateU ( float  t,
int  row 
) [private]

Definition at line 198 of file Nurbs.cpp.

References coxDeBoor(), m_controlPoints, m_knots, m_numCvs, m_order, m_spacing, mapsIndex(), random_racer::Nurbs::Point::x, random_racer::Nurbs::Point::y, and random_racer::Nurbs::Point::z.

Referenced by calculate().

Here is the call graph for this function:

Here is the caller graph for this function:

Nurbs::Point random_racer::Nurbs::calculateV ( float  t,
Point pnts 
) [private]

Definition at line 222 of file Nurbs.cpp.

References coxDeBoor(), m_knots, m_numCvs, m_order, random_racer::Nurbs::Point::x, random_racer::Nurbs::Point::y, and random_racer::Nurbs::Point::z.

Referenced by calculate().

Here is the call graph for this function:

Here is the caller graph for this function:

Nurbs::Point random_racer::Nurbs::calculate ( float  u,
float  v,
Point tempPoints 
) [private]

Definition at line 246 of file Nurbs.cpp.

References calculateU(), calculateV(), and m_numCvs.

Referenced by evaluate().

Here is the call graph for this function:

Here is the caller graph for this function:

float random_racer::Nurbs::min (  )  [private]

Definition at line 159 of file Nurbs.cpp.

References m_degree, and m_knots.

Referenced by evaluate().

Here is the caller graph for this function:

float random_racer::Nurbs::max (  )  [private]

Definition at line 165 of file Nurbs.cpp.

References m_degree, m_knots, and m_numKnots.

Referenced by evaluate().

Here is the caller graph for this function:

unsigned int random_racer::Nurbs::mapsArrayIndex ( int  row,
int  column 
) [inline, private]

Maps the index of a two dimensional Array to an index of an one dimensional Array.

The index can be negative, which specify the Bufferzone around the Controlpoints.

Definition at line 121 of file Nurbs.h.

References m_bufferZone, and m_dimension.

unsigned int random_racer::Nurbs::mapsIndex ( unsigned int  row,
unsigned int  column 
) [inline, private]

Definition at line 128 of file Nurbs.h.

References m_bufferZone, and m_dimension.

Referenced by calculateU().

Here is the caller graph for this function:


Member Data Documentation

unsigned int random_racer::Nurbs::m_dimension [private]

Definition at line 82 of file Nurbs.h.

Referenced by clear(), evaluate(), mapsArrayIndex(), mapsIndex(), and Nurbs().

unsigned int random_racer::Nurbs::m_bufferZone [private]

Definition at line 82 of file Nurbs.h.

Referenced by clear(), evaluate(), mapsArrayIndex(), mapsIndex(), and Nurbs().

float random_racer::Nurbs::m_spacing [private]

Definition at line 83 of file Nurbs.h.

Referenced by calculateU(), evaluate(), and Nurbs().

float random_racer::Nurbs::m_correctX [private]

Definition at line 83 of file Nurbs.h.

Referenced by evaluate(), Nurbs(), and setCorrection().

float random_racer::Nurbs::m_correctY [private]

Definition at line 83 of file Nurbs.h.

Referenced by evaluate(), Nurbs(), and setCorrection().

float* random_racer::Nurbs::m_controlPoints [private]

Definition at line 84 of file Nurbs.h.

Referenced by calculateU(), clear(), Nurbs(), and ~Nurbs().

unsigned int random_racer::Nurbs::m_degree [private]

Definition at line 86 of file Nurbs.h.

Referenced by max(), min(), and Nurbs().

unsigned int random_racer::Nurbs::m_order [private]

Definition at line 87 of file Nurbs.h.

Referenced by calculateU(), calculateV(), and Nurbs().

unsigned int random_racer::Nurbs::m_numCvs [private]

Definition at line 88 of file Nurbs.h.

Referenced by calculate(), calculateU(), calculateV(), and Nurbs().

unsigned int random_racer::Nurbs::m_numKnots [private]

Definition at line 90 of file Nurbs.h.

Referenced by max(), and Nurbs().

float* random_racer::Nurbs::m_knots [private]

Definition at line 91 of file Nurbs.h.

Referenced by calculateU(), calculateV(), max(), min(), Nurbs(), and ~Nurbs().

Point* random_racer::Nurbs::m_tempPoints [private]

Definition at line 94 of file Nurbs.h.

Referenced by evaluate(), Nurbs(), and ~Nurbs().


The documentation for this class was generated from the following files:
Generated on Fri May 11 21:02:10 2007 for Random Racer by  doxygen 1.5.1