#include <BALL/MATHS/cubicSpline1D.h>
Static Public Attributes | |
static const int | VERBOSITY_LEVEL_DEBUG |
static const int | VERBOSITY_LEVEL_CRITICAL |
Constructors and Destructors. | |
| |
std::vector< float > | sample_positions_ |
std::vector< float > | sample_values_ |
std::vector< float > | curvature_ |
bool | return_average_ |
float | default_value_ |
float | lower_bound_ |
float | upper_bound_ |
bool | is_natural_ |
float | lower_derivative_ |
float | upper_derivative_ |
int | verbosity_ |
CubicSpline1D () throw () | |
CubicSpline1D (const std::vector< float > &sample_positions, const std::vector< float > &sample_values, bool return_average=false, bool is_natural=true, float lower_derivative=0.0, float upper_derivative=0.0, int verbosity=VERBOSITY_LEVEL_DEBUG) throw () | |
CubicSpline1D (const std::vector< float > &sample_positions, const std::vector< float > &sample_values, float default_value, bool is_natural=true, float lower_derivative=0.0, float upper_derivative=0.0, int verbosity=VERBOSITY_LEVEL_DEBUG) throw () | |
CubicSpline1D (const std::vector< float > &sample_positions, const std::vector< float > &sample_values, float default_value, float lower_bound, float upper_bound, bool is_natural=true, float lower_derivative=0.0, float upper_derivative=0.0, int verbosity=VERBOSITY_LEVEL_DEBUG) throw () | |
CubicSpline1D (const std::vector< float > &sample_positions, const std::vector< float > &sample_values, float lower_bound, float upper_bound, bool return_average=false, float default_value=std::numeric_limits< float >::min(), bool is_natural=true, float lower_derivative=0.0, float upper_derivative=0.0, int verbosity=VERBOSITY_LEVEL_DEBUG) throw () | |
CubicSpline1D (const CubicSpline1D &cs1D) throw () | |
virtual | ~CubicSpline1D () throw () |
void | setVerbosity (int verbosity) |
int | getVerbosity () const |
float | operator() (float x) throw () |
std::vector< float > | getCurvature () const throw () |
void | setCurvature (std::vector< float > curvature) throw () |
void | setValues (std::vector< float > values, bool recompute=true) throw () |
std::vector< float > | getValues () const throw () |
std::vector< float > | getPositions () const throw () |
void | setPositions (std::vector< float > positions, bool recompute=true) throw () |
void | setDefaultValue (float value) throw () |
float | getDefaultValue () const throw () |
void | setLowerBound (float lb) throw () |
void | setUpperBound (float ub) throw () |
float | getLowerBound () const throw () |
float | getUpperBound () const throw () |
bool | isNatural () const throw () |
void | makeNatural (bool recompute=true) throw () |
void | setBoudaryDerivatives (float lower_derivative, float upper_derivative, bool recompute=true) throw () |
void | setLowerDerivative (float derivative, bool recompute=true) throw () |
float | getLowerDerivative () const throw () |
void | setUpperDerivative (float derivative, bool recompute=true) throw () |
float | getUpperDerivative () const throw () |
void | createSpline () throw () |
Definition at line 22 of file cubicSpline1D.h.
BALL::CubicSpline1D::CubicSpline1D | ( | ) | throw () |
Default constructor.
BALL::CubicSpline1D::CubicSpline1D | ( | const std::vector< float > & | sample_positions, | |
const std::vector< float > & | sample_values, | |||
bool | return_average = false , |
|||
bool | is_natural = true , |
|||
float | lower_derivative = 0.0 , |
|||
float | upper_derivative = 0.0 , |
|||
int | verbosity = VERBOSITY_LEVEL_DEBUG | |||
) | throw () |
Detailed constructor. Given increasingly sorted positions { sample_positions} and their corresponding values { sample_values}, cubic splines are computed by determing and storing the curvatures of the cubic splines. By default, we assume the first and the last values to be the lower and upper bounds. If the { return_average} flag is set to true, the { default_value_} is set to the average, otherwise it is set to std::numeric_limits<float>::min()
. If the { is_natural} flag is set to true, the spline will be natural. Otherwise { lower_derivative} and { upper_derivative} are taken as first derivative of the first/last sample position.
BALL::CubicSpline1D::CubicSpline1D | ( | const std::vector< float > & | sample_positions, | |
const std::vector< float > & | sample_values, | |||
float | default_value, | |||
bool | is_natural = true , |
|||
float | lower_derivative = 0.0 , |
|||
float | upper_derivative = 0.0 , |
|||
int | verbosity = VERBOSITY_LEVEL_DEBUG | |||
) | throw () |
Detailed constructor. Given increasingly sorted positions { sample_positions} and their corresponding values { sample_values}, cubic splines are computed by determing and storing the curvatures of the cubic splines. The { default_value_} is set to the given default_value. By default, we assume the first and the last values to be the lower and upper bounds. If the { is_natural} flag is set to true, the spline will be natural. Otherwise { lower_derivative} and { upper_derivative} are taken as first derivative of the first/last sample position.
BALL::CubicSpline1D::CubicSpline1D | ( | const std::vector< float > & | sample_positions, | |
const std::vector< float > & | sample_values, | |||
float | default_value, | |||
float | lower_bound, | |||
float | upper_bound, | |||
bool | is_natural = true , |
|||
float | lower_derivative = 0.0 , |
|||
float | upper_derivative = 0.0 , |
|||
int | verbosity = VERBOSITY_LEVEL_DEBUG | |||
) | throw () |
Detailed constructor. Given increasingly sorted positions { sample_positions} and their corresponding values { sample_values}, a cubic spline is computed by determing and storing the curvatures of the cubic splines. The { default_value_} is set to the given default_value. The { lower_bound_} variable is set to the given lower_bound value, the { upper_bound_} variable is set to the given upper_bound value. This allows extrapolation. If the { is_natural} flag is set to true, the spline will be natural. Otherwise { lower_derivative} and { upper_derivative} are taken as first derivative of the first/last sample position.
BALL::CubicSpline1D::CubicSpline1D | ( | const std::vector< float > & | sample_positions, | |
const std::vector< float > & | sample_values, | |||
float | lower_bound, | |||
float | upper_bound, | |||
bool | return_average = false , |
|||
float | default_value = std::numeric_limits< float >::min() , |
|||
bool | is_natural = true , |
|||
float | lower_derivative = 0.0 , |
|||
float | upper_derivative = 0.0 , |
|||
int | verbosity = VERBOSITY_LEVEL_DEBUG | |||
) | throw () |
Detailed constructor. Given increasingly sorted positions { sample_positions} and their corresponding values { sample_values}, cubic splines are computed by determing and storing the curvatures of the cubic splines. If the { return_average} flag is set to true, the { default_value_} is set to the average, otherwise it is set to std::numeric_limits<float>::min()
. The { lower_bound_} variable is set to the given lower_bound value, the { upper_bound_} variavle is set to the given upper_bound value. If the { is_natural} flag is set to true, the spline will be natural. Otherwise { lower_derivative} and { upper_derivative} are taken as first derivative of the first/last sample position.
BALL::CubicSpline1D::CubicSpline1D | ( | const CubicSpline1D & | cs1D | ) | throw () |
Copy constructor.
virtual BALL::CubicSpline1D::~CubicSpline1D | ( | ) | throw () [virtual] |
Destructor.
void BALL::CubicSpline1D::createSpline | ( | ) | throw () [private] |
A method to create a spline. Note: - we assume the sample positions to be sorted increasingly!
std::vector<float> BALL::CubicSpline1D::getCurvature | ( | ) | const throw () [inline] |
Get the curvature.
Definition at line 158 of file cubicSpline1D.h.
float BALL::CubicSpline1D::getDefaultValue | ( | ) | const throw () [inline] |
Definition at line 192 of file cubicSpline1D.h.
float BALL::CubicSpline1D::getLowerBound | ( | ) | const throw () [inline] |
Get the lower/upper bounds of the spline
Definition at line 203 of file cubicSpline1D.h.
float BALL::CubicSpline1D::getLowerDerivative | ( | ) | const throw () [inline] |
Returns the first derivative of the lowest sample point of the spline.
Definition at line 228 of file cubicSpline1D.h.
std::vector<float> BALL::CubicSpline1D::getPositions | ( | ) | const throw () [inline] |
Get the sample positions of the spline.
Definition at line 181 of file cubicSpline1D.h.
float BALL::CubicSpline1D::getUpperBound | ( | ) | const throw () [inline] |
Definition at line 204 of file cubicSpline1D.h.
float BALL::CubicSpline1D::getUpperDerivative | ( | ) | const throw () [inline] |
Returns the first derivative of the upper sample point of the spline.
Definition at line 238 of file cubicSpline1D.h.
std::vector<float> BALL::CubicSpline1D::getValues | ( | ) | const throw () [inline] |
Get the sample values of the spline.
Definition at line 177 of file cubicSpline1D.h.
int BALL::CubicSpline1D::getVerbosity | ( | ) | const [inline] |
Definition at line 145 of file cubicSpline1D.h.
bool BALL::CubicSpline1D::isNatural | ( | ) | const throw () [inline] |
Returns true, if the spline is a natural spline.
Definition at line 207 of file cubicSpline1D.h.
void BALL::CubicSpline1D::makeNatural | ( | bool | recompute = true |
) | throw () |
Sets the variable { is_natural_} to true. By default the method recomputes the spline. If the argument is false, no recomputation is done.
A method to evaluate the spline at the access value x. If the access value is out of bound or if we have too less points given for the spline the { default_value} is returned. If the spacing is zero, std::numeric_limits<float>::min()
is returned.
void BALL::CubicSpline1D::setBoudaryDerivatives | ( | float | lower_derivative, | |
float | upper_derivative, | |||
bool | recompute = true | |||
) | throw () |
Sets the first derivatives of the boundary derivatives. By default the method recomputes the spline. If the argument is false, no recomputation is done.
void BALL::CubicSpline1D::setCurvature | ( | std::vector< float > | curvature | ) | throw () |
Set the curvature of the spline. Note: - the spline is not recomputed, but any access will consider the new curvature!
void BALL::CubicSpline1D::setDefaultValue | ( | float | value | ) | throw () [inline] |
A method to set the default value of the splines.
Definition at line 191 of file cubicSpline1D.h.
void BALL::CubicSpline1D::setLowerBound | ( | float | lb | ) | throw () [inline] |
Set the upper and lower bounds of the spline. We allow to set the spline upper and lower bounds to something different from the x-axis extrema. This allows extrapolation.
Definition at line 198 of file cubicSpline1D.h.
Set the first derivative of the lowest sample point of the spline. The spline is no longer natural! If the flag recompute
is set to false, the spline is not recomputed.
void BALL::CubicSpline1D::setPositions | ( | std::vector< float > | positions, | |
bool | recompute = true | |||
) | throw () |
Set the positions of the spline. Note: if the flag recompute
is set to false, the spline is not recomputed.
void BALL::CubicSpline1D::setUpperBound | ( | float | ub | ) | throw () [inline] |
Definition at line 199 of file cubicSpline1D.h.
Set the first derivative of the upper sample point of the spline. The spline is no longer natural. If the flag recompute
is set to false, the spline is not recomputed.
Set the sample values of the spline. Note: if the flag recompute
is set to false, the spline will not be recomputed.
void BALL::CubicSpline1D::setVerbosity | ( | int | verbosity | ) | [inline] |
Definition at line 142 of file cubicSpline1D.h.
std::vector<float> BALL::CubicSpline1D::curvature_ [private] |
Definition at line 256 of file cubicSpline1D.h.
float BALL::CubicSpline1D::default_value_ [private] |
The default value of the spline. In case the access-value is out of bounds or if we have to less points, the { default_value_} is returned.
Definition at line 265 of file cubicSpline1D.h.
bool BALL::CubicSpline1D::is_natural_ [private] |
Definition at line 274 of file cubicSpline1D.h.
float BALL::CubicSpline1D::lower_bound_ [private] |
Definition at line 268 of file cubicSpline1D.h.
float BALL::CubicSpline1D::lower_derivative_ [private] |
Definition at line 277 of file cubicSpline1D.h.
bool BALL::CubicSpline1D::return_average_ [private] |
Definition at line 259 of file cubicSpline1D.h.
std::vector<float> BALL::CubicSpline1D::sample_positions_ [private] |
Definition at line 252 of file cubicSpline1D.h.
std::vector<float> BALL::CubicSpline1D::sample_values_ [private] |
Definition at line 254 of file cubicSpline1D.h.
float BALL::CubicSpline1D::upper_bound_ [private] |
Definition at line 271 of file cubicSpline1D.h.
float BALL::CubicSpline1D::upper_derivative_ [private] |
Definition at line 280 of file cubicSpline1D.h.
int BALL::CubicSpline1D::verbosity_ [private] |
Definition at line 283 of file cubicSpline1D.h.
const int BALL::CubicSpline1D::VERBOSITY_LEVEL_CRITICAL [static] |
Definition at line 27 of file cubicSpline1D.h.
const int BALL::CubicSpline1D::VERBOSITY_LEVEL_DEBUG [static] |
Definition at line 26 of file cubicSpline1D.h.