Nurb Class Template Reference

Class template interpolates tabulated data with non-uniform rational Bezier splines (NURBS). More...

#include <Intp.h>

Inherits Intp< xType, yType >.

Inheritance diagram for Nurb:

Inheritance graph
[legend]
List of all members.

Public Member Functions

virtual xType * copyArrayX (enum Intp< xType, yType >::VTYPE vType, xType *array) const
virtual yType * copyArrayY (enum Intp< xType, yType >::VTYPE vType, yType *array) const
virtual yType eval (xType x) throw (IntpErr)
virtual const xType * getArrayX (enum Intp< xType, yType >::VTYPE vType) const
virtual const yType * getArrayY (enum Intp< xType, yType >::VTYPE vType) const
virtual int getCount (enum Intp< xType, yType >::VTYPE vType) const
 Nurb (const Intp< xType, yType > &in)
 Nurb (const Nurb< xType, yType > &po)
 Nurb (const xType *arX, const yType *arY, const xType *arK, int nCount, int nPoints=DEF_POINTS)
 Nurb (const xType *arX, const yType *arY, int nCount, int nPoints=DEF_POINTS)
bool setCount (int nPoints)
virtual bool update (void)
 ~Nurb (void)

Static Public Member Functions

static bool evalKnots (xType *arK, const xType *arX, int nCount, int nPoints=DEF_POINTS)

Static Public Attributes

static const int DEF_POINTS = 4
static const xType VAR_SMALL = 1.0E-20

Detailed Description

template<typename xType, typename yType>
class calc::Nurb< xType, yType >

Class template interpolates tabulated data with non-uniform rational Bezier splines (NURBS).

In instantiation, an object is supplied with a one-dimensional set of independent variable and corresponding dependent variable data tables with a specific domain and range. The dependent data must be defined at every independent data point, continuous, and single-valued. When the interpolation object is evaluated within the data table domain, an interpolation value is calculated and returned. Fixed degree Bezier polynomials of a user-specified number are used for interpolation. A polynomial curve is calculated to fit sequential data points. The data point count of the curve is based on the order of the polynomial.

The declaration typename <xType> specifies the form of independent variables used in interpolation calculations. The declaration typename <yType> specifies the form of solution variables used in interpolation calculations. In general, the <yType> variables should be the equal or superset of the <xType> variables.

Author
efgeorge
Date
2006/07/19 13:21:43
Revision
1.3
Examples:

example_Intp.txt.


Constructor & Destructor Documentation

Nurb ( const xType *  arX,
const yType *  arY,
int  nCount,
int  nPoints = DEF_POINTS 
)

Constructor initializes a non-uniform rational Bezier spline interpolation object.

Parameters:
arX a pointer to an independent value interpolation array (x units)
arY a pointer to a dependent value interpolation array (y units)
nCount data count for the specified arrays arX and arY
nPoints data point count of polynomials used in interpolation evaluations (optional)
Remarks:
  • The data count value nCount must be greater than zero.
  • The polynomial point count value nPoints must be greater than zero.
  • The value nPoints should, be at most, equal to the data count value nCount.
  • If the value nPoints is not specified, a default value of Nurb::DEF_POINTS is used, and may be decreased based on the data count value nCount.
  • The degree of polynomials used in interpolation evaluations is one less than the polynomial point count.

Nurb ( const xType *  arX,
const yType *  arY,
const xType *  arK,
int  nCount,
int  nPoints = DEF_POINTS 
)

Constructor initializes a non-uniform rational Bezier spline interpolation object.

Parameters:
arX a pointer to an independent value interpolation array (x units)
arY a pointer to a dependent value interpolation array (y units)
arK a pointer to an independent value interpolation knot vector array (scaled x units)
nCount data count for the specified arrays arX and arY
nPoints data point count of polynomials used in interpolation evaluations (optional)
Remarks:
  • The data count value nCount must be greater than zero.
  • The polynomial point count value nPoints must be greater than zero.
  • The value nPoints should, be at most, equal to the data count value nCount.
  • If the value nPoints is not specified, a default value of Nurb::DEF_POINTS is used, and may be decreased based on the data count value nCount.
  • The degree of polynomials used in interpolation evaluations is one less than the polynomial point count.
  • The values in the knot vector array arK are scaled between 0 and 1. The lowest domain value of the interpolation object corresponds to a 0 scaled value of the knot vector arK; the highest domain value corresponds to 1.
  • The number of values in the knot vector array arK equals the data count of the interpolation object, plus the polynomial data count used in polynomial calculations.
  • The user-supplied knot vector values stored in the interpolation object are altered during calls to Nurb::update().

