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
use crate::{access, clone, geom::Side};
#[derive(Clone)]
pub struct Hit<T> {
tag: T,
dist: f64,
side: Side,
}
impl<T> Hit<T> {
access!(tag, T);
clone!(dist, dist_mut, f64);
access!(side, Side);
#[inline]
#[must_use]
pub fn new(tag: T, dist: f64, side: Side) -> Self {
debug_assert!(dist > 0.0);
Self { tag, dist, side }
}
#[inline]
pub fn flip_side(&mut self) {
let s = self.side.clone().flip();
self.side = s;
}
}