tension_function.cpp
Go to the documentation of this file.
00001 
00009 /*****************************************************************************
00010 ** Includes
00011 *****************************************************************************/
00012 
00013 #include <cmath>
00014 #include "../../include/ecl/geometry/tension_function.hpp"
00015 
00016 /*****************************************************************************
00017 ** Namespaces
00018 *****************************************************************************/
00019 
00020 namespace ecl {
00021 
00022 /*****************************************************************************
00023 ** Implementation [TensionFunction]
00024 *****************************************************************************/
00025 
00026 double TensionFunction::derivative(const double &tau, const double &x) const {
00027     double value;
00028     double h = x_f-x_0;
00029     value = (-1.0*tau*z_0*cosh(tau*(x_f-x)) + tau*z_f*cosh(tau*(x-x_0)))/(tau*tau*sinh(tau*h));
00030     value += -1.0*(y_0-z_0/(tau*tau))/h;
00031     value += (y_f-z_f/(tau*tau))/h;
00032 
00033     return value;
00034 }
00035 
00036 
00037 double TensionFunction::dderivative(const double &tau, const double &x) const {
00038     double value;
00039     double h = x_f-x_0;
00040     value = (tau*tau*z_0*sinh(tau*(x_f-x)) + tau*tau*z_f*sinh(tau*(x-x_0)))/(tau*tau*sinh(tau*h));
00041 
00042     return value;
00043 }
00044 
00045 double TensionFunction::operator ()(const double &tau, const double &x) const {
00046     double value;
00047     double h = x_f-x_0;
00048     value = (z_0*sinh(tau*(x_f-x)) + z_f*sinh(tau*(x-x_0)))/(tau*tau*sinh(tau*h));
00049     value += (y_0-z_0/(tau*tau))*(x_f-x)/h;
00050     value += (y_f-z_f/(tau*tau))*(x-x_0)/h;
00051     return value;
00052 }
00053 
00054 namespace blueprints {
00055 
00056 using ecl::TensionFunction;
00057 
00058 /*****************************************************************************
00059 ** Implementation [TensionSecondDerivativeInterpolation]
00060 *****************************************************************************/
00061 
00062 ecl::TensionFunction TensionSecondDerivativeInterpolation::instantiate() {
00063     TensionFunction function;
00064     apply(function);
00065     return function;
00066 }
00067 
00068 void TensionSecondDerivativeInterpolation::apply(base_type &function) const {
00069 
00070     // Dont have to do much here, just copy across the parameters
00071     function.z_0 = yddot_initial;
00072     function.z_f = yddot_final;
00073     function.x_0 = x_initial;
00074     function.x_f = x_final;
00075     function.y_0 = y_initial;
00076     function.y_f = y_final;
00077 }
00078 
00079 }; // namespace blueprints
00080 
00081 using blueprints::TensionSecondDerivativeInterpolation;
00082 
00083 /*****************************************************************************
00084 ** BluePrintFactory[TensionFunction]
00085 *****************************************************************************/
00086 
00087 TensionSecondDerivativeInterpolation BluePrintFactory< TensionFunction >::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) {
00088     return TensionSecondDerivativeInterpolation(x_i, y_i, yddot_i, x_f, y_f, yddot_f);
00089 }
00090 
00091 } // namespace ecl


ecl_geometry
Author(s): Daniel Stonier (d.stonier@gmail.com)
autogenerated on Thu Jan 2 2014 11:13:11