1#ifndef BASE_BEZIER_H
2#define BASE_BEZIER_H
3
4// Evaluates the Bernstein polynomial of degree 3/a one-dimensional Bezier curve
5//
6// https://en.wikipedia.org/w/index.php?title=Bernstein_polynomial&oldid=965314973
7//
8// f(t) = (1-t)³ a + 3(1-t)²t b + 3(1-t)t² c + t³ d
9class CCubicBezier
10{
11 float a;
12 float b;
13 float c;
14 float d;
15 CCubicBezier(float a_, float b_, float c_, float d_) :
16 a(a_), b(b_), c(c_), d(d_)
17 {
18 }
19
20public:
21 CCubicBezier() {}
22 float Evaluate(float t) const;
23 float Derivative(float t) const;
24 static CCubicBezier With(float Start, float StartDerivative, float EndDerivative, float End);
25};
26
27#endif // BASE_BEZIER_H
28