1 #ifndef BALL_MATHS_CUBICSPLINE2D_H
2 #define BALL_MATHS_CUBICSPLINE2D_H
7 #ifndef BALL_MATHS_CUBICSPLINE1D_H
11 #ifndef BALL_COMMON_EXCEPTION_H
52 CubicSpline2D(const std::vector<std::vector<
float> >& sample_positions_x,
53 const std::vector<
float>& sample_positions_y,
54 const std::vector<std::vector<
float> >& sample_values,
55 bool return_average = false,
56 bool is_natural = true,
57 const std::vector<
float>& x_lower_derivatives = std::vector<
float>(),
58 const std::vector<
float>& x_upper_derivatives = std::vector<
float>(),
59 float y_lower_derivative = 0.,
60 float y_upper_derivative = 0.,
61 int verbosity = VERBOSITY_LEVEL_DEBUG);
81 CubicSpline2D(const std::vector<std::vector<
float> >& sample_positions_x,
82 const std::vector<
float>& sample_positions_y,
83 const std::vector<std::vector<
float> >& sample_values,
84 const std::vector<
float>& x_default_values,
85 float y_default_value,
86 const std::vector<
float>& x_lower_bounds,
87 const std::vector<
float>& x_upper_bounds,
90 bool is_natural = true,
91 const std::vector<
float>& x_lower_derivatives = std::vector<
float>(),
92 const std::vector<
float>& x_upper_derivatives = std::vector<
float>(),
93 float y_lower_derivative = 0.0,
94 float y_upper_derivative = 0.0,
95 int verbosity = VERBOSITY_LEVEL_DEBUG);
117 CubicSpline2D(const std::vector<
float>& sample_positions_x,
118 const std::vector<
float>& sample_positions_y,
119 const std::vector<std::vector<
float> >& sample_values,
120 bool return_average = false,
121 bool is_natural = true,
122 const std::vector<
float>& x_lower_derivatives = std::vector<
float>(),
123 const std::vector<
float>& x_upper_derivatives = std::vector<
float>(),
124 float y_lower_derivative = 0.,
125 float y_upper_derivative = 0.,
126 int verbosity = VERBOSITY_LEVEL_DEBUG);
144 CubicSpline2D(const std::vector<
float>& sample_positions_x,
145 const std::vector<
float>& sample_positions_y,
146 const std::vector<std::vector<
float> >& sample_values,
147 const std::vector<
float>& x_default_values,
148 float y_default_value,
149 const std::vector<
float>& x_lower_bounds,
150 const std::vector<
float>& x_upper_bounds,
153 bool is_natural = true,
154 const std::vector<
float>& x_lower_derivatives = std::vector<
float>(),
155 const std::vector<
float>& x_upper_derivatives = std::vector<
float>(),
156 float y_lower_derivative = 0.0,
157 float y_upper_derivative = 0.0,
158 int verbosity = VERBOSITY_LEVEL_DEBUG);
163 CubicSpline2D(const CubicSpline2D& cs2D);
167 virtual ~CubicSpline2D();
170 void setVerbosity(
int verbosity);
182 float operator () (
float x,
float y);
187 float getXDefaultValue(
Index x) const;
191 float getYDefaultValue()
const {
return y_default_value_;}
221 float getXLowerBounds(
Index x)
const;
226 float getXUpperBounds(
Index x)
const;
230 bool isXNatural(
Index x);
236 void makeXNatural(
Index x,
bool recompute =
true);
241 void makeAllXNatural(
bool recompute =
true);
247 void makeYNatural(
bool y_is_natural,
bool recompute =
true);
254 void setXLowerDerivatives(vector<float> ld,
bool recompute =
true);
255 void setXUpperDerivatives(vector<float> ud,
bool recompute =
true);
260 float getXLowerDerivatives(
Index x);
265 float getXUpperDerivatives(
Index x);
271 void setYLowerDerivative (
float ld,
bool recompute =
true);
272 void setYUpperDerivative (
float ud,
bool recompute =
true);
301 void createBiCubicSpline();
305 std::vector< std::vector<float> > sample_positions_x_;
308 std::vector<float> sample_positions_y_;
311 std::vector<CubicSpline1D> splines_;
314 std::vector<std::vector<float> > sample_values_;
321 bool return_average_;
328 std::vector<float> x_default_values_;
335 float y_default_value_;
340 float default_value_;
343 vector<float> x_lower_bounds_;
346 vector<float> x_upper_bounds_;
349 float y_lower_bound_;
352 float y_upper_bound_;
356 vector<bool> x_is_natural_;
363 vector<float> x_lower_derivatives_;
366 vector<float> x_upper_derivatives_;
369 float y_lower_derivative_;
372 float y_upper_derivative_;
void setYLowerBound(float lb)
const vector< float > & getXUpperBounds() const
const vector< float > & getXLowerBounds() const
void setXDefaultValues(vector< float > x_default_values)
#define BALL_CREATE(name)
Size getNumberOfSplines() const
vector< bool > isXNatural() const
float getYUpperDerivative()
float getYLowerDerivative()
void setXLowerBounds(vector< float > lb)
vector< float > & getXLowerDerivatives()
void setYDefaultValue(float y_default_value)
void setXUpperBounds(vector< float > ub)
void setYUpperBound(float ub)
static const int VERBOSITY_LEVEL_CRITICAL
static const int VERBOSITY_LEVEL_DEBUG
vector< float > & getXUpperDerivatives()