MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ maximally_even_sequence()

MAYAFLUX_API std::vector< double > MayaFlux::Kinesis::Discrete::maximally_even_sequence ( size_t  pulses,
size_t  steps,
size_t  rotation = 0 
)

The maximally even placement of pulses among steps, as a 0 or 1 table.

Parameters
pulsesNumber of ones
stepsLength of the table
rotationSteps to rotate the start by

Spreads the pulses as evenly as the grid allows, the Euclidean rhythm: (3, 8) gives 1 0 0 1 0 0 1 0. Feed it to step_sequence_state or step_pattern.

Definition at line 201 of file Boolean.cpp.

202{
203 std::vector<double> out(steps, 0.0);
204 if (steps == 0)
205 return out;
206
207 pulses = std::min(pulses, steps);
208 for (size_t i = 0; i < steps; ++i) {
209 const size_t position = (i + rotation) % steps;
210 out[i] = (position * pulses) % steps < pulses ? 1.0 : 0.0;
211 }
212 return out;
213}
std::optional< glm::vec3 > position
Definition Decoder.cpp:93
std::vector< float > * out

References out, and position.