Simbody  3.6
SimTK::Spline_< T > Class Template Reference

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

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

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. More...
 
 Spline_ ()
 Default constructor creates an empty Spline_ handle; not very useful. More...
 
 Spline_ (const Spline_ &source)
 Copy constructor is shallow and reference-counted; that is, the new Spline_ refers to the same object as does source. More...
 
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. More...
 
 ~Spline_ ()
 Destructor decrements the reference count and frees the heap space if this is the last reference. More...
 
calcValue (Real x) const
 Calculate the values of the dependent variables at a particular value of the independent variable. More...
 
calcDerivative (int order, Real x) const
 Calculate a derivative of the spline function with respect to its independent variable, at the given value. More...
 
const VectorgetControlPointLocations () const
 Get the locations (that is, the values of the independent variable) for each of the Bezier control points. More...
 
const Vector_< T > & getControlPointValues () const
 Get the values of the dependent variables at each of the Bezier control points. More...
 
int getSplineDegree () const
 Get the degree of the spline. More...
 
calcValue (const Vector &x) const override
 Alternate signature provided to implement the generic Function_ interface expects a one-element Vector for the independent variable. More...
 
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. More...
 
calcDerivative (const std::vector< int > &derivComponents, const Vector &x) const
 For the Function_ style interface, this provides compatibility with std::vector. More...
 
int getArgumentSize () const override
 Required by the Function_ interface. More...
 
int getMaxDerivativeOrder () const override
 Required by the Function_ interface. More...
 
Spline_clone () const override
 Required by the Function_ interface. More...
 
- Public Member Functions inherited from SimTK::Function_< T >
virtual ~Function_ ()
 
calcDerivative (const std::vector< int > &derivComponents, const Vector &x) const
 This provides compatibility with std::vector without requiring any copying. More...
 

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

◆ Spline_() [1/3]

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.

◆ Spline_() [2/3]

template<class T>
SimTK::Spline_< T >::Spline_ ( )
inline

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

◆ Spline_() [3/3]

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.

◆ ~Spline_()

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

◆ operator=()

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.

◆ calcValue() [1/2]

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.

◆ calcDerivative() [1/3]

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.

◆ getControlPointLocations()

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.

◆ getControlPointValues()

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.

◆ getSplineDegree()

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

Get the degree of the spline.

◆ calcValue() [2/2]

template<class T>
T SimTK::Spline_< T >::calcValue ( const Vector x) const
inlineoverridevirtual

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

Implements SimTK::Function_< T >.

◆ calcDerivative() [2/3]

template<class T>
T SimTK::Spline_< T >::calcDerivative ( const Array_< int > &  derivComponents,
const Vector x 
) const
inlineoverridevirtual

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 >.

◆ calcDerivative() [3/3]

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.

◆ getArgumentSize()

template<class T>
int SimTK::Spline_< T >::getArgumentSize ( ) const
inlineoverridevirtual

Required by the Function_ interface.

Implements SimTK::Function_< T >.

◆ getMaxDerivativeOrder()

template<class T>
int SimTK::Spline_< T >::getMaxDerivativeOrder ( ) const
inlineoverridevirtual

Required by the Function_ interface.

Implements SimTK::Function_< T >.

◆ clone()

template<class T>
Spline_* SimTK::Spline_< T >::clone ( ) const
inlineoverridevirtual

Required by the Function_ interface.

Reimplemented from SimTK::Function_< T >.


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