Class gme::gradient::Curve
ClassList > gme > gradient > Curve
Abstract interface for normalized curve evaluation. More...
#include <Curve.h>
Inherited by the following classes: gme::gradient::BezierCurve, gme::gradient::EaseInCurve, gme::gradient::EaseOutCurve, gme::gradient::LinearCurve, gme::gradient::ResampledCurve, gme::gradient::SCurve, gme::gradient::ScaledCurve, gme::gradient::SigmoidCurve
Public Functions
| Type | Name |
|---|---|
| Curve (const Curve &) = delete |
|
| Curve (Curve &&) = default |
|
| virtual double | evaluate (double t) const = 0 Evaluate the curve at normalized progress t . |
| Curve & | operator= (const Curve &) = delete |
| Curve & | operator= (Curve &&) = default |
| virtual | ~Curve () = default Virtual destructor — required for safe polymorphic deletion. |
Protected Functions
| Type | Name |
|---|---|
| Curve () = default |
Detailed Description
A Curve maps a normalized progress value t in [0.0, 1.0] to a normalized output value in [0.0, 1.0]. This is the single coupling point for the entire gme::gradient module: all concrete curve types, decorators (ScaledCurve, ResampledCurve, CrossfadePair), and the CurveFactory return objects that satisfy this interface.
Input clamping: Every concrete implementation MUST clamp t to [0.0, 1.0] before performing its computation. The interface does not perform clamping itself so that subclass implementations retain full control over their evaluation paths without paying an extra branch. Callers may pass any double; the contract guarantees the result is defined for all inputs.
Boundary postconditions: For all concrete types provided by this module, evaluate(0.0) == 0.0 and evaluate(1.0) == 1.0.
Thread safety: evaluate() is safe to call from a single thread. Concurrent calls on the same instance from multiple threads require external synchronisation. No concrete implementation in gme::gradient uses mutable state inside evaluate(), but this is not part of the interface contract.
Ownership: Decorators (ScaledCurve, CrossfadePair) take ownership of their wrapped Curve via std::unique_ptr< Curve >. Copy construction is deleted to prevent accidental slicing; move construction is defaulted to allow unique_ptr ownership transfer.
// Typical usage — instantiate a concrete subclass and call evaluate():
#include "gradient/LinearCurve.h"
gme::gradient::LinearCurve lc;
double mid = lc.evaluate(0.5); // returns 0.5
double clamped = lc.evaluate(-1.0); // clamped to 0.0 → returns 0.0
Public Functions Documentation
function Curve [1/3]
gme::gradient::Curve::Curve (
const Curve &
) = delete
function Curve [2/3]
gme::gradient::Curve::Curve (
Curve &&
) = default
function evaluate
Evaluate the curve at normalized progress t .
virtual double gme::gradient::Curve::evaluate (
double t
) const = 0
Parameters:
tNormalized progress. Nominally in [0.0, 1.0]; values outside this range MUST be clamped to [0.0, 1.0] by the implementation.
Returns:
Normalized output value in [0.0, 1.0].
function operator=
Curve & gme::gradient::Curve::operator= (
const Curve &
) = delete
function operator=
Curve & gme::gradient::Curve::operator= (
Curve &&
) = default
function ~Curve
Virtual destructor — required for safe polymorphic deletion.
virtual gme::gradient::Curve::~Curve () = default
Protected Functions Documentation
function Curve [3/3]
gme::gradient::Curve::Curve () = default
The documentation for this class was generated from the following file src/gradient/Curve.h