dlr::numeric::BSpline2D< Type > Class Template Reference

Warning: This class is very new, and its test suite is still incomplete. More...

#include <bSpline2D.h>

Collaboration diagram for dlr::numeric::BSpline2D< Type >:
[legend]

List of all members.

Public Member Functions

 BSpline2D ()
 This constructor builds a BSpline2D instance of unspecified length and width.
 BSpline2D (const BSpline2D &other)
 The copy constructor does a deep copy.
template<class CoordIter , class ObsIter >
void approximateScatteredData (CoordIter sBegin, CoordIter sEnd, CoordIter tBegin, ObsIter observationsBegin, double buffer=1.0E-10)
 This function allows the spline parameters to be automatically set in order to approximate an irregularly sampled function.
void getMaximumSAndTValues (double &maximumS, double &maximumT)
 This member function returns the maximum value for the spline parameters S and T.
void getMinimumSAndTValues (double &minimumS, double &minimumT)
 This member function returns the minimum value for the spline parameters S and T.
void setControlPoints (const Array2D< Type > &controlPoints)
 This member function sets the values of the control points of the spline.
void setNumberOfNodes (size_t numberOfNodesS, size_t numberOfNodesT)
 This member function both specifies the number of nodes in the spline and sets the node positions so that the spline is "uniform".
BSpline2D< Type > & operator= (const BSpline2D< Type > &other)
 The assigment operator does a deep copy.
Type operator() (double sValue, double tValue)
 This operator evaluates the spline at the specified values of spline parameters S and T.

Protected Member Functions

void decomposeSamplePoint (double sValue, double tValue, size_t &iIndex, size_t &jIndex)
 This protected member function returns the integer part of sValue and tValue, while -- as a side effect -- setting member variables m_powersOfS and m_powersOfT so that the i^th (counting from zero) element of m_powersOfS is equal to the i^th power of the fractional part of sValue, and the i^th element of m_powersOfT is equal to the i^th power of the fractional part of tValue.

Protected Attributes

Array1D< Array1D< double > > m_basisArray
Array2D< Type > m_controlGrid
Vector2D m_minimumXY
Vector2D m_maximumXY
size_t m_numberOfNodesS
size_t m_numberOfNodesT
Array1D< double > m_powersOfS
Array1D< double > m_powersOfT
Vector2D m_xyCellOrigin
Vector2D m_xyCellSize


Detailed Description

template<class Type>
class dlr::numeric::BSpline2D< Type >

Warning: This class is very new, and its test suite is still incomplete.

It may contain bugs, and its interface may change.

This class template implements a bicubic 2D B-spline. Other orders (e.g., biquadratic) are currently not supported. This class is templated on control point type so that you can, for example, create a spline with 2D or 3D values by specifying control points of type Vector2D or Vector3D. Note that the splines represented by this class are all 2D in the sense that you can represent them using a parametric function of two parameters. If you want a spline that maps to a 1D parametric function (such as a curve in 2D or 3D space) you need to use the similar class, BSpline. BSpline2D currently only supports non-periodic splines, and currently only supports uniform node spacing. For now knot multiplicities are fixed at 1, meaning that folds and discontinuities are not supported.

Definition at line 48 of file bSpline2D.h.


Constructor & Destructor Documentation

template<class Type >
dlr::numeric::BSpline2D< Type >::BSpline2D (  )  [inline]

This constructor builds a BSpline2D instance of unspecified length and width.

Currently only bicubic splines are supported; we do not provide any way to construct splines of order different that 3.

Definition at line 273 of file bSpline2D.h.

References dlr::numeric::Array1D< Type >::copy(), dlr::numeric::Vector2D::setValue(), dlr::numeric::Vector2D::x(), and dlr::numeric::Vector2D::y().

template<class Type >
dlr::numeric::BSpline2D< Type >::BSpline2D ( const BSpline2D< Type > &  other  )  [inline]

The copy constructor does a deep copy.

Parameters:
other This argument is the BSpline2D instance to be copied.

Definition at line 346 of file bSpline2D.h.

References dlr::numeric::BSpline2D< Type >::m_basisArray, and dlr::numeric::Array1D< Type >::size().


Member Function Documentation

template<class Type >
template<class CoordIter , class ObsIter >
void dlr::numeric::BSpline2D< Type >::approximateScatteredData ( CoordIter  sBegin,
CoordIter  sEnd,
CoordIter  tBegin,
ObsIter  observationsBegin,
double  buffer = 1.0E-10 
) [inline]

This function allows the spline parameters to be automatically set in order to approximate an irregularly sampled function.

If you have some randomly distributed observations of a function value, and you want to approximate them with a spline, this the right member function to call. First you must create a spline, decide how many control points it should have along each axis (set this using member function setNumberOfNodes()), and then call approximateScatteredData().

Parameters:
sBegin This iterator specifies the beginning of a sequence of (possibly non-uniformly distributed) S coordinates of points at which observations of the to-be-approximated function were made.
sEnd This iterator specifies the end of the sequence of S coordinates.
tBegin This iterator specifies the beginning of a sequence of (possibly non-uniformly distributed) T coordinates corresponding to the S coordinate sequence described above. The sequence of T coordinates must have at least as many elements as the sequence of S coordinates.
observationsBegin This iterator specifies the beginning of a sequence of observations corresponding to the sequences of S and T coordinates described above. The spline control points will be set so that, for 0 <= N < (observedSPositionsEnd - observedSPositionsBegin), the value of the spline at (S, T) = (*(observedSPositionsBegin + N), *(observedTPositionsBegin + N)) approximates *(observationsBegin + N) as closely as possible.
buffer This argument specifies an amount by which the valid range for the approximated function will extend past the minimum and maximum coordinates of the observed positions. This is useful because sometimes it is necessary (although not terribly accurate) to extrapolate beyond the range of the input observations.

