![]() |
ProtoTracer
1.0
Real-time 3D rendering and animation engine
|
A class to generate various waveform functions with customizable parameters. More...
#include <FunctionGenerator.h>
Public Types | |
enum | Function { Triangle , Square , Sine , Sawtooth , Gravity } |
Enumerates the supported wave functions. More... | |
Public Member Functions | |
FunctionGenerator (Function function, float minimum, float maximum, float period) | |
Constructor to initialize the FunctionGenerator with parameters. | |
void | SetPeriod (float period) |
Sets the period of the waveform. | |
void | SetFunction (Function function) |
Sets the waveform function. | |
float | Update () |
Updates and calculates the next value of the waveform. | |
Private Member Functions | |
float | TriangleWave (float ratio) |
Generates a triangle wave value. | |
float | SquareWave (float ratio) |
Generates a square wave value. | |
float | SineWave (float ratio) |
Generates a sine wave value. | |
float | SawtoothWave (float ratio) |
Generates a sawtooth wave value. | |
float | GravityFunction (float ratio) |
Generates a gravity-like function value. | |
Private Attributes | |
Function | function |
Current waveform function. | |
float | minimum = 0.0f |
Minimum value of the waveform. | |
float | maximum = 0.0f |
Maximum value of the waveform. | |
float | period = 0.0f |
Period of the waveform. | |
A class to generate various waveform functions with customizable parameters.
Definition at line 19 of file FunctionGenerator.h.
Enumerates the supported wave functions.
Enumerator | |
---|---|
Triangle | Triangle waveform. |
Square | Square waveform. |
Sine | Sine waveform. |
Sawtooth | Sawtooth waveform. |
Gravity | Gravity-like function. |
Definition at line 25 of file FunctionGenerator.h.
FunctionGenerator | ( | Function | function, |
float | minimum, | ||
float | maximum, | ||
float | period | ||
) |
Constructor to initialize the FunctionGenerator with parameters.
function | The waveform function to use. |
minimum | The minimum value of the waveform. |
maximum | The maximum value of the waveform. |
period | The period of the waveform. |
Definition at line 3 of file FunctionGenerator.cpp.
Generates a gravity-like function value.
ratio | The input ratio (0 to 1). |
Definition at line 57 of file FunctionGenerator.cpp.
Referenced by Update().
Generates a sawtooth wave value.
ratio | The input ratio (0 to 1). |
Definition at line 53 of file FunctionGenerator.cpp.
References Mathematics::Map(), maximum, and minimum.
Referenced by Update().
Sets the waveform function.
function | The new waveform function. |
Definition at line 14 of file FunctionGenerator.cpp.
References function.
Sets the period of the waveform.
period | The new period. |
Definition at line 10 of file FunctionGenerator.cpp.
References period.
Referenced by ProtogenProject::SetWiggleSpeed().
Generates a sine wave value.
ratio | The input ratio (0 to 1). |
Definition at line 48 of file FunctionGenerator.cpp.
References Mathematics::Map(), maximum, and minimum.
Referenced by Update().
Generates a square wave value.
ratio | The input ratio (0 to 1). |
Definition at line 43 of file FunctionGenerator.cpp.
References Mathematics::Map(), maximum, and minimum.
Referenced by Update().
Generates a triangle wave value.
ratio | The input ratio (0 to 1). |
Definition at line 38 of file FunctionGenerator.cpp.
References Mathematics::Map(), maximum, and minimum.
Referenced by Update().
float Update | ( | ) |
Updates and calculates the next value of the waveform.
Definition at line 18 of file FunctionGenerator.cpp.
References function, Gravity, GravityFunction(), period, Sawtooth, SawtoothWave(), Sine, SineWave(), Square, SquareWave(), Triangle, and TriangleWave().
Referenced by Fisheye::ApplyEffect(), PhaseOffsetR::ApplyEffect(), PhaseOffsetX::ApplyEffect(), PhaseOffsetY::ApplyEffect(), RadialBlur::ApplyEffect(), ShiftR::ApplyEffect(), Test::ApplyEffect(), XenraxAnimation::Battery(), ProtogenProject::GetWiggleOffset(), XenraxAnimation::Hearts(), XenraxAnimation::Hypno(), DrGonzoProject::Loading(), SergaliciousAnimation::Loading(), DrGonzoProject::Sad(), Warzone2Animation::Sleep(), XenraxAnimation::Sleeping(), AlphaAnimation::SpyroDisplay(), SageAnimation::Tired(), Boot::Update(), FlowNoise::Update(), RainbowNoise::Update(), RainbowNoise2::Update(), RainbowSpiral::Update(), TVStatic::Update(), AphoriAnimation::Update(), ArtleckAnimationV2::Update(), BasilGardenAnimation::Update(), BroookAnimation::Update(), WaffleDaProtoAnimation::Update(), ElGatoAnimation::Update(), GalaxyAnimation::Update(), HertzzAnimation::Update(), InfraredAnimation::Update(), LeonHuskyAnimation::Update(), MyntAnimation::Update(), ProtobottAnimation::Update(), SammyAnimation::Update(), SergaliciousAnimation::Update(), StrawberryAnimation::Update(), TamamoAnimation::Update(), TechSaneAnimation::Update(), VesperAnimation::Update(), WarzoneAnimation::Update(), Warzone2Animation::Update(), XenraxAnimation::Update(), ClockAnimation::Update(), AlphaAnimation::Update(), BetaProject::Update(), GammaAnimation::Update(), HUB75AnimationSplit::Update(), WS35AnimationSplit::Update(), ArtisansAnimation::Update(), BeeAnimation::Update(), CoelaBonkAnimation::Update(), CoelaNerdAnimation::Update(), CreeperAnimation::Update(), CubeAnimation::Update(), FullScreenAnimation::Update(), NukudeFaceAnimation::Update(), PikachuAnimation::Update(), RocksAnimation::Update(), SpyroAnimation::Update(), SpyroRotateAnimation::Update(), VectorFieldAnimation::Update(), and ProtogenProject::UpdateFace().
|
private |
Current waveform function.
Definition at line 34 of file FunctionGenerator.h.
Referenced by FunctionGenerator(), SetFunction(), and Update().
|
private |
Maximum value of the waveform.
Definition at line 36 of file FunctionGenerator.h.
Referenced by FunctionGenerator(), SawtoothWave(), SineWave(), SquareWave(), and TriangleWave().
|
private |
Minimum value of the waveform.
Definition at line 35 of file FunctionGenerator.h.
Referenced by FunctionGenerator(), SawtoothWave(), SineWave(), SquareWave(), and TriangleWave().
|
private |
Period of the waveform.
Definition at line 37 of file FunctionGenerator.h.
Referenced by FunctionGenerator(), SetPeriod(), and Update().