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

◆ crossings_in_window()

template<typename LatticeT , typename CellT >
size_t MayaFlux::Kinesis::SymbolicTrajectory< LatticeT, CellT >::crossings_in_window ( size_t  window) const
inline

Crossings within the most recent window observations.

Parameters
windowNumber of recent observations to examine, clamped to the trajectory's retained history capacity
Returns
Count of adjacent-pair differences within the window

Distinct from crossing_count(): this only looks at the retained window, so it answers "how much boundary-crossing has happened recently" rather than "how much has happened ever."

Definition at line 132 of file SymbolicTrajectory.hpp.

133 {
134 window = std::min(window, m_history.capacity());
135 if (window < 2)
136 return 0;
137
138 const auto view = m_history.linearized_view();
139 size_t crossings = 0;
140 for (size_t i = 0; i + 1 < window; ++i) {
141 if (!(view[i] == view[i + 1]))
142 ++crossings;
143 }
144 return crossings;
145 }
std::weak_ptr< Core::Window > window
Definition Picker.cpp:23
Memory::HistoryBuffer< CellT > m_history
std::span< T > linearized_view()
Get mutable linearized view of entire history.
size_t capacity() const
Get buffer capacity.

References MayaFlux::Memory::HistoryBuffer< T >::capacity(), MayaFlux::Memory::HistoryBuffer< T >::linearized_view(), MayaFlux::Kinesis::SymbolicTrajectory< LatticeT, CellT >::m_history, and window.

+ Here is the call graph for this function: