pixled-lib  1.0
Public Member Functions | List of all members
pixled::signal::Sine Class Reference

#include <signal.h>

Inheritance diagram for pixled::signal::Sine:
Inheritance graph
[legend]
Collaboration diagram for pixled::signal::Sine:
Collaboration graph
[legend]

Public Member Functions

float operator() (led l, time t) const override
 
- Public Member Functions inherited from pixled::Function< Sine, 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< Sine, 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< Sine, float, float >
base::Function< float > * copy () const override
 
- Protected Attributes inherited from pixled::Function< Sine, float, float >
std::tuple< const FctWrapper< Args >... > args
 

Detailed Description

Sine wave function.

Values returned are contained in [-1, 1].

+ and * operators can be used to modulate the Sine wave as required. For example, to obtain values in [0, 16]:

8.f * (1.f + Sine(...))

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:

a + (b * Sine(...))

Since the specified parameter is a pixled base::Function<float>, many type of waves can be defined.

The spatial parameter X() might be replaced by Y(), or by any other coordinate dependent function. For example, to obtain a radial sine wave that originates from the point (8, 8):

Sine(
Distance(Point(X(), Y()), point(8, 8)) / lambda - T() / period
)

See the pixled/signal/sine.cpp example below for concrete use cases of each wave type.

Notice that, as usual, lambda and period might themselves by space and time dependent Functions...

Parameters
floatsin parameter
Return values
floatsin(2*PI * this->call<0>(p, t))
Examples
pixled/signal/sine.cpp, and pixled/signal/triangle.cpp.

Member Function Documentation

◆ operator()()

float pixled::signal::Sine::operator() ( led  l,
time  t 
) const
overridevirtual

Computes the value of this Function for led l at time t.

Parameters
lled
ttime
Returns
Result of this Function, evaluated on led 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 >.


The documentation for this class was generated from the following files: