pixled-lib
1.0
|
#include <signal.h>
Public Member Functions | |
float | operator() (led l, time t) const override |
Public Member Functions inherited from pixled::Function< Square, float, float > | |
Function (Fcts &&... fcts) | |
const base::Function< typename std::tuple_element< i, decltype(args)>::type::Type > & | arg () const |
std::tuple_element< i, decltype(args)>::type::Type | call (led l, time t) const |
Additional Inherited Members | |
Public Types inherited from pixled::Function< Square, float, float > | |
using | Type = typename base::Function< float >::Type |
Public Types inherited from pixled::base::Function< R > | |
typedef R | Type |
Protected Member Functions inherited from pixled::Function< Square, float, float > | |
base::Function< float > * | copy () const override |
Protected Attributes inherited from pixled::Function< Square, float, float > | |
std::tuple< const FctWrapper< Args >... > | args |
Square wave function.
Values returned are contained in [-1, 1]
.
+
and *
operators can be used to modulate the Square wave as required. For example, to obtain values in [0, 16]
:
More generally, to obtain values centered around a, with an amplitude of b, i.e. in [a-b, a+b]
, so the total variation is 2*b
, use the following formula:
Differrent type of waves can be defined as for the Sine function.
float | square function parameter |
float | sin(2*PI * this->call<0>(p, t)) > 0 ? 1 : -1 |
Computes the value of this Function for led l
at time t
.
l | led |
t | time |
l
at time t
. Notice that evaluating a function usually requires the recursive evaluation of other Functions (that are actually parameters of this function) until a Constant is reached for example. Implements pixled::base::Function< R >.