bvh2d/
axis.rs

1use crate::Point2;
2use std::ops::Index;
3
4#[derive(Copy, Clone, PartialEq, Eq)]
5pub(crate) enum Axis {
6    X = 0,
7    Y = 1,
8}
9
10impl Index<Axis> for Point2 {
11    type Output = f32;
12
13    #[inline]
14    fn index(&self, axis: Axis) -> &f32 {
15        match axis {
16            Axis::X => &self.x,
17            Axis::Y => &self.y,
18        }
19    }
20}