18 #include "../../include/ecl/geometry/cubic_spline.hpp"
25 namespace blueprints {
43 const double ydot_0,
const double ydot_f) :
47 if (x_data.size() < 2 || y_data.size() < 2)
52 unsigned int n = x_data.size();
58 u[0] = (3.0/(x_data[1]-x_data[0])) * ((y_data[1]-y_data[0])/(x_data[1]-x_data[0])-ydot_0);
60 for (
unsigned int i = 1; i <= n-2; ++i){
61 double sig = (x_data[i]-x_data[i-1]) / (x_data[i+1]-x_data[i-1]);
62 double p = sig*yddot_data[i-1]+2.0;
63 yddot_data[i] = (sig-1.0)/p;
64 u[i] = (y_data[i+1]-y_data[i])/(x_data[i+1]-x_data[i]) -
65 (y_data[i]-y_data[i-1])/(x_data[i]-x_data[i-1]);
66 u[i] = (6.0*u[i]/(x_data[i+1]-x_data[i-1]) - sig*u[i-1])/p;
70 u[n-1] = (3.0/(x_data[n-1]-x_data[n-2])) * (ydot_f - (y_data[n-1]-y_data[n-2])/(x_data[n-1]-x_data[n-2]));
73 yddot_data[n-1] = ( u[n-1] - qn*u[n-2]) / ( qn*yddot_data[n-2] + 1.0 );
74 for (
int k = n-2; k >= 0; --k ) {
75 yddot_data[k] = yddot_data[k]*yddot_data[k+1] + u[k];
100 for (
unsigned int i = 1; i <= n-2; ++i){
106 u[i] = (6.0*u[i]/(
x_data[i+1]-
x_data[i-1]) - sig*u[i-1])/p;
114 for (
int k = n-2; k >= 0; --k ) {
142 const double ydot_0,
const double ydot_f) :
151 ydot_data[0] = ydot_0;
152 for (
unsigned int i = 1; i < (
x_data.
size()-1); ++i ) {
153 double ydot_before, ydot_after;
156 ydot_data[i] = (ydot_before + ydot_after)/2;
184 using blueprints::C2CubicSpline;
185 using blueprints::DerivativeHeuristicCubicSpline;
188 return C2CubicSpline(x_set, y_set);