1use crate::math::Point;
2use na::RealField;
3use std::mem;
45/// Closest points information.
6#[derive(Debug, PartialEq, Clone, Copy)]
7#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
8pub enum ClosestPoints<N: RealField + Copy> {
9/// The two objects are intersecting.
10Intersecting,
11/// The two objects are non-intersecting but closer than a given user-defined distance.
12WithinMargin(Point<N>, Point<N>),
13/// The two objects are non-intersecting and further than a given user-defined distance.
14Disjoint,
15}
1617impl<N: RealField + Copy> ClosestPoints<N> {
18/// Swaps the two points.
19pub fn flip(&mut self) {
20if let ClosestPoints::WithinMargin(ref mut p1, ref mut p2) = *self {
21 mem::swap(p1, p2)
22 }
23 }
24}