Nurb ( const Nurb< xType, yType > &  nu  ) 

Copy constructor initializes a polynomial interpolation object from the specified existing polynomial interpolation object.

Parameters:
nu a reference to a NURBS interpolation object

Nurb ( const Intp< xType, yType > &  in  ) 

Copy constructor initializes a polynomial interpolation object from the specified existing interpolation object.

Parameters:
in a reference to an interpolation object
Remarks:
  • The existing interpolation polynomial data point count is is transferred to the new interpolation object.
  • calc::Cube interpolation objects carry an existing interpolation polynomial data point count of Cube::DEF_POINTS.

~Nurb ( void   ) 

Destructor frees allocated memory.


Member Function Documentation

xType * copyArrayX ( enum Intp< xType, yType >::VTYPE  vType,
xType *  array 
) const [virtual]

Virtual function copies values contained in an identified object independent array to the specified pointer.

Parameters:
vType variable index indentifying the type of data
array a pointer to a copy of the object's independent data array (varying units)
Returns:
the value of the pointer array
Remarks:
  • The data count of the object's array identified by vType is returned by a corresponding function call Intp::getCount().
  • The pointer to the object's array identified by vType is returned by a corresponding function call Intp::getArrayX().
  • The user-supplied pointer array should have sufficient allocated memory.
  • If the object is not initialized, a null pointer is returned.
  • If the object does not have the variable identified by vType, a null pointer is returned.
  • The units expressed in the values of array vary depending on the the variable index vType.

Note:
  • The values in the knot vector array are scaled between 0 and 1. The lowest domain value of the interpolation object corresponds to a 0 scaled value of the knot vector; the highest domain value corresponds to 1.
  • The number of values in the knot vector array equals the data count of the interpolation object, plus the polynomial data count used in polynomial calculations.

yType * copyArrayY ( enum Intp< xType, yType >::VTYPE  vType,
yType *  array 
) const [virtual]

Virtual function copies values contained in an identified object dependent array to the specified pointer.

Parameters:
vType variable index indentifying the type of data
array a pointer to a copy of the object's dependent data array (varying units)
Returns:
the value of the pointer array
Remarks:
  • The data count of the object's array identified by vType is returned by a corresponding function call Intp::getCount().
  • The pointer to the object's array identified by vType is returned by a corresponding function call Intp::getArrayY().
  • The user-supplied pointer array should have sufficient allocated memory.
  • If the object is not initialized, a null pointer is returned.
  • If the object does not have the variable identified by vType, a null pointer is returned.
  • The units expressed in the values of array vary depending on the the variable index vType.

yType eval ( xType  x  )  throw (IntpErr) [virtual]

Virtual function interpolates the dependent data at the specified independent data value.

Parameters:
x an independent value interpolation point (x units)
Returns:
calculated interpolation value evaluated at value x (y units)
Exceptions:
IntpErr type of object thrown

Implements Intp.

bool evalKnots ( xType *  arK,
const xType *  arX,
int  nCount,
int  nPoints = DEF_POINTS 
) [static]

Static function calculates the NURBS knot vector for non-uniform rational Bezier spline interpolation.

Parameters:
arK a pointer to a calculated independent value interpolation knot vector array (scaled x units)
arX a pointer to an independent value interpolation array (x units)
nCount data count for the specified arrays arX and arY
nPoints data point count of polynomials used in interpolation evaluations (optional)
Returns:
status flag
  • false (successful execution)
  • true (execution error)
    • memory allocation error
    • some independent data points are equal or decreasing
