#include <BALL/MATHS/cubicSpline2D.h>
Static Public Attributes | |
static const int | VERBOSITY_LEVEL_DEBUG |
static const int | VERBOSITY_LEVEL_CRITICAL |
Constructors and Destructors. | |
| |
std::vector< std::vector< float > > | sample_positions_x_ |
std::vector< float > | sample_positions_y_ |
std::vector< CubicSpline1D > | splines_ |
std::vector< std::vector< float > > | sample_values_ |
bool | return_average_ |
std::vector< float > | x_default_values_ |
float | y_default_value_ |
float | default_value_ |
vector< float > | x_lower_bounds_ |
vector< float > | x_upper_bounds_ |
float | y_lower_bound_ |
float | y_upper_bound_ |
vector< bool > | x_is_natural_ |
bool | y_is_natural_ |
vector< float > | x_lower_derivatives_ |
vector< float > | x_upper_derivatives_ |
float | y_lower_derivative_ |
float | y_upper_derivative_ |
int | verbosity_ |
CubicSpline2D () throw () | |
CubicSpline2D (const std::vector< std::vector< float > > &sample_positions_x, const std::vector< float > &sample_positions_y, const std::vector< std::vector< float > > &sample_values, bool return_average=false, bool is_natural=true, const std::vector< float > &x_lower_derivatives=std::vector< float >(), const std::vector< float > &x_upper_derivatives=std::vector< float >(), float y_lower_derivative=0., float y_upper_derivative=0., int verbosity=VERBOSITY_LEVEL_DEBUG) throw () | |
CubicSpline2D (const std::vector< std::vector< float > > &sample_positions_x, const std::vector< float > &sample_positions_y, const std::vector< std::vector< float > > &sample_values, const std::vector< float > &x_default_values, float y_default_value, const std::vector< float > &x_lower_bounds, const std::vector< float > &x_upper_bounds, float y_lower_bound, float y_upper_bound, bool is_natural=true, const std::vector< float > &x_lower_derivatives=std::vector< float >(), const std::vector< float > &x_upper_derivatives=std::vector< float >(), float y_lower_derivative=0.0, float y_upper_derivative=0.0, int verbosity=VERBOSITY_LEVEL_DEBUG) throw () | |
CubicSpline2D (const std::vector< float > &sample_positions_x, const std::vector< float > &sample_positions_y, const std::vector< std::vector< float > > &sample_values, bool return_average=false, bool is_natural=true, const std::vector< float > &x_lower_derivatives=std::vector< float >(), const std::vector< float > &x_upper_derivatives=std::vector< float >(), float y_lower_derivative=0., float y_upper_derivative=0., int verbosity=VERBOSITY_LEVEL_DEBUG) throw () | |
CubicSpline2D (const std::vector< float > &sample_positions_x, const std::vector< float > &sample_positions_y, const std::vector< std::vector< float > > &sample_values, const std::vector< float > &x_default_values, float y_default_value, const std::vector< float > &x_lower_bounds, const std::vector< float > &x_upper_bounds, float y_lower_bound, float y_upper_bound, bool is_natural=true, const std::vector< float > &x_lower_derivatives=std::vector< float >(), const std::vector< float > &x_upper_derivatives=std::vector< float >(), float y_lower_derivative=0.0, float y_upper_derivative=0.0, int verbosity=VERBOSITY_LEVEL_DEBUG) throw () | |
CubicSpline2D (const CubicSpline2D &cs2D) throw () | |
virtual | ~CubicSpline2D () throw () |
void | setVerbosity (int verbosity) |
Set the verbosity of the spline computation and evaluation. | |
float | operator() (float x, float y) throw () |
float | getXDefaultValue (Index x) const throw (Exception::OutOfRange) |
float | getYDefaultValue () const throw () |
void | setXDefaultValues (vector< float > x_default_values) throw () |
void | setYDefaultValue (float y_default_value) throw () |
void | setYLowerBound (float lb) throw () |
void | setYUpperBound (float ub) throw () |
float | getYLowerBound () throw () |
float | getYUpperBound () throw () |
void | setXLowerBounds (vector< float > lb) throw () |
void | setXUpperBounds (vector< float > ub) throw () |
const vector< float > & | getXLowerBounds () const throw (Exception::OutOfRange) |
const vector< float > & | getXUpperBounds () const throw (Exception::OutOfRange) |
float | getXLowerBounds (Index x) const throw (Exception::OutOfRange) |
float | getXUpperBounds (Index x) const throw (Exception::OutOfRange) |
bool | isXNatural (Index x) throw () |
vector< bool > | isXNatural () const throw () |
void | makeXNatural (Index x, bool recompute=true) throw () |
void | makeAllXNatural (bool recompute=true) throw () |
void | makeYNatural (bool y_is_natural, bool recompute=true) throw () |
bool | isYNatural () throw () |
void | setXLowerDerivatives (vector< float > ld, bool recompute=true) throw () |
void | setXUpperDerivatives (vector< float > ud, bool recompute=true) throw () |
float | getXLowerDerivatives (Index x) throw (Exception::OutOfRange) |
float | getXUpperDerivatives (Index x) throw (Exception::OutOfRange) |
vector< float > & | getXLowerDerivatives () throw () |
vector< float > & | getXUpperDerivatives () throw () |
void | setYLowerDerivative (float ld, bool recompute=true) throw () |
void | setYUpperDerivative (float ud, bool recompute=true) throw () |
float | getYLowerDerivative () throw () |
float | getYUpperDerivative () throw () |
CubicSpline1D & | getSpline (Position i) throw (Exception::OutOfRange) |
const CubicSpline1D & | getSpline (Position i) const throw (Exception::OutOfRange) |
Size | getNumberOfSplines () const throw () |
void | createBiCubicSpline () throw () |
Definition at line 17 of file cubicSpline2D.h.
BALL::CubicSpline2D::CubicSpline2D | ( | ) | throw () |
Default constructor.
BALL::CubicSpline2D::CubicSpline2D | ( | const std::vector< std::vector< float > > & | sample_positions_x, | |
const std::vector< float > & | sample_positions_y, | |||
const std::vector< std::vector< float > > & | sample_values, | |||
bool | return_average = false , |
|||
bool | is_natural = true , |
|||
const std::vector< float > & | x_lower_derivatives = std::vector< float >() , |
|||
const std::vector< float > & | x_upper_derivatives = std::vector< float >() , |
|||
float | y_lower_derivative = 0. , |
|||
float | y_upper_derivative = 0. , |
|||
int | verbosity = VERBOSITY_LEVEL_DEBUG | |||
) | throw () |
Detailed constructor Given the increasingly sorted sample positions { sample_positions_y_} in y direction, increasingly sorted sample positions { sample_positions_x_} in x direction and the corresponding sample values { sample_values} a 2D spline is created by storing for each y sample position the corresponding 1d spline in x direction. 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 return values are set to the spline average. If the { is_natural} flag is set to true, all 1D splines and the 1D spline in y direction used in the { operator() } will be natural. Otherwise { x_lower_derivatives} and { x_upper_derivatives} are taken as first derivatives of the first/last sample positions in x direction and { y_lower_derivative} and { y_upper_derivative} are taken as the first derivatives of the first/last derivative in y direction. By default, the derivatives are set to zero.
BALL::CubicSpline2D::CubicSpline2D | ( | const std::vector< std::vector< float > > & | sample_positions_x, | |
const std::vector< float > & | sample_positions_y, | |||
const std::vector< std::vector< float > > & | sample_values, | |||
const std::vector< float > & | x_default_values, | |||
float | y_default_value, | |||
const std::vector< float > & | x_lower_bounds, | |||
const std::vector< float > & | x_upper_bounds, | |||
float | y_lower_bound, | |||
float | y_upper_bound, | |||
bool | is_natural = true , |
|||
const std::vector< float > & | x_lower_derivatives = std::vector< float >() , |
|||
const std::vector< float > & | x_upper_derivatives = std::vector< float >() , |
|||
float | y_lower_derivative = 0.0 , |
|||
float | y_upper_derivative = 0.0 , |
|||
int | verbosity = VERBOSITY_LEVEL_DEBUG | |||
) | throw () |
Detailed constructor Given the increasingly sorted sample positions { sample_positions_y_} in y direction, increasingly sorted sample positions { sample_positions_x_} in x direction and the corresponding sample values { sample_values} a 2D spline is created by storing for each y sample position the corresponding 1d spline in x direction. The { return_average} flag is set to false and the default values { x_default_values_} and { y_default_value_} is set to the given values. The lower and upper bounds in x and y direction are set to the given values. If the { is_natural} flag is set to true, all 1D splines and the 1D spline in y direction used in the { operator() } will be natural. Otherwise { x_lower_derivatives} and { x_upper_derivatives} are taken as first derivatives of the first/last sample positions in x direction and { y_lower_derivative} and { y_upper_derivative} are taken as the first derivatives of the first/last derivative in y direction. By default, the derivatives are set to zero.
BALL::CubicSpline2D::CubicSpline2D | ( | const std::vector< float > & | sample_positions_x, | |
const std::vector< float > & | sample_positions_y, | |||
const std::vector< std::vector< float > > & | sample_values, | |||
bool | return_average = false , |
|||
bool | is_natural = true , |
|||
const std::vector< float > & | x_lower_derivatives = std::vector< float >() , |
|||
const std::vector< float > & | x_upper_derivatives = std::vector< float >() , |
|||
float | y_lower_derivative = 0. , |
|||
float | y_upper_derivative = 0. , |
|||
int | verbosity = VERBOSITY_LEVEL_DEBUG | |||
) | throw () |
Detailed constructor Given the increasingly sorted sample positions { sample_positions_y_} in y direction, increasingly sorted sample positions { sample_positions_x_} in x direction (same for all splines in x direction! ) and the corresponding sample values { sample_values} a 2D spline is created by storing for each y sample position the corresponding 1d spline in x direction. 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 return values are set to the spline average. If the { is_natural} flag is set to true, all 1D splines and the 1D spline in y direction used in the { operator() } will be natural. Otherwise { x_lower_derivatives} and { x_upper_derivatives} are taken as first derivatives of the first/last sample positions in x direction and { y_lower_derivative} and { y_upper_derivative} are taken as the first derivatives of the first/last derivative in y direction. By default, the derivatives are set to zero.
BALL::CubicSpline2D::CubicSpline2D | ( | const std::vector< float > & | sample_positions_x, | |
const std::vector< float > & | sample_positions_y, | |||
const std::vector< std::vector< float > > & | sample_values, | |||
const std::vector< float > & | x_default_values, | |||
float | y_default_value, | |||
const std::vector< float > & | x_lower_bounds, | |||
const std::vector< float > & | x_upper_bounds, | |||
float | y_lower_bound, | |||
float | y_upper_bound, | |||
bool | is_natural = true , |
|||
const std::vector< float > & | x_lower_derivatives = std::vector< float >() , |
|||
const std::vector< float > & | x_upper_derivatives = std::vector< float >() , |
|||
float | y_lower_derivative = 0.0 , |
|||
float | y_upper_derivative = 0.0 , |
|||
int | verbosity = VERBOSITY_LEVEL_DEBUG | |||
) | throw () |
Detailed constructor Given the increasingly sorted sample positions { sample_positions_y_} in y direction, increasingly sorted sample positions { sample_positions_x_} in x direction and the corresponding sample values { sample_values} a 2D spline is created by storing for each y sample position the corresponding 1d spline in x direction. The { return_average} flag is set to false and the default values { x_default_values_} and { y_default_value_} is set to the given values. The lower and upper bounds in x and y direction are set to the given values. If the { is_natural} flag is set to true, all 1D splines and the 1D spline in y direction used in the { operator() } will be natural. Otherwise { x_lower_derivatives} and { x_upper_derivatives} are taken as first derivatives of the first/last sample positions in x direction and { y_lower_derivative} and { y_upper_derivative} are taken as the first derivatives of the first/last derivative in y direction. By default, the derivatives are set to zero.
BALL::CubicSpline2D::CubicSpline2D | ( | const CubicSpline2D & | cs2D | ) | throw () |
Copy constructor.
virtual BALL::CubicSpline2D::~CubicSpline2D | ( | ) | throw () [virtual] |
Destructor.
void BALL::CubicSpline2D::createBiCubicSpline | ( | ) | throw () [private] |
Method to create a 2D cubic spline relying to be given _increasingly ordered_ sample positions in y direction, for each y position _increasingly ordered_ sample positions in x direction, and the corresponding sample values. If the { return_average_} flag is set to true, the { default_value_} is the average of the 1D spline averages, otherwise it is set to std::numeric_limits<float>::min()
. By default the boundaries in y direction are set to the lower and the upper y sample position. The { operator ()} returns the 2D interpolation for given x and y values.
Size BALL::CubicSpline2D::getNumberOfSplines | ( | ) | const throw () [inline] |
Definition at line 264 of file cubicSpline2D.h.
const CubicSpline1D& BALL::CubicSpline2D::getSpline | ( | Position | i | ) | const throw (Exception::OutOfRange) |
CubicSpline1D& BALL::CubicSpline2D::getSpline | ( | Position | i | ) | throw (Exception::OutOfRange) |
float BALL::CubicSpline2D::getXDefaultValue | ( | Index | x | ) | const throw (Exception::OutOfRange) |
float BALL::CubicSpline2D::getXLowerBounds | ( | Index | x | ) | const throw (Exception::OutOfRange) |
Get the lower/upper bounds in x direction If x is out of bound, std::numeric_limits<float>::min()
is returned.
const vector<float>& BALL::CubicSpline2D::getXLowerBounds | ( | ) | const throw (Exception::OutOfRange) [inline] |
Returns all lower/upper bounds in x direction.
Definition at line 214 of file cubicSpline2D.h.
vector<float>& BALL::CubicSpline2D::getXLowerDerivatives | ( | ) | throw () [inline] |
Definition at line 251 of file cubicSpline2D.h.
float BALL::CubicSpline2D::getXLowerDerivatives | ( | Index | x | ) | throw (Exception::OutOfRange) |
Get the lower/upper derivatives in x direction If x is out of bound, std::numeric_limits<float>::min()
is returned.
float BALL::CubicSpline2D::getXUpperBounds | ( | Index | x | ) | const throw (Exception::OutOfRange) |
const vector<float>& BALL::CubicSpline2D::getXUpperBounds | ( | ) | const throw (Exception::OutOfRange) [inline] |
Definition at line 215 of file cubicSpline2D.h.
vector<float>& BALL::CubicSpline2D::getXUpperDerivatives | ( | ) | throw () [inline] |
Definition at line 252 of file cubicSpline2D.h.
float BALL::CubicSpline2D::getXUpperDerivatives | ( | Index | x | ) | throw (Exception::OutOfRange) |
float BALL::CubicSpline2D::getYDefaultValue | ( | ) | const throw () [inline] |
Definition at line 197 of file cubicSpline2D.h.
float BALL::CubicSpline2D::getYLowerBound | ( | ) | throw () [inline] |
Definition at line 208 of file cubicSpline2D.h.
float BALL::CubicSpline2D::getYLowerDerivative | ( | ) | throw () [inline] |
Definition at line 257 of file cubicSpline2D.h.
float BALL::CubicSpline2D::getYUpperBound | ( | ) | throw () [inline] |
Definition at line 209 of file cubicSpline2D.h.
float BALL::CubicSpline2D::getYUpperDerivative | ( | ) | throw () [inline] |
Definition at line 258 of file cubicSpline2D.h.
vector<bool> BALL::CubicSpline2D::isXNatural | ( | ) | const throw () [inline] |
Definition at line 225 of file cubicSpline2D.h.
Returns true if the x-th spline in x direction is natural. If x is out of bound, std::numeric_limits<float>::min()
is returned.
bool BALL::CubicSpline2D::isYNatural | ( | ) | throw () [inline] |
Definition at line 241 of file cubicSpline2D.h.
void BALL::CubicSpline2D::makeAllXNatural | ( | bool | recompute = true |
) | throw () |
Sets the flag { is_natural_} for all x-th splines to true. By default the method recomputes all splines. If the argument is false, no recomputation is done.
Sets the flag { is_natural_} for the x-th spline to true. By default the method recomputes the spline. If the argument is false, no recomputation is done.
Sets the flag { y_is_natural_} to true. Since the spline in y direction is created for each call of { operator ()} new, recomputation is not necessary.
A method to evaluate the 2Dspline at the access values x | y. First all spline in y-direction are evaluated at x. Based on these values a temporary 1D spline is created, which will be evaluated at y. If the access values are out of bound or if we have too less points given for a spline the { default_value} is returned. If the spacing is zero, std::numeric_limits<float>::min()
is returned.
void BALL::CubicSpline2D::setVerbosity | ( | int | verbosity | ) |
Set the verbosity of the spline computation and evaluation.
void BALL::CubicSpline2D::setXDefaultValues | ( | vector< float > | x_default_values | ) | throw () [inline] |
Definition at line 199 of file cubicSpline2D.h.
void BALL::CubicSpline2D::setXLowerBounds | ( | vector< float > | lb | ) | throw () [inline] |
Definition at line 211 of file cubicSpline2D.h.
void BALL::CubicSpline2D::setXLowerDerivatives | ( | vector< float > | ld, | |
bool | recompute = true | |||
) | throw () |
void BALL::CubicSpline2D::setXUpperBounds | ( | vector< float > | ub | ) | throw () [inline] |
Definition at line 212 of file cubicSpline2D.h.
void BALL::CubicSpline2D::setXUpperDerivatives | ( | vector< float > | ud, | |
bool | recompute = true | |||
) | throw () |
void BALL::CubicSpline2D::setYDefaultValue | ( | float | y_default_value | ) | throw () [inline] |
Definition at line 201 of file cubicSpline2D.h.
void BALL::CubicSpline2D::setYLowerBound | ( | float | lb | ) | throw () [inline] |
Definition at line 205 of file cubicSpline2D.h.
void BALL::CubicSpline2D::setYUpperBound | ( | float | ub | ) | throw () [inline] |
Definition at line 206 of file cubicSpline2D.h.
float BALL::CubicSpline2D::default_value_ [private] |
The default value of splines in general. If the return_average_ flag is set to true, the averall average of the splines is computed. Otherwise it is set to std::numeric_limits<float>::min()
.
Definition at line 316 of file cubicSpline2D.h.
bool BALL::CubicSpline2D::return_average_ [private] |
Definition at line 297 of file cubicSpline2D.h.
std::vector< std::vector<float> > BALL::CubicSpline2D::sample_positions_x_ [private] |
Definition at line 281 of file cubicSpline2D.h.
std::vector<float> BALL::CubicSpline2D::sample_positions_y_ [private] |
Definition at line 284 of file cubicSpline2D.h.
std::vector<std::vector<float> > BALL::CubicSpline2D::sample_values_ [private] |
Definition at line 290 of file cubicSpline2D.h.
std::vector<CubicSpline1D> BALL::CubicSpline2D::splines_ [private] |
Definition at line 287 of file cubicSpline2D.h.
int BALL::CubicSpline2D::verbosity_ [private] |
Definition at line 351 of file cubicSpline2D.h.
const int BALL::CubicSpline2D::VERBOSITY_LEVEL_CRITICAL [static] |
Definition at line 22 of file cubicSpline2D.h.
const int BALL::CubicSpline2D::VERBOSITY_LEVEL_DEBUG [static] |
Definition at line 21 of file cubicSpline2D.h.
std::vector<float> BALL::CubicSpline2D::x_default_values_ [private] |
The default values of the splines in x direction. In case the access-value of the x-th spline in x direction is out of bounds or if too less points are given, the corresponding { default_value_(x)} is returned.
Definition at line 304 of file cubicSpline2D.h.
vector<bool> BALL::CubicSpline2D::x_is_natural_ [private] |
Definition at line 332 of file cubicSpline2D.h.
vector<float> BALL::CubicSpline2D::x_lower_bounds_ [private] |
Definition at line 319 of file cubicSpline2D.h.
vector<float> BALL::CubicSpline2D::x_lower_derivatives_ [private] |
Definition at line 339 of file cubicSpline2D.h.
vector<float> BALL::CubicSpline2D::x_upper_bounds_ [private] |
Definition at line 322 of file cubicSpline2D.h.
vector<float> BALL::CubicSpline2D::x_upper_derivatives_ [private] |
Definition at line 342 of file cubicSpline2D.h.
float BALL::CubicSpline2D::y_default_value_ [private] |
The default value of the splines in y direction. In case the access-value of the y-th spline in y direction is out of bounds or if too less points for this spline are given, the corresponding { default_value_(y)} is returned.
Definition at line 311 of file cubicSpline2D.h.
bool BALL::CubicSpline2D::y_is_natural_ [private] |
Definition at line 335 of file cubicSpline2D.h.
float BALL::CubicSpline2D::y_lower_bound_ [private] |
Definition at line 325 of file cubicSpline2D.h.
Definition at line 345 of file cubicSpline2D.h.
float BALL::CubicSpline2D::y_upper_bound_ [private] |
Definition at line 328 of file cubicSpline2D.h.
Definition at line 348 of file cubicSpline2D.h.