1#ifndef SimTK_SIMMATH_SPLINE_H_
2#define SimTK_SIMMATH_SPLINE_H_
66 : impl(std::make_shared<
SplineImpl>(degree, x, y)) {}
90 return impl->getValue(x);
106 return impl->getDerivative(order, x);
131 assert(x.
size() == 1);
142 { assert(x.
size() == 1);
148 { assert(x.
size() == 1);
155 {
return std::numeric_limits<int>::max(); }
161 std::shared_ptr<SplineImpl> impl;
172 : degree(degree), x(x), y(y) {}
Includes internal headers providing declarations for the basic SimTK Core classes,...
This is the header file that every Simmath compilation unit should include first.
The Array_<T> container class is a plug-compatible replacement for the C++ standard template library ...
Definition Array.h:1520
size_type size() const
Return the current number of elements stored in this array.
Definition Array.h:2075
This abstract class represents a mathematical function that calculates a value of arbitrary type base...
Definition Function.h:51
static Real splder(int derivOrder, int degree, Real t, const Vector &x, const Vector &coeff)
This is the implementation class that supports the Spline_ interface.
Definition Spline.h:169
Vector x
Definition Spline.h:182
SplineImpl(int degree, const Vector &x, const Vector_< T > &y)
Definition Spline.h:171
T getDerivative(int derivOrder, Real t) const
Definition Spline.h:177
int degree
Definition Spline.h:181
Vector_< T > y
Definition Spline.h:183
T getValue(Real t) const
Definition Spline.h:174
This class implements a non-uniform Bezier curve.
Definition Spline.h:53
int getArgumentSize() const override
Required by the Function_ interface.
Definition Spline.h:152
int getSplineDegree() const
Get the degree of the spline.
Definition Spline.h:123
~Spline_()=default
Destructor decrements the reference count and frees the heap space if this is the last reference.
T calcValue(const Vector &x) const override
Alternate signature provided to implement the generic Function_ interface expects a one-element Vecto...
Definition Spline.h:130
const Vector_< T > & getControlPointValues() const
Get the values of the dependent variables at each of the Bezier control points.
Definition Spline.h:117
int getMaxDerivativeOrder() const override
Required by the Function_ interface.
Definition Spline.h:154
Spline_(const Spline_ &source)=default
Copy constructor is shallow and reference-counted; that is, the new Spline_ refers to the same object...
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 ...
Definition Spline.h:65
T calcDerivative(const std::vector< int > &derivComponents, const Vector &x) const
For the Function_ style interface, this provides compatibility with std::vector.
Definition Spline.h:146
Spline_ * clone() const override
Required by the Function_ interface.
Definition Spline.h:157
T calcValue(Real x) const
Calculate the values of the dependent variables at a particular value of the independent variable.
Definition Spline.h:88
T calcDerivative(const Array_< int > &derivComponents, const Vector &x) const override
Alternate signature provided to implement the generic Function_ interface expects an awkward derivCom...
Definition Spline.h:140
Spline_()=default
Default constructor creates an empty Spline_ handle; not very useful.
T calcDerivative(int order, Real x) const
Calculate a derivative of the spline function with respect to its independent variable,...
Definition Spline.h:103
Spline_ & operator=(const Spline_ &source)=default
Copy assignment is shallow and reference-counted; that is, after the assignment this Spline_ refers t...
const Vector & getControlPointLocations() const
Get the locations (that is, the values of the independent variable) for each of the Bezier control po...
Definition Spline.h:111
int size() const
Definition VectorBase.h:401
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition Assembler.h:37
Spline_< Real > Spline
Provide a convenient name for a scalar-valued Spline_.
Definition Spline.h:165
SimTK_Real Real
This is the default compiled-in floating point type for SimTK, either float or double.
Definition SimTKcommon/include/SimTKcommon/internal/common.h:626