Remarks:
  • The data count of the input array arX is equal to the independent data point count nCount of the interpolation object.
  • The calculated knot vector arK is non-periodic with end point multiplicities equal to the interpolation polynomial degree count plus one.
  • The data size of the knot vector arK is the data point count of the independent values array nCount plus the interpolation polynomial data point count nPoints.
  • The data count value nCount must be greater than zero.
  • The polynomial point count value nPoints must be greater than zero.
  • The value nPoints should, be at most, equal to the data count value nCount.
  • If the value nPoints is not specified, a default value of Nurb::DEF_POINTS is used, and may be decreased based on the data count value nCount.
  • The degree of polynomials used in interpolation evaluations is one less than the polynomial point count.
  • The values in the knot vector array arK are scaled between 0 and 1. The lowest domain value of the interpolation object corresponds to a 0 scaled value of the knot vector arK; the highest domain value corresponds to 1.

const xType * getArrayX ( enum Intp< xType, yType >::VTYPE  vType  )  const [virtual]

Virtual function returns the pointer of the identified object independent array.

Parameters:
vType variable index indentifying the independent array type
Returns:
a pointer to the object's identified array (varying units)
Remarks:
  • The data count of the object's array identified by vType is returned by a corresponding function call Intp::getCount().
  • The data contained in the object's array identified by vType can be copied to user-identified memory by a corresponding function call Intp::copyArrayX().
  • If the object is not initialized, a null pointer is returned.
  • If the object does not have the variable identified by vType, a null pointer is returned.
  • The units expressed in the values of the returned array vary depending on the the variable index vType.

Note:
  • The values in the knot vector array are scaled between 0 and 1. The lowest domain value of the interpolation object corresponds to a 0 scaled value of the knot vector; the highest domain value corresponds to 1.
  • The number of values in the knot vector array equals the data count of the interpolation object, plus the polynomial data count used in polynomial calculations.

const yType * getArrayY ( enum Intp< xType, yType >::VTYPE  vType  )  const [virtual]

Virtual function returns the pointer of the identified object dependent array.

Parameters:
vType variable index indentifying the dependent array type
Returns:
a pointer to the object's identified array (varying units)
Remarks:
  • The data count of the object's array identified by vType is returned by a corresponding function call Intp::getCount().
  • The data contained in the object's array identified by vType can be copied to user-identified memory by a corresponding function call Intp::copyArrayY().
  • If the object is not initialized, a null pointer is returned.
  • If the object does not have the variable identified by vType, a null pointer is returned.
  • The units expressed in the values of the returned array vary depending on the the variable index vType.

int getCount ( enum Intp< xType, yType >::VTYPE  vType  )  const [virtual]

Virtual function determines the number of values contained in the object's identified array.

Parameters:
vType variable index indentifying the type of data
Returns:
the data count of the object's array
Remarks:
  • The pointer of the object's array identified by vType is returned by a corresponding function call Intp::getArrayX() or Intp::getArrayY().
  • If the object is not initialized, -1 is returned.
  • If the object does not have the variable identified by vType, -1 is returned.

Note:
The number of values in the knot vector array equals the data count of the interpolation object, plus the polynomial data count used in polynomial calculations.

bool setCount ( int  nPoints  ) 

Function sets the number of data points used in polynomial interpolation evaluations.

Parameters:
nPoints the point count of interpolation polynomials
Returns:
status flag
  • false (successful execution)
  • true (execution error, parameter not set)
Remarks:
  • The polynomial point count value nPoints must be greater than zero and less than or equal to the data count value of the independent and dependent interpolation arrays.
  • The degree of polynomials used in interpolation evaluations is one less than the polynomial point count.

bool update ( void   )  [virtual]

Virtual function prepares the interpolation object for interpolation evaluations.

Returns:
status flag
  • false (successful execution)
  • true (execution error)
    • object initialization error
    • memory allocation error
    • some independent data points are equal or decreasing

Note:
Polygon control points are calculated such that the NURBS interpolation curve passes through the user-supplied data points.

Reimplemented from Intp.


Member Data Documentation

const int DEF_POINTS = 4 [static]

default interpolation polynomial data point count

Reimplemented from Intp.

const xType VAR_SMALL = 1.0E-20 [static]

small value replaces zero diagonal value in singular matrix for approximation


The documentation for this class was generated from the following files:
Generated on Wed Jul 19 09:24:18 2006 for CalcLib by  doxygen 1.4.7