Nebula
Loading...
Searching...
No Matches
curves.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
10namespace Math
11{
12
13template<class POINT>
15{
16 BezierCubic(POINT pp0, POINT pp1, POINT pp2, POINT pp3) { Set(pp0, pp1, pp2, pp3); }
17 void Set(POINT pp0, POINT pp1, POINT pp2, POINT pp3) { p0 = pp0; p3 = pp3; s1 = pp1*3.0f - pp0 - pp3; s2 = pp2*3.0f - pp3 - pp0; }
18 POINT Eval(float t)
19 {
20 POINT p03 = lerp(p0, p3, t);
21 POINT s12 = lerp(s1, s2, t);
22 return lerp(p03, s12, 1.0f - t);
23 }
24
25 POINT p0, p3, s1, s2;
26};
27
28};
Different curves.
Definition angularpfeedbackloop.h:17
__forceinline float lerp(float x, float y, float l)
Linearly interpolate between 2 values: ret = x + l * (y - x)
Definition scalar.h:597
Definition curves.h:15
BezierCubic(POINT pp0, POINT pp1, POINT pp2, POINT pp3)
Definition curves.h:16
POINT p0
Definition curves.h:25
POINT p3
Definition curves.h:25
void Set(POINT pp0, POINT pp1, POINT pp2, POINT pp3)
Definition curves.h:17
POINT s2
Definition curves.h:25
POINT s1
Definition curves.h:25
POINT Eval(float t)
Definition curves.h:18