BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Static Public Attributes | List of all members
BALL::CubicSpline2D Class Reference

#include <BALL/MATHS/cubicSpline2D.h>

Static Public Attributes

static const int VERBOSITY_LEVEL_DEBUG
 
static const int VERBOSITY_LEVEL_CRITICAL
 

Constructors and Destructors.

 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)
 
 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)
 
 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)
 
 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)
 
 CubicSpline2D (const CubicSpline2D &cs2D)
 
virtual ~CubicSpline2D ()
 
void setVerbosity (int verbosity)
 Set the verbosity of the spline computation and evaluation. More...
 
float operator() (float x, float y)
 
float getXDefaultValue (Index x) const
 
float getYDefaultValue () const
 
void setXDefaultValues (vector< float > x_default_values)
 
void setYDefaultValue (float y_default_value)
 
void setYLowerBound (float lb)
 
void setYUpperBound (float ub)
 
float getYLowerBound ()
 
float getYUpperBound ()
 
void setXLowerBounds (vector< float > lb)
 
void setXUpperBounds (vector< float > ub)
 
const vector< float > & getXLowerBounds () const
 
const vector< float > & getXUpperBounds () const
 
float getXLowerBounds (Index x) const
 
float getXUpperBounds (Index x) const
 
bool isXNatural (Index x)
 
vector< boolisXNatural () const
 
void makeXNatural (Index x, bool recompute=true)
 
void makeAllXNatural (bool recompute=true)
 
void makeYNatural (bool y_is_natural, bool recompute=true)
 
bool isYNatural ()
 
void setXLowerDerivatives (vector< float > ld, bool recompute=true)
 
void setXUpperDerivatives (vector< float > ud, bool recompute=true)
 
float getXLowerDerivatives (Index x)
 
float getXUpperDerivatives (Index x)
 
vector< float > & getXLowerDerivatives ()
 
vector< float > & getXUpperDerivatives ()
 
void setYLowerDerivative (float ld, bool recompute=true)
 
void setYUpperDerivative (float ud, bool recompute=true)
 
float getYLowerDerivative ()
 
float getYUpperDerivative ()
 
CubicSpline1DgetSpline (Position i)
 
const CubicSpline1DgetSpline (Position i) const
 
Size getNumberOfSplines () const
 

Detailed Description

Definition at line 17 of file cubicSpline2D.h.

Constructor & Destructor Documentation

BALL::CubicSpline2D::CubicSpline2D ( )

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 
)

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 
)

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 
)

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 
)

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)

Copy constructor.

virtual BALL::CubicSpline2D::~CubicSpline2D ( )
virtual

Destructor.

Member Function Documentation

Size BALL::CubicSpline2D::getNumberOfSplines ( ) const
inline

Definition at line 289 of file cubicSpline2D.h.

CubicSpline1D& BALL::CubicSpline2D::getSpline ( Position  i)

Return the i-th spline

Exceptions
Exception::OutOfRangeif i >= getNumberOfSplines()
const CubicSpline1D& BALL::CubicSpline2D::getSpline ( Position  i) const

Return the i-th spline

Exceptions
Exception::OutOfRangeif i >= getNumberOfSplines()
float BALL::CubicSpline2D::getXDefaultValue ( Index  x) const

Returns the x-th default value in x direction.

Exceptions
Exception::OutOfRangeif x >= number_of_default_values
const vector<float>& BALL::CubicSpline2D::getXLowerBounds ( ) const
inline

Returns all lower bounds in x direction.

Definition at line 212 of file cubicSpline2D.h.

float BALL::CubicSpline2D::getXLowerBounds ( Index  x) const

Get the lower bounds in x direction

Exceptions
Exception::OutOfRangeif x >= x_lower_bounds_.size()
float BALL::CubicSpline2D::getXLowerDerivatives ( Index  x)

Get the lower derivatives in x direction

Exceptions
Exception::OutOfRangeif x >= x_lower_derivatives_.size()
vector<float>& BALL::CubicSpline2D::getXLowerDerivatives ( )
inline

Definition at line 267 of file cubicSpline2D.h.

const vector<float>& BALL::CubicSpline2D::getXUpperBounds ( ) const
inline

Returns all upper bounds in x direction.

Definition at line 216 of file cubicSpline2D.h.

float BALL::CubicSpline2D::getXUpperBounds ( Index  x) const

Get the upper bounds in x direction

Exceptions
Exception::OutOfRangeif x >= x_upper_bounds_.size()
float BALL::CubicSpline2D::getXUpperDerivatives ( Index  x)

Get the upper derivatives in x direction

Exceptions
Exception::OutOfRangeif x >= x_upper_derivatives_.size()
vector<float>& BALL::CubicSpline2D::getXUpperDerivatives ( )
inline

Definition at line 268 of file cubicSpline2D.h.

float BALL::CubicSpline2D::getYDefaultValue ( ) const
inline

Returns the y-th default value in x direction.

Definition at line 191 of file cubicSpline2D.h.

float BALL::CubicSpline2D::getYLowerBound ( )
inline

Definition at line 204 of file cubicSpline2D.h.

float BALL::CubicSpline2D::getYLowerDerivative ( )
inline

Definition at line 275 of file cubicSpline2D.h.

float BALL::CubicSpline2D::getYUpperBound ( )
inline

Definition at line 205 of file cubicSpline2D.h.

float BALL::CubicSpline2D::getYUpperDerivative ( )
inline

Definition at line 276 of file cubicSpline2D.h.

bool BALL::CubicSpline2D::isXNatural ( Index  x)

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.

vector<bool> BALL::CubicSpline2D::isXNatural ( ) const
inline

Definition at line 231 of file cubicSpline2D.h.

bool BALL::CubicSpline2D::isYNatural ( )
inline

Returns true if the spline in y direction for each call in { operator ()} is natural.

Definition at line 251 of file cubicSpline2D.h.

void BALL::CubicSpline2D::makeAllXNatural ( bool  recompute = true)

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.

void BALL::CubicSpline2D::makeXNatural ( Index  x,
bool  recompute = true 
)

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.

void BALL::CubicSpline2D::makeYNatural ( bool  y_is_natural,
bool  recompute = true 
)

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.

float BALL::CubicSpline2D::operator() ( float  x,
float  y 
)

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)
inline

Definition at line 194 of file cubicSpline2D.h.

void BALL::CubicSpline2D::setXLowerBounds ( vector< float lb)
inline

Definition at line 207 of file cubicSpline2D.h.

void BALL::CubicSpline2D::setXLowerDerivatives ( vector< float ld,
bool  recompute = true 
)
void BALL::CubicSpline2D::setXUpperBounds ( vector< float ub)
inline

Definition at line 208 of file cubicSpline2D.h.

void BALL::CubicSpline2D::setXUpperDerivatives ( vector< float ud,
bool  recompute = true 
)
void BALL::CubicSpline2D::setYDefaultValue ( float  y_default_value)
inline

Definition at line 197 of file cubicSpline2D.h.

void BALL::CubicSpline2D::setYLowerBound ( float  lb)
inline

Definition at line 201 of file cubicSpline2D.h.

void BALL::CubicSpline2D::setYLowerDerivative ( float  ld,
bool  recompute = true 
)
void BALL::CubicSpline2D::setYUpperBound ( float  ub)
inline

Definition at line 202 of file cubicSpline2D.h.

void BALL::CubicSpline2D::setYUpperDerivative ( float  ud,
bool  recompute = true 
)

Member Data Documentation

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.