Storage container for a smoothed linear spline interpolation. More...
#include <smooth_linear_spline.hpp>
Public Member Functions | |
double | dderivative (const double &x) const ecl_assert_throw_decl(StandardException) |
Spline second derivative. | |
double | derivative (const double &x) const ecl_assert_throw_decl(StandardException) |
Spline derivative. | |
const Array< double > & | domain () const |
The discretised domain for this spline. | |
double | operator() (const double &x) const ecl_assert_throw_decl(StandardException) |
Spline function. | |
SmoothLinearSpline () | |
Default constructor. | |
SmoothLinearSpline (const Array< double > &x_data, const Array< double > &y_data, double a_max) throw (DataException<int>) | |
Constructor that properly configures the ramped spline. | |
virtual | ~SmoothLinearSpline () |
Static Public Member Functions | |
static SmoothLinearSpline | Interpolation (const Array< double > &x_data, const Array< double > &y_data, double a_max) throw (DataException<int>) |
Static construction that interpolates on a set of waypoints. | |
Private Attributes | |
Array< QuinticPolynomial > | corners |
Array< double > | discretised_domain |
Array< LinearFunction > | segments |
Friends | |
template<typename OutputStream > | |
OutputStream & | operator<< (OutputStream &ostream, const SmoothLinearSpline &smooth_linear_spline) |
Streaming output insertion operator for smoothed linear splines. |
Storage container for a smoothed linear spline interpolation.
These interpolations connect waypoints linearly and add a smoothed corner (using a quintic polynomial) to connect each linear segment. The shape of the corners is parameterised with a maximum curvature parameter (acceleration).
Definition at line 44 of file smooth_linear_spline.hpp.
ecl::SmoothLinearSpline::SmoothLinearSpline | ( | ) | [inline] |
Default constructor.
Don't really need this, but things like vectors and array containers need it so they can reserve the appropriate storage.
Definition at line 52 of file smooth_linear_spline.hpp.
ecl::SmoothLinearSpline::SmoothLinearSpline | ( | const Array< double > & | x_data, |
const Array< double > & | y_data, | ||
double | a_max | ||
) | throw (DataException<int>) |
Constructor that properly configures the ramped spline.
The constructor uses the input data sets to initialise the segmentation. Corners are constrained by the maximum curvature (acceleration) - if construction should fail (not enough space between the waypoints) then this method will throw an exception indicating failure. It is accompanied with an int type data element that indicates the number of the segment that failed to construct. Failure typically occurs because the maximum curvature constraint at the corner was broken. Try increasing the maximum curvature constraint or increasing the time duration of the specified segment to ensure success a second time around.
a_max | : the maximum bound (absolute) on the acceleration. |
x_data | : set of data on the domain axis. |
y_data | : set of values on the range axis. |
: | DataException : throws if the spline could not be constructed because of broken a_max constraint. |
The int data for the exception represents the element in the set which could not make a corner without breaking the acceleration constraint. Note that if you have a data set of size 5 (i.e. elements 0-4), then it will only throw between 1 and 3, as this is where smoothed corners are built.
Definition at line 30 of file smooth_linear_spline.cpp.
virtual ecl::SmoothLinearSpline::~SmoothLinearSpline | ( | ) | [inline, virtual] |
Definition at line 78 of file smooth_linear_spline.hpp.
double ecl::SmoothLinearSpline::dderivative | ( | const double & | x | ) | const |
Spline second derivative.
Extract the second derivative of the spline.
x | : the domain value. |
: | StandardException : throws if x is outside the spline range [debug mode only]. |
Definition at line 138 of file smooth_linear_spline.cpp.
double ecl::SmoothLinearSpline::derivative | ( | const double & | x | ) | const |
Spline derivative.
Extract the derivative of the spline at the indicated value.
x | : the domain value. |
: | StandardException : throws if x is outside the spline range [debug mode only]. |
Definition at line 125 of file smooth_linear_spline.cpp.
const Array<double>& ecl::SmoothLinearSpline::domain | ( | ) | const [inline] |
The discretised domain for this spline.
This returns the array of discretised time values that define the domains of each polynomial within the spline.
Definition at line 119 of file smooth_linear_spline.hpp.
static SmoothLinearSpline ecl::SmoothLinearSpline::Interpolation | ( | const Array< double > & | x_data, |
const Array< double > & | y_data, | ||
double | a_max | ||
) | throw (DataException<int>) [inline, static] |
Static construction that interpolates on a set of waypoints.
Static construction that interpolates on a set of waypoints.
x_data | : set of data on the domain axis. |
y_data | : set of values on the range axis. |
a_max | : the maximum bound (absolute) on the acceleration. |
: | DataException : throws if the spline could not be constructed, data is the segment # that failed. |
Definition at line 135 of file smooth_linear_spline.hpp.
double ecl::SmoothLinearSpline::operator() | ( | const double & | x | ) | const |
Spline function.
Extract the spline function's value at the indicated location.
x | : the domain value. |
: | StandardException : throws if x is outside the spline range [debug mode only]. |
Definition at line 112 of file smooth_linear_spline.cpp.
OutputStream& operator<< | ( | OutputStream & | ostream, |
const SmoothLinearSpline & | smooth_linear_spline | ||
) | [friend] |
Streaming output insertion operator for smoothed linear splines.
Streaming output insertion operator for smoothed linear splines. This simply lists the spline segments and corners (linear functions and quintic polynomials) in algebraic form.
OutputStream | : the type of stream being used. |
ostream | : the output stream being used. |
smooth_linear_spline | : the tension spline. |
Definition at line 175 of file smooth_linear_spline.hpp.
Definition at line 167 of file smooth_linear_spline.hpp.
Array<double> ecl::SmoothLinearSpline::discretised_domain [private] |
Definition at line 165 of file smooth_linear_spline.hpp.
Array<LinearFunction> ecl::SmoothLinearSpline::segments [private] |
Definition at line 166 of file smooth_linear_spline.hpp.