Skip to main content

warden_vision/geometry/
position.rs

1//! Named anchor points on a bounding box, used by annotators to decide
2//! where on a detection to place a dot, label, or trace point.
3
4/// A named anchor position on a bounding box (or, for
5/// [`Position::CenterOfMass`], on a detection's mask polygon).
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
7pub enum Position {
8    /// Center of the box.
9    #[default]
10    Center,
11    /// Vertical center, left edge.
12    CenterLeft,
13    /// Vertical center, right edge.
14    CenterRight,
15    /// Horizontal center, top edge.
16    TopCenter,
17    /// Top-left corner.
18    TopLeft,
19    /// Top-right corner.
20    TopRight,
21    /// Horizontal center, bottom edge.
22    BottomCenter,
23    /// Bottom-left corner.
24    BottomLeft,
25    /// Bottom-right corner.
26    BottomRight,
27    /// Centroid of the detection's mask polygon, if it has one; falls back
28    /// to [`Position::Center`] otherwise.
29    CenterOfMass,
30}