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::vector2::Vector2D;
use crate::ray2::Ray2D;
use crate::bounding_box2::BoundingBox2D;
pub struct ClosestIntersectionQueryResult2<T> {
pub item: Option<T>,
pub distance: f64,
}
impl<T> ClosestIntersectionQueryResult2<T> {
pub fn new() -> ClosestIntersectionQueryResult2<T> {
return ClosestIntersectionQueryResult2 {
item: None,
distance: f64::MAX,
};
}
}
pub trait ClosestIntersectionDistanceFunc2<T>: FnMut(&T, &Vector2D) -> f64 {}
impl<T, Super: FnMut(&T, &Vector2D) -> f64> ClosestIntersectionDistanceFunc2<T> for Super {}
pub trait BoxIntersectionTestFunc2<T>: FnMut(&T, &BoundingBox2D) -> bool {}
impl<T, Super: FnMut(&T, &BoundingBox2D) -> bool> BoxIntersectionTestFunc2<T> for Super {}
pub trait RayIntersectionTestFunc2<T>: FnMut(&T, &Ray2D) -> bool {}
impl<T, Super: FnMut(&T, &Ray2D) -> bool> RayIntersectionTestFunc2<T> for Super {}
pub trait GetRayIntersectionFunc2<T>: FnMut(&T, &Ray2D) -> f64 {}
impl<T, Super: FnMut(&T, &Ray2D) -> f64> GetRayIntersectionFunc2<T> for Super {}
pub trait IntersectionVisitorFunc2<T>: FnMut(&T) {}
impl<T, Super: FnMut(&T)> IntersectionVisitorFunc2<T> for Super {}
pub trait IntersectionQueryEngine2<T> {
fn intersects_aabb<Callback>(&self, aabb: &BoundingBox2D,
test_func: &mut Callback) -> bool
where Callback: BoxIntersectionTestFunc2<T>;
fn intersects_ray<Callback>(&self, ray: &Ray2D,
test_func: &mut Callback) -> bool
where Callback: RayIntersectionTestFunc2<T>;
fn for_each_intersecting_item_aabb<Callback, Visitor>(&self, aabb: &BoundingBox2D,
test_func: &mut Callback,
visitor_func: &mut Visitor)
where Callback: BoxIntersectionTestFunc2<T>,
Visitor: IntersectionVisitorFunc2<T>;
fn for_each_intersecting_item_ray<Callback, Visitor>(&self, ray: &Ray2D,
test_func: &mut Callback,
visitor_func: &mut Visitor)
where Callback: RayIntersectionTestFunc2<T>,
Visitor: IntersectionVisitorFunc2<T>;
fn closest_intersection<Callback>(&self, ray: &Ray2D,
test_func: &mut Callback) -> ClosestIntersectionQueryResult2<T>
where Callback: GetRayIntersectionFunc2<T>;
}