This class implements a non-uniform B-spline curve. More...
#include <Spline.h>
Classes | |
class | SplineImpl |
Public Member Functions | |
Spline_ (int degree, const Vector &x, const Vector_< T > &y) | |
Create a Spline_ object based on a set of control points. | |
Spline_ (const Spline_ ©) | |
Spline_ () | |
Spline_ & | operator= (const Spline_ ©) |
~Spline_ () | |
T | calcValue (const Vector &x) const |
Calculate the values of the dependent variables at a particular value of the independent variable. | |
T | calcDerivative (const Array_< int > &derivComponents, const Vector &x) const |
Calculate a derivative of the spline function. | |
int | getArgumentSize () const |
Get the number of components expected in the input vector. | |
int | getMaxDerivativeOrder () const |
Get the maximum derivative order this Function_ object can calculate. | |
const Vector & | getControlPointLocations () const |
Get the locations (that is, the values of the independent variable) of the control points. | |
const Vector_< T > & | getControlPointValues () const |
Get the values of the dependent variables at the control points. | |
int | getSplineDegree () const |
Get the degree of the spline. | |
T | calcDerivative (const std::vector< int > &derivComponents, const Vector &x) const |
This provides compatibility with std::vector without requiring any copying. |
This class implements a non-uniform B-spline 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>.
Create a Spline_ object based on a set of control points.
degree | the degree of the spline to create. This must be a positive odd value. | |
x | the values of the independent variable for each control point | |
y | the values of the dependent variables for each control point |
References SplineImpl::referenceCount.
Spline_ | ( | ) | [inline] |
~Spline_ | ( | ) | [inline] |
References SplineImpl::referenceCount.
T calcDerivative | ( | const std::vector< int > & | derivComponents, | |
const Vector & | x | |||
) | const [inline] |
This provides compatibility with std::vector without requiring any copying.
Reimplemented from Function_< T >.
References Spline_< T >::calcDerivative().
Referenced by Spline_< T >::calcDerivative().
T calcDerivative | ( | const Array_< int > & | derivComponents, | |
const Vector & | x | |||
) | const [inline, virtual] |
Calculate a derivative of the spline function.
See the Function_ class for details. Because Spline_ only allows a single independent variable, all elements of derivComponents should be 0, and its length determines the order of the derivative to calculate.
Implements Function_< T >.
References SplineImpl::getDerivative(), VectorBase< ELT >::size(), and Array_< T, X >::size().
T calcValue | ( | const Vector & | x | ) | const [inline, virtual] |
Calculate the values of the dependent variables at a particular value of the independent variable.
x | a Vector of length 1 containing the value of the independent variable. |
Implements Function_< T >.
References SplineImpl::getValue(), and VectorBase< ELT >::size().
int getArgumentSize | ( | ) | const [inline, virtual] |
Get the number of components expected in the input vector.
Implements Function_< T >.
const Vector& getControlPointLocations | ( | ) | const [inline] |
Get the locations (that is, the values of the independent variable) of the control points.
References SplineImpl::x.
const Vector_<T>& getControlPointValues | ( | ) | const [inline] |
Get the values of the dependent variables at the control points.
References SplineImpl::y.
int getMaxDerivativeOrder | ( | ) | const [inline, virtual] |
Get the maximum derivative order this Function_ object can calculate.
Implements Function_< T >.
References SimTK::max().
int getSplineDegree | ( | ) | const [inline] |
Get the degree of the spline.
References SplineImpl::degree.
References SplineImpl::referenceCount.