BALL 1.5.0
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_DATATYPE_OPTIONS_H
13#endif
14
15namespace BALL
16{
17
19 {
20 public:
21
22 static const int VERBOSITY_LEVEL_DEBUG;
23 static const int VERBOSITY_LEVEL_CRITICAL;
24
28
30
31
32
35
48 CubicSpline1D(const std::vector<float>& sample_positions,
49 const std::vector<float>& sample_values,
50 bool return_average = false,
51 bool is_natural = true,
52 float lower_derivative = 0.0,
53 float upper_derivative = 0.0,
54 int verbosity = VERBOSITY_LEVEL_DEBUG);
55
68 CubicSpline1D(const std::vector<float>& sample_positions,
69 const std::vector<float>& sample_values,
70 float default_value,
71 bool is_natural = true,
72 float lower_derivative = 0.0,
73 float upper_derivative = 0.0,
74 int verbosity = VERBOSITY_LEVEL_DEBUG);
75
88 CubicSpline1D(const std::vector<float>& sample_positions,
89 const std::vector<float>& sample_values,
90 float default_value,
91 float lower_bound,
92 float upper_bound,
93 bool is_natural = true,
94 float lower_derivative = 0.0,
95 float upper_derivative = 0.0,
96 int verbosity = VERBOSITY_LEVEL_DEBUG);
97
110 CubicSpline1D(const std::vector<float>& sample_positions,
111 const std::vector<float>& sample_values,
112 float lower_bound,
113 float upper_bound,
114 bool return_average = false,
115 float default_value = std::numeric_limits<float>::min(),
116 bool is_natural = true,
117 float lower_derivative = 0.0,
118 float upper_derivative = 0.0,
119 int verbosity = VERBOSITY_LEVEL_DEBUG);
120
121
125
128 virtual ~CubicSpline1D();
129
131 void setVerbosity(int verbosity) { verbosity_ = verbosity; }
132
134 int getVerbosity() const { return verbosity_; }
135
143 float operator () (float x);
144
147 std::vector<float> getCurvature() const {return curvature_;}
148
155 void setCurvature(std::vector<float> curvature);
156
161 void setValues(std::vector<float> values, bool recompute = true);
162
165 std::vector<float> getValues() const {return sample_values_;}
166
169 std::vector<float> getPositions() const {return sample_positions_;}
170
175 void setPositions(std::vector<float> positions, bool recompute = true);
176
179 void setDefaultValue(float value) {default_value_ = value;}
180 float getDefaultValue() const {return default_value_;}
181
186 void setLowerBound(float lb) {lower_bound_ = lb;}
187 void setUpperBound(float ub) {upper_bound_ = ub;}
188
191 float getLowerBound() const {return lower_bound_;}
192 float getUpperBound() const {return upper_bound_;}
193
195 bool isNatural() const {return is_natural_;}
196
200 void makeNatural(bool recompute = true);
201
206 void setBoudaryDerivatives(float lower_derivative, float upper_derivative, bool recompute = true);
207
213 void setLowerDerivative(float derivative, bool recompute = true);
214
216 float getLowerDerivative() const {return lower_derivative_;}
217
223 void setUpperDerivative(float derivative, bool recompute = true);
224
226 float getUpperDerivative() const {return upper_derivative_;}
227
228 private :
229
235 void createSpline();
236
237 // Sample positions of the spline.
238 std::vector<float> sample_positions_;
239 // Sample values of the spline.
240 std::vector<float> sample_values_;
241 // Curvature of the spline.
242 std::vector<float> curvature_;
243
244 // Flag to denote, if the default values should be set to the average
245 bool return_average_;
246
251 float default_value_;
252
253 // Lower bound of the spline
254 float lower_bound_;
255
256 // Upper bound of the spline
257 float upper_bound_;
258
259 // Flag to denote, if the spline is natural
260 bool is_natural_;
261
262 // Value of the first derivative of the lower sample position
263 float lower_derivative_;
264
265 // Value of the first derivative of the upper sample position
266 float upper_derivative_;
267
269 int verbosity_;
270 };
271
272}
273#endif
#define BALL_CREATE(name)
Definition: create.h:62
STL namespace.
Definition: constants.h:13
T min(const T &a, const T &b)
Definition: MATHS/common.h:102
bool isNatural() const
int getVerbosity() const
void setBoudaryDerivatives(float lower_derivative, float upper_derivative, bool recompute=true)
void setLowerDerivative(float derivative, bool recompute=true)
void setValues(std::vector< float > values, bool recompute=true)
void setLowerBound(float lb)
void setPositions(std::vector< float > positions, bool recompute=true)
static const int VERBOSITY_LEVEL_DEBUG
Definition: cubicSpline1D.h:22
float getUpperDerivative() const
void setUpperBound(float ub)
void makeNatural(bool recompute=true)
void setDefaultValue(float value)
float getUpperBound() const
std::vector< float > getCurvature() const
void setUpperDerivative(float derivative, bool recompute=true)
float getLowerDerivative() const
std::vector< float > getPositions() const
void setCurvature(std::vector< float > curvature)
std::vector< float > getValues() const
static const int VERBOSITY_LEVEL_CRITICAL
Definition: cubicSpline1D.h:23
float getDefaultValue() const
float getLowerBound() const
#define BALL_EXPORT
Definition: COMMON/global.h:50