45template <
typename LatticeT,
typename CellT>
71 template <
typename PositionT>
139 size_t crossings = 0;
140 for (
size_t i = 0; i + 1 <
window; ++i) {
141 if (!(view[i] == view[i + 1]))
166 std::vector<CellT> seen;
168 for (
size_t i = 0; i <
window; ++i) {
170 for (
const auto& s : seen) {
177 seen.push_back(view[i]);
202 size_t best_count = 0;
203 for (
size_t i = 0; i <
window; ++i) {
205 for (
size_t j = 0; j <
window; ++j) {
206 if (view[j] == view[i])
209 if (
count > best_count) {
214 return { best, best_count };
std::optional< glm::vec3 > position
std::weak_ptr< Core::Window > window
const LatticeT & lattice() const
The lattice this trajectory observes positions through.
size_t crossings_in_window(size_t window) const
Crossings within the most recent window observations.
bool update(const PositionT &position)
Observe one new position, updating the cell sequence.
Memory::HistoryBuffer< CellT > m_history
SymbolicTrajectory(LatticeT lattice, size_t window=16)
Construct a trajectory over a given lattice.
const CellT & current_cell() const
Cell the most recent observation fell in.
size_t unique_cells_in_window(size_t window) const
Count of distinct cells visited within the most recent window observations.
size_t crossing_count() const
Total crossings observed since construction or reset()
std::pair< CellT, size_t > dominant_cell(size_t window) const
Cell with the most observations within the most recent window observations.
size_t dwell_count() const
Consecutive observations that have fallen in the current cell.
void reset()
Reset to uninitialized state.
Tracks a moving point's sequence of cells through a lattice partition over time.
std::span< T > linearized_view()
Get mutable linearized view of entire history.
void push(const T &value)
Push new value to front of history.
void reset()
Reset buffer to initial state (all zeros)
size_t capacity() const
Get buffer capacity.
History buffer for difference equations and recursive relations.