General purpose curve (can be used for color gradients, animations, etc...)
More...
#include <OxygenEngine/util/curve.h>
|
using | PointType = typename CurveSettingsType::PointType< V, T > |
| Type used as a point on the curve.
|
|
using | ContainerType = typename CurveSettingsType::PointStorageType< PointType > |
| Type used to store all points.
|
|
|
constexpr V | eval (const T x) const noexcept |
| Compute a value on the curve based on its control points.
|
|
template<CurveValueConcept V, CurvePositionConcept T = float, typename CurveSettingsType = CurveSettings>
struct oe::util::Curve< V, T, CurveSettingsType >
General purpose curve (can be used for color gradients, animations, etc...)
Example curve with int as values
});
int32_t result = curve.
eval(0.25);
@ HOLD_LAST
Hold last value.
@ DIRECT
No interpolation, directly switch to this value.
@ LINEAR
Do a linear interpolation between last value and this one.
General purpose curve (can be used for color gradients, animations, etc...)
Definition curve.h:157
constexpr V eval(const T x) const noexcept
Compute a value on the curve based on its control points.
Definition curve.h:175
You can use any type for V, but you need to make sure the class satisfies oe::util::CurveValueConcept
- Note
- It is assumed the container is filled with ascending point
position
- See also
multiple_windows
example for an example of Curve usage to change color depending of the time
-
CurveSettings to customize Point storage / add more interpolation easings
◆ eval()
template<CurveValueConcept V, CurvePositionConcept T = float, typename CurveSettingsType = CurveSettings>
constexpr V oe::util::Curve< V, T, CurveSettingsType >::eval |
( |
const T |
x | ) |
const |
|
inlineconstexprnoexcept |
Compute a value on the curve based on its control points.
- Parameters
-
x | value of the position (any value accepted)
- If x is lower than the first curve point position, the first point value is returned
- If x is greater than the last curve point position, the last point value is returned
- Otherwise an interpolation is done between the points (A,B) found around x
- interpolation options are taken from the point B
|
- Returns
- Interpolated value
The documentation for this struct was generated from the following file: