-
Notifications
You must be signed in to change notification settings - Fork 17
/
CubicSpline.hpp
58 lines (46 loc) · 1.08 KB
/
CubicSpline.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef LEPH_CUBICSPLINE_HPP
#define LEPH_CUBICSPLINE_HPP
#include "Spline.hpp"
namespace Leph {
/**
* CubicSpline
*
* Implementation of 3th order
* polynomial splines
*/
class CubicSpline : public Spline
{
public:
/**
* Add a new point with its time, position value,
* and velocity
*/
void addPoint(double time, double position,
double velocity = 0.0);
private:
/**
* Simple point struture
*/
struct Point {
double time;
double position;
double velocity;
};
/**
* Points container
*/
std::vector<Point> _points;
/**
* Fit a polynom between 0 and t with given
* pos, vel and acc initial and final conditions
*/
Polynom polynomFit(double t,
double pos1, double vel1,
double pos2, double vel2) const;
/**
* Recompute splines interpolation model
*/
void computeSplines();
};
}
#endif