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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
use crate::vector3::Vector3D;
use crate::ray3::Ray3D;
use crate::bounding_box3::BoundingBox3D;
pub struct ClosestIntersectionQueryResult3<T> {
pub item: Option<T>,
pub distance: f64,
}
impl<T> ClosestIntersectionQueryResult3<T> {
pub fn new() -> ClosestIntersectionQueryResult3<T> {
return ClosestIntersectionQueryResult3 {
item: None,
distance: f64::MAX,
};
}
}
pub trait ClosestIntersectionDistanceFunc3<T>: FnMut(&T, &Vector3D) -> f64 {}
impl<T, Super: FnMut(&T, &Vector3D) -> f64> ClosestIntersectionDistanceFunc3<T> for Super {}
pub trait BoxIntersectionTestFunc3<T>: FnMut(&T, &BoundingBox3D) -> bool {}
impl<T, Super: FnMut(&T, &BoundingBox3D) -> bool> BoxIntersectionTestFunc3<T> for Super {}
pub trait RayIntersectionTestFunc3<T>: FnMut(&T, &Ray3D) -> bool {}
impl<T, Super: FnMut(&T, &Ray3D) -> bool> RayIntersectionTestFunc3<T> for Super {}
pub trait GetRayIntersectionFunc3<T>: FnMut(&T, &Ray3D) -> f64 {}
impl<T, Super: FnMut(&T, &Ray3D) -> f64> GetRayIntersectionFunc3<T> for Super {}
pub trait IntersectionVisitorFunc3<T>: FnMut(&T) {}
impl<T, Super: FnMut(&T)> IntersectionVisitorFunc3<T> for Super {}
pub trait IntersectionQueryEngine3<T> {
fn intersects_aabb<Callback>(&self, aabb: &BoundingBox3D,
test_func: &mut Callback) -> bool
where Callback: BoxIntersectionTestFunc3<T>;
fn intersects_ray<Callback>(&self, ray: &Ray3D,
test_func: &mut Callback) -> bool
where Callback: RayIntersectionTestFunc3<T>;
fn for_each_intersecting_item_aabb<Callback, Visitor>(&self, aabb: &BoundingBox3D,
test_func: &mut Callback,
visitor_func: &mut Visitor)
where Callback: BoxIntersectionTestFunc3<T>,
Visitor: IntersectionVisitorFunc3<T>;
fn for_each_intersecting_item_ray<Callback, Visitor>(&self, ray: &Ray3D,
test_func: &mut Callback,
visitor_func: &mut Visitor)
where Callback: RayIntersectionTestFunc3<T>,
Visitor: IntersectionVisitorFunc3<T>;
fn closest_intersection<Callback>(&self, ray: &Ray3D,
test_func: &mut Callback) -> ClosestIntersectionQueryResult3<T>
where Callback: GetRayIntersectionFunc3<T>;
}