Simbody  3.4 (development)
SimTK::Spline_< T > Class Template Reference

This class implements a non-uniform Bezier curve. More...

#include <Spline.h>

+ Inheritance diagram for SimTK::Spline_< T >:

List of all members.

Classes

class  SplineImpl
 This is the implementation class that supports the Spline_ interface. More...

Public Member Functions

 Spline_ (int degree, const Vector &x, const Vector_< T > &y)
 Create a Spline_ object based on a set of control points. See SplineFitter for a nicer way to create these objects.
 Spline_ ()
 Default constructor creates an empty Spline_ handle; not very useful.
 Spline_ (const Spline_ &source)
 Copy constructor is shallow and reference-counted; that is, the new Spline_ refers to the same object as does source.
Spline_operator= (const Spline_ &source)
 Copy assignment is shallow and reference-counted; that is, after the assignment this Spline_ refers to the same object as does source.
 ~Spline_ ()
 Destructor decrements the reference count and frees the heap space if this is the last reference.
calcValue (Real x) const
 Calculate the values of the dependent variables at a particular value of the independent variable.
calcDerivative (int order, Real x) const
 Calculate a derivative of the spline function with respect to its independent variable, at the given value.
const VectorgetControlPointLocations () const
 Get the locations (that is, the values of the independent variable) for each of the Bezier control points.
const Vector_< T > & getControlPointValues () const
 Get the values of the dependent variables at each of the Bezier control points.
int getSplineDegree () const
 Get the degree of the spline.
calcValue (const Vector &x) const override
 Alternate signature provided to implement the generic Function_ interface expects a one-element Vector for the independent variable.
calcDerivative (const Array_< int > &derivComponents, const Vector &x) const override
 Alternate signature provided to implement the generic Function_ interface expects an awkward derivComponents argument, and takes a one-element Vector for the independent variable.
calcDerivative (const std::vector< int > &derivComponents, const Vector &x) const
 For the Function_ style interface, this provides compatibility with std::vector.
int getArgumentSize () const override
 Required by the Function_ interface.
int getMaxDerivativeOrder () const override
 Required by the Function_ interface.

Detailed Description

template<class T>
class SimTK::Spline_< T >

This class implements a non-uniform Bezier curve.

It requires the spline degree to be odd (linear, cubic, quintic, etc.), but supports arbitrarily high degrees. Only spline curves are supported, not surfaces or higher dimensional objects, but the curve may be defined in an arbitrary dimensional space. That is, a Spline_ is a Function_ that calculates an arbitrary number of output values based on a single input value. The template argument must be either Real or Vec<N> from some integer N. The name "Spline" (with no trailing "_") may be used as a synonym for Spline_<Real>.

Most users should generate Spline_ objects using SplineFitter which can be used to generate spline curves through data points rather than requiring Bezier control points.

See also:
SplineFitter for best-fitting a spline through sampled data.
BicubicSurface for fitting a smooth surface to 2D sample data.

Constructor & Destructor Documentation

template<class T>
SimTK::Spline_< T >::Spline_ ( int  degree,
const Vector x,
const Vector_< T > &  y 
) [inline]

Create a Spline_ object based on a set of control points. See SplineFitter for a nicer way to create these objects.

Parameters:
[in]degreeThe degree of the spline to create. This must be a positive odd value.
[in]xValues of the independent variable for each Bezier control point.
[in]yValues of the dependent variables for each Bezier control point.
template<class T>
SimTK::Spline_< T >::Spline_ ( ) [inline]

Default constructor creates an empty Spline_ handle; not very useful.

template<class T>
SimTK::Spline_< T >::Spline_ ( const Spline_< T > &  source) [inline]

Copy constructor is shallow and reference-counted; that is, the new Spline_ refers to the same object as does source.

template<class T>
SimTK::Spline_< T >::~Spline_ ( ) [inline]

Destructor decrements the reference count and frees the heap space if this is the last reference.


Member Function Documentation

template<class T>
Spline_& SimTK::Spline_< T >::operator= ( const Spline_< T > &  source) [inline]

Copy assignment is shallow and reference-counted; that is, after the assignment this Spline_ refers to the same object as does source.

template<class T>
T SimTK::Spline_< T >::calcValue ( Real  x) const [inline]

Calculate the values of the dependent variables at a particular value of the independent variable.

Parameters:
[in]xThe value of the independent variable.
Returns:
The corresponding values of the dependent variables.
template<class T>
T SimTK::Spline_< T >::calcDerivative ( int  order,
Real  x 
) const [inline]

Calculate a derivative of the spline function with respect to its independent variable, at the given value.

Parameters:
[in]orderWhich derivative? order==1 returns first derivative, order==2 is second, etc. Must be >= 1.
[in]xThe value of the independent variable about which the derivative is taken.
Returns:
The order'th derivative of the dependent variables at x.
template<class T>
const Vector& SimTK::Spline_< T >::getControlPointLocations ( ) const [inline]

Get the locations (that is, the values of the independent variable) for each of the Bezier control points.

template<class T>
const Vector_<T>& SimTK::Spline_< T >::getControlPointValues ( ) const [inline]

Get the values of the dependent variables at each of the Bezier control points.

template<class T>
int SimTK::Spline_< T >::getSplineDegree ( ) const [inline]

Get the degree of the spline.

template<class T>
T SimTK::Spline_< T >::calcValue ( const Vector x) const [inline, override, virtual]

Alternate signature provided to implement the generic Function_ interface expects a one-element Vector for the independent variable.

Implements SimTK::Function_< T >.

template<class T>
T SimTK::Spline_< T >::calcDerivative ( const Array_< int > &  derivComponents,
const Vector x 
) const [inline, override, virtual]

Alternate signature provided to implement the generic Function_ interface expects an awkward derivComponents argument, and takes a one-element Vector for the independent variable.

Because Spline_ only allows a single independent variable, all elements of derivComponents should be 0; only its length determines the order of the derivative to calculate.

Implements SimTK::Function_< T >.

template<class T>
T SimTK::Spline_< T >::calcDerivative ( const std::vector< int > &  derivComponents,
const Vector x 
) const [inline]

For the Function_ style interface, this provides compatibility with std::vector.

No copying or heap allocation is required.

Reimplemented from SimTK::Function_< T >.

template<class T>
int SimTK::Spline_< T >::getArgumentSize ( ) const [inline, override, virtual]

Required by the Function_ interface.

Implements SimTK::Function_< T >.

template<class T>
int SimTK::Spline_< T >::getMaxDerivativeOrder ( ) const [inline, override, virtual]

Required by the Function_ interface.

Implements SimTK::Function_< T >.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines