Loading...
Searching...
No Matches
BALL::CubicSpline1D Class Reference

`#include <BALL/MATHS/cubicSpline1D.h>`

## Static Public Attributes

static const int | VERBOSITY_LEVEL_DEBUG
static const int | VERBOSITY_LEVEL_CRITICAL

## Constructors and Destructors.

| 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)
| 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)
| 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)
| 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)
| CubicSpline1D (const CubicSpline1D &cs1D)
virtual | ~CubicSpline1D ()
void | setVerbosity (int verbosity)
int | getVerbosity () const
float | operator() (float x)
std::vector< float > | getCurvature () const
void | setCurvature (std::vector< float > curvature)
void | setValues (std::vector< float > values, bool recompute=true)
std::vector< float > | getValues () const
std::vector< float > | getPositions () const
void | setPositions (std::vector< float > positions, bool recompute=true)
void | setDefaultValue (float value)
float | getDefaultValue () const
void | setLowerBound (float lb)
void | setUpperBound (float ub)
float | getLowerBound () const
float | getUpperBound () const
bool | isNatural () const
void | makeNatural (bool recompute=true)
void | setBoudaryDerivatives (float lower_derivative, float upper_derivative, bool recompute=true)
void | setLowerDerivative (float derivative, bool recompute=true)
float | getLowerDerivative () const
void | setUpperDerivative (float derivative, bool recompute=true)
float | getUpperDerivative () const

## Detailed Description

Definition at line 18 of file cubicSpline1D.h.

## Constructor & Destructor Documentation

## CubicSpline1D() [1/6]

BALL::CubicSpline1D::CubicSpline1D | ( |  | ) |

Default constructor.

## CubicSpline1D() [2/6]

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 )

Detailed constructor. Given increasingly sorted positions {\tt sample_positions} and
their corresponding values {\tt 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 {\tt return_average} flag is set to true, the {\tt default_value_} is set to the average, otherwise it is set to std::numeric_limits<float>::min() . If the {\tt is_natural} flag is set to true, the spline will be natural. Otherwise {\tt lower_derivative} and {\tt upper_derivative} are taken as first derivative of the first/last sample position.

## CubicSpline1D() [3/6]

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 )

Detailed constructor. Given increasingly sorted positions {\tt sample_positions} and
their corresponding values {\tt sample_values}, cubic splines are computed by determing and storing the curvatures of the cubic splines. The {\tt 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 {\tt is_natural} flag is set to true, the spline will be natural. Otherwise {\tt lower_derivative} and {\tt upper_derivative} are taken as first derivative of the first/last sample position.

## CubicSpline1D() [4/6]

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 )

Detailed constructor. Given increasingly sorted positions {\tt sample_positions} and
their corresponding values {\tt sample_values}, a cubic spline is computed by determing and storing the curvatures of the cubic splines. The {\tt default_value_} is set to the given default_value. The {\tt lower_bound_} variable is set to the given lower_bound value, the {\tt upper_bound_} variable is set to the given upper_bound value. This allows extrapolation. If the {\tt is_natural} flag is set to true, the spline will be natural. Otherwise {\tt lower_derivative} and {\tt upper_derivative} are taken as first derivative of the first/last sample position.

## CubicSpline1D() [5/6]

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 )

Detailed constructor. Given increasingly sorted positions {\tt sample_positions} and
their corresponding values {\tt sample_values}, cubic splines are computed by determing and storing the curvatures of the cubic splines. If the {\tt return_average} flag is set to true, the {\tt default_value_} is set to the average, otherwise it is set to std::numeric_limits<float>::min() . The {\tt lower_bound_} variable is set to the given lower_bound value, the {\tt upper_bound_} variavle is set to the given upper_bound value. If the {\tt is_natural} flag is set to true, the spline will be natural. Otherwise {\tt lower_derivative} and {\tt upper_derivative} are taken as first derivative of the first/last sample position.

## CubicSpline1D() [6/6]

BALL::CubicSpline1D::CubicSpline1D | ( | const CubicSpline1D & | cs1D | ) |

Copy constructor.

## ~CubicSpline1D()

virtual BALL::CubicSpline1D::~CubicSpline1D | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## getCurvature()

std::vector< float > BALL::CubicSpline1D::getCurvature | ( |  | ) | const

inline

Get the curvature.

Definition at line 147 of file cubicSpline1D.h.

## getDefaultValue()

float BALL::CubicSpline1D::getDefaultValue | ( |  | ) | const

inline

Definition at line 180 of file cubicSpline1D.h.

## getLowerBound()

float BALL::CubicSpline1D::getLowerBound | ( |  | ) | const

inline

Get the lower/upper bounds of the spline

Definition at line 191 of file cubicSpline1D.h.

## getLowerDerivative()

float BALL::CubicSpline1D::getLowerDerivative | ( |  | ) | const

inline

Returns the first derivative of the lowest sample point of the spline.

Definition at line 216 of file cubicSpline1D.h.

## getPositions()

std::vector< float > BALL::CubicSpline1D::getPositions | ( |  | ) | const

inline

Get the sample positions of the spline.

Definition at line 169 of file cubicSpline1D.h.

## getUpperBound()

float BALL::CubicSpline1D::getUpperBound | ( |  | ) | const

inline

Definition at line 192 of file cubicSpline1D.h.

## getUpperDerivative()

float BALL::CubicSpline1D::getUpperDerivative | ( |  | ) | const

inline

Returns the first derivative of the upper sample point of the spline.

Definition at line 226 of file cubicSpline1D.h.

## getValues()

std::vector< float > BALL::CubicSpline1D::getValues | ( |  | ) | const

inline

Get the sample values of the spline.

Definition at line 165 of file cubicSpline1D.h.

## getVerbosity()

int BALL::CubicSpline1D::getVerbosity | ( |  | ) | const

inline

Definition at line 134 of file cubicSpline1D.h.

## isNatural()

bool BALL::CubicSpline1D::isNatural | ( |  | ) | const

inline

Returns true, if the spline is a natural spline.

Definition at line 195 of file cubicSpline1D.h.

## makeNatural()

void BALL::CubicSpline1D::makeNatural | ( | bool | recompute = true | ) |

Sets the variable {\tt is_natural_} to true. By default the method recomputes the spline. If the argument is false, no recomputation is done.

## operator()()

float BALL::CubicSpline1D::operator() | ( | float | x | ) |

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 {\tt default_value} is returned. If the spacing is zero, std::numeric_limits<float>::min() is returned.

## setBoudaryDerivatives()

void BALL::CubicSpline1D::setBoudaryDerivatives | ( | float | lower_derivative,
|  | float | upper_derivative,
|  | bool | recompute = true )

Sets the first derivatives of the boundary derivatives. By default the method recomputes the spline. If the argument is false, no recomputation is done.

## setCurvature()

void BALL::CubicSpline1D::setCurvature | ( | std::vector< float > | curvature | ) |

Set the curvature of the spline. Note: - the spline is not recomputed, but any access will consider the new curvature!

- a subsequent recomputation will overwrite the new curvature!

## setDefaultValue()

void BALL::CubicSpline1D::setDefaultValue | ( | float | value | ) |

inline

A method to set the default value of the splines.

Definition at line 179 of file cubicSpline1D.h.

## setLowerBound()

void BALL::CubicSpline1D::setLowerBound | ( | float | lb | ) |

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 186 of file cubicSpline1D.h.

## setLowerDerivative()

void BALL::CubicSpline1D::setLowerDerivative | ( | float | derivative,
|  | bool | recompute = true )

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.

## setPositions()

void BALL::CubicSpline1D::setPositions | ( | std::vector< float > | positions,
|  | bool | recompute = true )

Set the positions of the spline. Note: if the flag recompute is set to false, the spline is not recomputed.

## setUpperBound()

void BALL::CubicSpline1D::setUpperBound | ( | float | ub | ) |

inline

Definition at line 187 of file cubicSpline1D.h.

## setUpperDerivative()

void BALL::CubicSpline1D::setUpperDerivative | ( | float | derivative,
|  | bool | recompute = true )

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.

## setValues()

void BALL::CubicSpline1D::setValues | ( | std::vector< float > | values,
|  | bool | recompute = true )

Set the sample values of the spline. Note: if the flag recompute is set to false, the spline will not be recomputed.

## setVerbosity()

void BALL::CubicSpline1D::setVerbosity | ( | int | verbosity | ) |

inline

Definition at line 131 of file cubicSpline1D.h.

## Member Data Documentation

## VERBOSITY_LEVEL_CRITICAL

const int BALL::CubicSpline1D::VERBOSITY_LEVEL_CRITICAL

static

Definition at line 23 of file cubicSpline1D.h.

## VERBOSITY_LEVEL_DEBUG

const int BALL::CubicSpline1D::VERBOSITY_LEVEL_DEBUG

static

Definition at line 22 of file cubicSpline1D.h.