Definition at line 369 of file bSpline2D.h.

References dlr::numeric::BSpline2D< Type >::decomposeSamplePoint(), dlr::numeric::Vector2D::setValue(), dlr::numeric::Vector2D::x(), and dlr::numeric::Vector2D::y().

template<class Type >
void dlr::numeric::BSpline2D< Type >::decomposeSamplePoint ( double  sValue,
double  tValue,
size_t &  iIndex,
size_t &  jIndex 
) [inline, protected]

This protected member function returns the integer part of sValue and tValue, while -- as a side effect -- setting member variables m_powersOfS and m_powersOfT so that the i^th (counting from zero) element of m_powersOfS is equal to the i^th power of the fractional part of sValue, and the i^th element of m_powersOfT is equal to the i^th power of the fractional part of tValue.

Parameters:
sValue This argument is the value of spline parameter S to be decomposed.
tValue This argument is the value of spline parameter T to be decomposed.
iIndex This argument is used to return the integer part of sValue. For uniform spline (which *this always is), this is equivalent to the index of the span into which sValue falls.
jIndex This argument is used to return the integer part of tValue. For uniform spline (which *this always is), this is equivalent to the index of the span into which tValue falls.

Definition at line 571 of file bSpline2D.h.

References dlr::numeric::Vector2D::x(), and dlr::numeric::Vector2D::y().

Referenced by dlr::numeric::BSpline2D< Type >::approximateScatteredData(), and dlr::numeric::BSpline2D< Type >::operator()().

template<class Type >
void dlr::numeric::BSpline2D< Type >::getMaximumSAndTValues ( double &  maximumS,
double &  maximumT 
) [inline]

This member function returns the maximum value for the spline parameters S and T.

Calling operator()(double, double) with arguments greater than or equal to those reported by getMaximumSAndTValues() is an error.

Parameters:
maximumS This argument is used to return the maximum value of spline parameter S by reference.
maximumT This argument is used to return the maximum value of spline parameter T by reference.

Definition at line 459 of file bSpline2D.h.

References dlr::numeric::Vector2D::x(), and dlr::numeric::Vector2D::y().

template<class Type >
void dlr::numeric::BSpline2D< Type >::getMinimumSAndTValues ( double &  minimumS,
double &  minimumT 
) [inline]

This member function returns the minimum value for the spline parameters S and T.

Calling operator()(double, double) with arguments less than those reported by getMinimumSAndTValues() is an error.

Parameters:
minimumS This argument is used to return the minimum value of spline parameter S by reference.
minimumT This argument is used to return the minimum value of spline parameter T by reference.

Definition at line 471 of file bSpline2D.h.

References dlr::numeric::Vector2D::x(), and dlr::numeric::Vector2D::y().

template<class Type >
Type dlr::numeric::BSpline2D< Type >::operator() ( double  sValue,
double  tValue 
) [inline]

This operator evaluates the spline at the specified values of spline parameters S and T.

Returns:
The return value is the calculated spline value.

Definition at line 541 of file bSpline2D.h.

References dlr::numeric::BSpline2D< Type >::decomposeSamplePoint().

template<class Type >
BSpline2D< Type > & dlr::numeric::BSpline2D< Type >::operator= ( const BSpline2D< Type > &  other  )  [inline]

template<class Type >
void dlr::numeric::BSpline2D< Type >::setControlPoints ( const Array2D< Type > &  controlPoints  )  [inline]

This member function sets the values of the control points of the spline.

If the spline is periodic, then the value of the final control point should be omitted; it will be automatically copied from the value of the first control point.

Parameters:
controlPoints This argument specifies the control point values for the spline. It must have shape (numberOfNodesS, numberOfNodesT), where numberOfNodesS and numberOfNodesT are the same values passed to member function setNumberOfNodes.

Definition at line 483 of file bSpline2D.h.

References dlr::numeric::Array2D< Type >::columns(), dlr::numeric::Array2D< Type >::copy(), dlr::numeric::Array2D< Type >::rows(), and dlr::numeric::Vector2D::setValue().

template<class Type >
void dlr::numeric::BSpline2D< Type >::setNumberOfNodes ( size_t  numberOfNodesS,
size_t  numberOfNodesT 
) [inline]

This member function both specifies the number of nodes in the spline and sets the node positions so that the spline is "uniform".

The node positions will be set so that the first node lies at spline parameter (s, t) = (0.0, 0.0) and subsequent nodes lie at (0.0, 1.0), (0.0, 2.0), (1.0, 0.0), etc. Note that the actual number of nodes in the spline is equal to numberOfNodesS * numberOfNodesT, because the nodes form a 2D array.

Parameters:
numberOfNodesS This argument specifies how many nodes the spline should have along the S axis.
numberOfNodesT This argument specifies how many nodes the spline should have along the T axis.

Definition at line 506 of file bSpline2D.h.


The documentation for this class was generated from the following file:

Generated on Wed Nov 25 00:42:48 2009 for dlrUtilities Utility Library by  doxygen 1.5.8