BALL  1.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
cubicSpline1D.h
Go to the documentation of this file.
1 #ifndef BALL_MATHS_CUBICSPLINE1D_H
2 #define BALL_MATHS_CUBICSPLINE1D_H
3 
4 #include <set>
5 #include <map>
6 
7 #ifndef BALL_COMMON_H
8 # include <BALL/common.h>
9 #endif
10 
11 #ifndef BALL_COMMON_LIMITS_H
12 # include <BALL/COMMON/limits.h>
13 #endif
14 
15 #ifndef BALL_DATATYPE_OPTIONS_H
16 # include <BALL/DATATYPE/options.h>
17 #endif
18 
19 namespace BALL
20 {
21 
23  {
24  public:
25 
26  static const int VERBOSITY_LEVEL_DEBUG;
27  static const int VERBOSITY_LEVEL_CRITICAL;
28 
32 
34 
35 
36 
38  CubicSpline1D();
39 
52  CubicSpline1D(const std::vector<float>& sample_positions,
53  const std::vector<float>& sample_values,
54  bool return_average = false,
55  bool is_natural = true,
56  float lower_derivative = 0.0,
57  float upper_derivative = 0.0,
58  int verbosity = VERBOSITY_LEVEL_DEBUG);
59 
72  CubicSpline1D(const std::vector<float>& sample_positions,
73  const std::vector<float>& sample_values,
74  float default_value,
75  bool is_natural = true,
76  float lower_derivative = 0.0,
77  float upper_derivative = 0.0,
78  int verbosity = VERBOSITY_LEVEL_DEBUG);
79 
92  CubicSpline1D(const std::vector<float>& sample_positions,
93  const std::vector<float>& sample_values,
94  float default_value,
95  float lower_bound,
96  float upper_bound,
97  bool is_natural = true,
98  float lower_derivative = 0.0,
99  float upper_derivative = 0.0,
100  int verbosity = VERBOSITY_LEVEL_DEBUG);
101 
114  CubicSpline1D(const std::vector<float>& sample_positions,
115  const std::vector<float>& sample_values,
116  float lower_bound,
117  float upper_bound,
118  bool return_average = false,
119  float default_value = std::numeric_limits<float>::min(),
120  bool is_natural = true,
121  float lower_derivative = 0.0,
122  float upper_derivative = 0.0,
123  int verbosity = VERBOSITY_LEVEL_DEBUG);
124 
125 
128  CubicSpline1D(const CubicSpline1D& cs1D);
129 
132  virtual ~CubicSpline1D();
133 
135  void setVerbosity(int verbosity) { verbosity_ = verbosity; }
136 
138  int getVerbosity() const { return verbosity_; }
139 
147  float operator () (float x);
148 
151  std::vector<float> getCurvature() const {return curvature_;}
152 
159  void setCurvature(std::vector<float> curvature);
160 
165  void setValues(std::vector<float> values, bool recompute = true);
166 
169  std::vector<float> getValues() const {return sample_values_;}
170 
173  std::vector<float> getPositions() const {return sample_positions_;}
174 
179  void setPositions(std::vector<float> positions, bool recompute = true);
180 
183  void setDefaultValue(float value) {default_value_ = value;}
184  float getDefaultValue() const {return default_value_;}
185 
190  void setLowerBound(float lb) {lower_bound_ = lb;}
191  void setUpperBound(float ub) {upper_bound_ = ub;}
192 
195  float getLowerBound() const {return lower_bound_;}
196  float getUpperBound() const {return upper_bound_;}
197 
199  bool isNatural() const {return is_natural_;}
200 
204  void makeNatural(bool recompute = true);
205 
210  void setBoudaryDerivatives(float lower_derivative, float upper_derivative, bool recompute = true);
211 
217  void setLowerDerivative(float derivative, bool recompute = true);
218 
220  float getLowerDerivative() const {return lower_derivative_;}
221 
227  void setUpperDerivative(float derivative, bool recompute = true);
228 
230  float getUpperDerivative() const {return upper_derivative_;}
231 
232  private :
233 
239  void createSpline();
240 
241  // Sample positions of the spline.
242  std::vector<float> sample_positions_;
243  // Sample values of the spline.
244  std::vector<float> sample_values_;
245  // Curvature of the spline.
246  std::vector<float> curvature_;
247 
248  // Flag to denote, if the default values should be set to the average
250 
256 
257  // Lower bound of the spline
259 
260  // Upper bound of the spline
262 
263  // Flag to denote, if the spline is natural
265 
266  // Value of the first derivative of the lower sample position
268 
269  // Value of the first derivative of the upper sample position
271 
274  };
275 
276 }
277 #endif