Loading...
Searching...
No Matches
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.
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< bool > | isXNatural () 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 ()
CubicSpline1D & | getSpline (Position i)
const CubicSpline1D & | getSpline (Position i) const
Size | getNumberOfSplines () const

## Detailed Description

Definition at line 17 of file cubicSpline2D.h.

## Constructor & Destructor Documentation

## CubicSpline2D() [1/6]

BALL::CubicSpline2D::CubicSpline2D | ( |  | ) |

Default constructor.

## CubicSpline2D() [2/6]

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 {\tt sample_positions_y_} in y direction, increasingly sorted sample positions {\tt sample_positions_x_} in x direction and the corresponding sample values {\tt 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 {\tt return_average_} flag is set to true, the default return values are set to the spline average. If the {\tt is_natural} flag is set to true, all 1D splines and the 1D spline in y direction used in the {\tt operator() } will be natural. Otherwise {\tt x_lower_derivatives} and {\tt x_upper_derivatives} are taken as first derivatives of the first/last sample positions in x direction and {\tt y_lower_derivative} and {\tt 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.

## CubicSpline2D() [3/6]

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 {\tt sample_positions_y_} in y direction, increasingly sorted sample positions {\tt sample_positions_x_} in x direction and the corresponding sample values {\tt sample_values} a 2D spline is created by storing for each y sample position the corresponding 1d spline in x direction.
The {\tt return_average} flag is set to false and the default values {\tt x_default_values_} and {\tt 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 {\tt is_natural} flag is set to true, all 1D splines and the 1D spline in y direction used in the {\tt operator() } will be natural. Otherwise {\tt x_lower_derivatives} and {\tt x_upper_derivatives} are taken as first derivatives of the first/last sample positions in x direction and {\tt y_lower_derivative} and {\tt 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.

## CubicSpline2D() [4/6]

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 {\tt sample_positions_y_} in y direction, increasingly sorted sample positions {\tt sample_positions_x_} in x direction (same for all splines in x direction! ) and the corresponding sample values {\tt 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 {\tt return_average_} flag is set to true, the default return values are set to the spline average. If the {\tt is_natural} flag is set to true, all 1D splines and the 1D spline in y direction used in the {\tt operator() } will be natural. Otherwise {\tt x_lower_derivatives} and {\tt x_upper_derivatives} are taken as first derivatives of the first/last sample positions in x direction and {\tt y_lower_derivative} and {\tt 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.

## CubicSpline2D() [5/6]

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 {\tt sample_positions_y_} in y direction, increasingly sorted sample positions {\tt sample_positions_x_} in x direction and the corresponding sample values {\tt sample_values} a 2D spline is created by storing for each y sample position the corresponding 1d spline in x direction.
The {\tt return_average} flag is set to false and the default values {\tt x_default_values_} and {\tt 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 {\tt is_natural} flag is set to true, all 1D splines and the 1D spline in y direction used in the {\tt operator() } will be natural. Otherwise {\tt x_lower_derivatives} and {\tt x_upper_derivatives} are taken as first derivatives of the first/last sample positions in x direction and {\tt y_lower_derivative} and {\tt 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.

## CubicSpline2D() [6/6]

BALL::CubicSpline2D::CubicSpline2D | ( | const CubicSpline2D & | cs2D | ) |

Copy constructor.

## ~CubicSpline2D()

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

virtual

Destructor.

## Member Function Documentation

## getNumberOfSplines()

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

inline

Definition at line 289 of file cubicSpline2D.h.

## getSpline() [1/2]

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

Return the i-th spline

Exceptions

  Exception::OutOfRange | if i >= getNumberOfSplines()

## getSpline() [2/2]

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

Return the i-th spline

Exceptions

  Exception::OutOfRange | if i >= getNumberOfSplines()

## getXDefaultValue()

float BALL::CubicSpline2D::getXDefaultValue | ( | Index | x | ) | const

Returns the x-th default value in x direction.

Exceptions

  Exception::OutOfRange | if x >= number_of_default_values

## getXLowerBounds() [1/2]

const vector< float > & BALL::CubicSpline2D::getXLowerBounds | ( |  | ) | const

inline

Returns all lower bounds in x direction.

Definition at line 212 of file cubicSpline2D.h.

## getXLowerBounds() [2/2]

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

Get the lower bounds in x direction

Exceptions

  Exception::OutOfRange | if x >= x_lower_bounds_.size()

## getXLowerDerivatives() [1/2]

vector< float > & BALL::CubicSpline2D::getXLowerDerivatives | ( |  | ) |

inline

Definition at line 267 of file cubicSpline2D.h.

## getXLowerDerivatives() [2/2]

float BALL::CubicSpline2D::getXLowerDerivatives | ( | Index | x | ) |

Get the lower derivatives in x direction

Exceptions

  Exception::OutOfRange | if x >= x_lower_derivatives_.size()

## getXUpperBounds() [1/2]

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

inline

Returns all upper bounds in x direction.

Definition at line 216 of file cubicSpline2D.h.

## getXUpperBounds() [2/2]

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

Get the upper bounds in x direction

Exceptions

  Exception::OutOfRange | if x >= x_upper_bounds_.size()

## getXUpperDerivatives() [1/2]

vector< float > & BALL::CubicSpline2D::getXUpperDerivatives | ( |  | ) |

inline

Definition at line 268 of file cubicSpline2D.h.

## getXUpperDerivatives() [2/2]

float BALL::CubicSpline2D::getXUpperDerivatives | ( | Index | x | ) |

Get the upper derivatives in x direction

Exceptions

  Exception::OutOfRange | if x >= x_upper_derivatives_.size()

## getYDefaultValue()

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

inline

Returns the y-th default value in x direction.

Definition at line 191 of file cubicSpline2D.h.

## getYLowerBound()

float BALL::CubicSpline2D::getYLowerBound | ( |  | ) |

inline

Definition at line 204 of file cubicSpline2D.h.

## getYLowerDerivative()

float BALL::CubicSpline2D::getYLowerDerivative | ( |  | ) |

inline

Definition at line 275 of file cubicSpline2D.h.

## getYUpperBound()

float BALL::CubicSpline2D::getYUpperBound | ( |  | ) |

inline

Definition at line 205 of file cubicSpline2D.h.

## getYUpperDerivative()

float BALL::CubicSpline2D::getYUpperDerivative | ( |  | ) |

inline

Definition at line 276 of file cubicSpline2D.h.

## isXNatural() [1/2]

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

inline

Definition at line 231 of file cubicSpline2D.h.

## isXNatural() [2/2]

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.

## isYNatural()

bool BALL::CubicSpline2D::isYNatural | ( |  | ) |

inline

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

Definition at line 251 of file cubicSpline2D.h.

## makeAllXNatural()

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

Sets the flag {\tt 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.

## makeXNatural()

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

Sets the flag {\tt 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.

## makeYNatural()

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

Sets the flag {\tt y_is_natural_} to true. Since the spline in y direction is created for each call of {\tt operator ()} new, recomputation is not necessary.

## operator()()

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

## setVerbosity()

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

Set the verbosity of the spline computation and evaluation.

## setXDefaultValues()

void BALL::CubicSpline2D::setXDefaultValues | ( | vector< float > | x_default_values | ) |

inline

Definition at line 194 of file cubicSpline2D.h.

## setXLowerBounds()

void BALL::CubicSpline2D::setXLowerBounds | ( | vector< float > | lb | ) |

inline

Definition at line 207 of file cubicSpline2D.h.

## setXLowerDerivatives()

void BALL::CubicSpline2D::setXLowerDerivatives | ( | vector< float > | ld,
|  | bool | recompute = true )

## setXUpperBounds()

void BALL::CubicSpline2D::setXUpperBounds | ( | vector< float > | ub | ) |

inline

Definition at line 208 of file cubicSpline2D.h.

## setXUpperDerivatives()

void BALL::CubicSpline2D::setXUpperDerivatives | ( | vector< float > | ud,
|  | bool | recompute = true )

## setYDefaultValue()

void BALL::CubicSpline2D::setYDefaultValue | ( | float | y_default_value | ) |

inline

Definition at line 197 of file cubicSpline2D.h.

## setYLowerBound()

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

inline

Definition at line 201 of file cubicSpline2D.h.

## setYLowerDerivative()

void BALL::CubicSpline2D::setYLowerDerivative | ( | float | ld,
|  | bool | recompute = true )

## setYUpperBound()

void BALL::CubicSpline2D::setYUpperBound | ( | float | ub | ) |

inline

Definition at line 202 of file cubicSpline2D.h.

## setYUpperDerivative()

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

## Member Data Documentation

## VERBOSITY_LEVEL_CRITICAL

const int BALL::CubicSpline2D::VERBOSITY_LEVEL_CRITICAL

static

Definition at line 22 of file cubicSpline2D.h.

## VERBOSITY_LEVEL_DEBUG

const int BALL::CubicSpline2D::VERBOSITY_LEVEL_DEBUG

static

Definition at line 21 of file cubicSpline2D.h.