17 #include "../../include/ecl/geometry/tension_spline.hpp" 24 namespace blueprints {
51 unsigned int n = x_data.size()-1;
52 yddot_data.resize(n+1);
62 Array<double> h(n), a(n), beta(n), gamma(n), u(n), v(n);
63 h[0] = x_set[1] - x_set[0];
64 for (
unsigned int i = 0; i < n; ++i ) {
65 h[i] = x_set[i+1]-x_set[i];
66 a[i] = 1/h[i] - tension/sinh(tension*h[i]);
67 beta[i] = tension*(cosh(tension*h[i])/sinh(tension*h[i])) - 1/h[i];
68 gamma[i] = tension*tension*(y_data[i+1]-y_data[i])/h[i];
82 u[1] = beta[1] + beta[0];
83 v[1] = gamma[1]-gamma[0];
84 for (
unsigned int i = 2; i < n; ++i ) {
85 u[i] = beta[i] + beta[i-1] - a[i-1]*a[i-1]/u[i-1];
86 v[i] = gamma[i]-gamma[i-1] - a[i-1]*v[i-1]/u[i-1];
92 for (
unsigned int i = n-1; i > 0; --i ) {
93 yddot_data[i] = (v[i] - a[i]*yddot_data[i+1])/u[i];
109 for (
unsigned int i = 0; i < spline.
functions.size(); ++i ) {
ecl::Array< double > x_data
Embedded control libraries.
Storage container for a tension spline interpolation.
Array< double > discretised_domain
Blueprint for generating a tension spline satisfying C2 constraints.
C2TensionSpline()
Default constructor.
void apply(base_type &spline) const
Apply the blueprint to configure an existing object.
static blueprints::TensionSecondDerivativeInterpolation Interpolation(const double x_i, const double y_i, const double yddot_i, const double x_f, const double y_f, const double yddot_f)
Blueprint for interpolating a tension function between two end points using second derivatives...
C2TensionSpline(const ecl::Array< double > &x_set, const ecl::Array< double > &y_set, const double &tau) ecl_assert_throw_decl(ecl base_type instantiate()
Constructor that properly configures/initialises the blueprint.
ecl::Array< double > yddot_data
#define ecl_assert_throw(expression, exception)
ecl::Array< double > y_data
#define ecl_assert_throw_decl(exception)
Array< TensionFunction > functions