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>;
}