1#![forbid(unsafe_code)]
2#![doc = include_str!("../README.md")]
3
4use use_point::Point2;
5
6#[derive(Debug, Clone, Copy, PartialEq)]
8pub enum Intersection2 {
9 None,
11 Point(Point2),
13 Overlap,
15 Infinite,
17}
18
19impl Intersection2 {
20 #[must_use]
22 pub const fn is_empty(self) -> bool {
23 matches!(self, Self::None)
24 }
25}
26
27pub trait Intersects<Rhs = Self> {
29 fn intersects(&self, rhs: &Rhs) -> bool;
31}
32
33#[cfg(test)]
34mod tests {
35 use super::Intersection2;
36 use use_point::Point2;
37
38 #[test]
39 fn classifies_empty_and_point_intersections() {
40 assert!(Intersection2::None.is_empty());
41 assert!(!Intersection2::Point(Point2::new(1.0, 2.0)).is_empty());
42 }
43}