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

◆ chronological_window()

template<typename T >
std::vector< T > MayaFlux::Kinesis::chronological_window ( const Memory::HistoryBuffer< T > &  history,
size_t  window 
)
inlinenoexcept

Copy the newest window samples out of a history buffer in chronological order.

Template Parameters
TSample type
Parameters
historyBuffer of samples, newest at index 0
windowNumber of samples to take, minimum 2
Returns
Vector with the oldest of those samples first, newest last

The bridge from HistoryBuffer's and Differential's newest-first convention to the chronological order required by functions that compute signed, order-sensitive quantities (path shape, turning, trend) where reversing the input silently negates the answer rather than degrading it.

Definition at line 601 of file Differential.hpp.

603{
604 window = window < 2 ? 2 : window;
605 std::vector<T> out;
606 out.reserve(window);
607 for (size_t i = window; i-- > 0;)
608 out.push_back(history[i]);
609 return out;
610}
std::weak_ptr< Core::Window > window
Definition Picker.cpp:23
std::vector< float > * out

References out, and window.