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
use number_traits::Num; #[derive(Debug, Clone, PartialEq)] pub struct Intersection<T> where T: Copy + Num, { pub edge: usize, pub distance: T, pub point: [T; 2], pub normal: [T; 2], } impl<T> From<(usize, T, [T; 2], [T; 2])> for Intersection<T> where T: Copy + Num, { #[inline(always)] fn from((edge, distance, point, normal): (usize, T, [T; 2], [T; 2])) -> Self { Intersection { edge: edge, distance: distance, point: point, normal: normal, } } } impl<T> Intersection<T> where T: Copy + Num, { #[inline(always)] pub fn new() -> Self { Intersection { edge: 0, distance: T::max_value(), point: [T::zero(); 2], normal: [T::zero(); 2], } } }