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

◆ tabulate()

std::vector< double > MayaFlux::Kinesis::tabulate ( const Tendency< double, double > &  f,
size_t  count,
double  from = -1.0,
double  to = 1.0 
)
inline

Sample a tendency at evenly spaced points into an array.

Parameters
fScalar tendency to sample
countNumber of points; zero gives an empty array, one gives f(from)
fromFirst point of the domain
toLast point of the domain
Returns
f at count points from from to to inclusive

The bridge from a curve designed with chain, combine, lerp and the scalar factories to an array: table_lookup reads such a table over [-1, 1], and TimeMaps::piecewise_linear over time.

Definition at line 222 of file Tendency.hpp.

224{
225 std::vector<double> table(count);
226 for (size_t i = 0; i < count; ++i) {
227 const double t = count > 1
228 ? from + (to - from) * static_cast<double>(i) / static_cast<double>(count - 1)
229 : from;
230 table[i] = f(t);
231 }
232 return table;
233}
size_t count

References count.