DDNet documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
bezier.h
Go to the documentation of this file.
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
9
class
CCubicBezier
10
{
11
float
a
;
12
float
b
;
13
float
c
;
14
float
d
;
15
constexpr
CCubicBezier
(
float
a_,
float
b_,
float
c_,
float
d_) :
16
a
(a_),
b
(b_),
c
(c_),
d
(d_)
17
{
18
}
19
20
public
:
21
constexpr
CCubicBezier
() =
default
;
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
CCubicBezier::c
float c
Definition
bezier.h:13
CCubicBezier::b
float b
Definition
bezier.h:12
CCubicBezier::Derivative
float Derivative(float t) const
Definition
bezier.cpp:15
CCubicBezier::CCubicBezier
constexpr CCubicBezier()=default
CCubicBezier::With
static CCubicBezier With(float Start, float StartDerivative, float EndDerivative, float End)
Definition
bezier.cpp:3
CCubicBezier::a
float a
Definition
bezier.h:11
CCubicBezier::Evaluate
float Evaluate(float t) const
Definition
bezier.cpp:9
CCubicBezier::d
float d
Definition
bezier.h:14
CCubicBezier::CCubicBezier
constexpr CCubicBezier(float a_, float b_, float c_, float d_)
Definition
bezier.h:15
src
base
bezier.h
Generated by
1.18.0