1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
use std::ops::Bound::Unbounded;
use std::ops::RangeFull;
use na::{Point, Scalar};

use crate::{BBox, PointBounds};

/// Builds a bounding box from a range of points
///
/// # Example
/// ```
/// use std::ops::Bound::Unbounded;
/// use nalgebra::point;
/// use pythagore::BBox;
///
/// assert_eq!(
///     BBox::<i32, 2>::from(..),
///     BBox::from([
///        (Unbounded, Unbounded),
///        (Unbounded, Unbounded),
///     ])
/// )
/// ```
impl<N: Copy + Scalar, const D: usize> From<RangeFull> for BBox<N, D> {
    fn from(_value: RangeFull) -> Self {
        BBox::from([(Unbounded, Unbounded); D])
    }
}

impl<N: Scalar, const D: usize> PointBounds<N, D> for RangeFull {
    #[inline]
    fn start_point(&self) -> Option<Point<N, D>> {
        None
    }

    #[inline]
    fn end_point(&self) -> Option<Point<N, D>> {
        None
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    mod point_bounds {
        use super::*;

        #[test]
        fn test_start_point() {
            assert_eq!(
                (..).start_point(),
                None::<Point<i32, 2>>
            );
        }

        #[test]
        fn test_end_point() {
            assert_eq!(
                (..).end_point(),
                None::<Point<i32, 2>>
            );
        }
    }
}