This commit is contained in:
mischa 2023-07-24 20:04:58 +08:00
parent 7cb6170a50
commit 6395b9e637

View File

@ -12,8 +12,13 @@ public static class HistoryBounds
{ {
// insert current bounds into history. returns new total bounds. // insert current bounds into history. returns new total bounds.
// Queue.Dequeue() always has the oldest bounds. // Queue.Dequeue() always has the oldest bounds.
public static Bounds Insert(Queue<Bounds> history, int limit, Bounds bounds) public static Bounds Insert(
Queue<Bounds> history,
int limit,
Bounds bounds)
{ {
// optimization: only insert if
// remove oldest if limit reached // remove oldest if limit reached
if (history.Count >= limit) if (history.Count >= limit)
history.Dequeue(); history.Dequeue();
@ -31,15 +36,5 @@ public static Bounds Insert(Queue<Bounds> history, int limit, Bounds bounds)
return total; return total;
} }
// TODO .bounds that wraps past N bounds
// TODO fast data structure to always .encapsulate latest and .remove oldest
// TODO update:
// - capture bounds every few seconds
// - build new totalBounds only when capturing, not every .totalBounds call
// TODO runtime debug gizmo
} }
} }