18 #include "../../include/ecl/geometry/smooth_linear_spline.hpp"
32 if ( x_data.size() != y_data.size() ) {
33 throw DataException<int>(LOC,
OutOfRangeError,
"Input domain and range sets were not the same size.", 0);
41 unsigned int n = x_data.size()-1;
53 for (
unsigned int i = 0; i < n; ++i ) {
54 segments[i] = LinearFunction::Interpolation(x_data[i],y_data[i],x_data[i+1],y_data[i+1]);
62 for (
unsigned int i = 1; i < n; ++i ) {
65 corners[i-1].coefficients() <<
segments[i-1].coefficients()[0],
segments[i-1].coefficients()[1], 0.0, 0.0, 0.0, 0.0;
69 for (
unsigned int j = 1; j <= 5; ++j ) {
72 x_l = x_data[i] - j*(x_data[i]-x_data[i-1])/5;
74 x_l = x_data[i] - j*(x_data[i]-x_data[i-1])/10;
77 x_r = x_data[i] + j*(x_data[i+1]-x_data[i])/5;
79 x_r = x_data[i] + j*(x_data[i+1]-x_data[i])/10;
83 double ydot_l =
segments[i-1].derivative(x_l);
84 double ydot_r =
segments[i].derivative(x_r);
85 corners[i-1] = QuinticPolynomial::Interpolation(x_l,y_l,ydot_l,0.0,
105 throw DataException<int>(LOC,
ConstructorError,
"Max acceleration bound could not be satisfied at corner specified by the data element.",i);
118 if ( index % 2 == 0 ) {
121 return corners[(index-1)/2](x);
131 if ( index % 2 == 0 ) {
132 return segments[index/2].derivative(x);
144 if ( index % 2 == 0 ) {
145 return segments[index/2].dderivative(x);