sightloom_core/event.rs
1//! Compact public event vocabulary for zone monitors.
2
3use crate::{TrackId, ZoneId};
4
5/// The direction in which a track crossed a directed line segment.
6#[derive(Clone, Copy, Debug, Eq, PartialEq)]
7pub enum Direction {
8 /// The track moved from the line's algebraic left half-plane to its right.
9 LeftToRight,
10 /// The track moved from the line's algebraic right half-plane to its left.
11 RightToLeft,
12}
13
14/// A membership or crossing transition observed for a track and zone.
15#[derive(Clone, Copy, Debug, Eq, PartialEq)]
16pub enum VisionEvent {
17 /// A track entered a polygon zone.
18 Entered {
19 /// The track that entered.
20 track_id: TrackId,
21 /// The polygon zone that was entered.
22 zone_id: ZoneId,
23 },
24 /// A track exited a polygon zone.
25 Exited {
26 /// The track that exited.
27 track_id: TrackId,
28 /// The polygon zone that was exited.
29 zone_id: ZoneId,
30 },
31 /// A track crossed a finite line zone.
32 Crossed {
33 /// The track that crossed.
34 track_id: TrackId,
35 /// The line zone that was crossed.
36 zone_id: ZoneId,
37 /// The crossing direction relative to the directed line segment.
38 direction: Direction,
39 },
40}