Brunot
Loading...
Searching...
No Matches
th::Bezier Struct Reference

#include <Bezier.h>

Public Member Functions

 Bezier ()=default
 Bezier (Vector4D handle1, Vector4D handle2)
auto operator() (float t) -> float
 evaluates the bezier at a point along the curve.
template<typename P>
auto operator() (float t, const P &begin, const P &end) -> P
 interpolates between 2 values, using the bezier curve just calls value
auto value (float t) -> float
 evaluetates the bezier at a single point along it's curve
template<typename P>
auto value (float t, const P &start, const P &end) -> P
 interpolates between 2 values, using the bezier curve
auto data () -> float *
 pointer to raw memory of bezier, for editors purposes

Private Attributes

float handles [4] = {0.455f, 0.030f, 0.515f, 0.955f}
 the handles for the curve, in order, x1, y1, x2, y2. Defaults to InOut Quadradic Easing
float selectedPreset = 0.f
 Extra float for use by imgui_bezier editor. If we refactor imgui_bezier, we might not need this.

Friends

auto to_json (json &j, const Bezier &n) ->void
auto from_json (const json &j, Bezier &n) ->void

Constructor & Destructor Documentation

◆ Bezier() [1/2]

th::Bezier::Bezier ( )
default
Here is the caller graph for this function:

◆ Bezier() [2/2]

th::Bezier::Bezier ( Vector4D handle1,
Vector4D handle2 )

Member Function Documentation

◆ data()

auto th::Bezier::data ( ) ->float *

pointer to raw memory of bezier, for editors purposes

Returns
a pointer to the beginning of the handles array, with an extra float at the end

◆ operator()() [1/2]

auto th::Bezier::operator() ( float t) ->float

evaluates the bezier at a point along the curve.

equivalent to bezier.value(t);

Parameters
thow far into the curve to sample, range [0,1]
Returns
the y value of the curve, range [0,1]
Here is the call graph for this function:

◆ operator()() [2/2]

template<typename P>
auto th::Bezier::operator() ( float t,
const P & begin,
const P & end )->P
inline

interpolates between 2 values, using the bezier curve just calls value

Template Parameters
Pthe type of the value to lerp between
Parameters
thow far into the curve to sample, range [0,1]
startthe value to start at
endthe value to end at
Returns
A new interpolated value, range [start, end]
Here is the call graph for this function:

◆ value() [1/2]

auto th::Bezier::value ( float t) ->float

evaluetates the bezier at a single point along it's curve

Parameters
thow far into the curve to sample, range [0,1]
Returns
the y value of the curve, range [0,1]
Here is the call graph for this function:
Here is the caller graph for this function:

◆ value() [2/2]

template<typename P>
auto th::Bezier::value ( float t,
const P & start,
const P & end )->P
inline

interpolates between 2 values, using the bezier curve

Template Parameters
Pthe type of the value to lerp between
Parameters
thow far into the curve to sample, range [0,1]
startthe value to start at
endthe value to end at
Returns
A new interpolated value, range [start, end]
Here is the call graph for this function:

◆ from_json

auto from_json ( const json & j,
Bezier & n )->void
friend

◆ to_json

auto to_json ( json & j,
const Bezier & n )->void
friend

Member Data Documentation

◆ handles

float th::Bezier::handles[4] = {0.455f, 0.030f, 0.515f, 0.955f}
private

the handles for the curve, in order, x1, y1, x2, y2. Defaults to InOut Quadradic Easing

◆ selectedPreset

float th::Bezier::selectedPreset = 0.f
private

Extra float for use by imgui_bezier editor. If we refactor imgui_bezier, we might not need this.


The documentation for this struct was generated from the following files:
  • /home/egrazil/sites/Brunot/The House/source/Utility/Math/Bezier.h
  • /home/egrazil/sites/Brunot/The House/source/Utility/Math/Bezier.cpp