#![forbid(unsafe_code)]
#![doc = include_str!("../README.md")]
use use_point::Point2;
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Intersection2 {
None,
Point(Point2),
Overlap,
Infinite,
}
impl Intersection2 {
#[must_use]
pub const fn is_empty(self) -> bool {
matches!(self, Self::None)
}
}
pub trait Intersects<Rhs = Self> {
fn intersects(&self, rhs: &Rhs) -> bool;
}
#[cfg(test)]
mod tests {
use super::Intersection2;
use use_point::Point2;
#[test]
fn classifies_empty_and_point_intersections() {
assert!(Intersection2::None.is_empty());
assert!(!Intersection2::Point(Point2::new(1.0, 2.0)).is_empty());
}
}