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
use crate::bounding_volume::AABB;
use crate::math::{Point, Real};
use crate::query::{PointProjection, PointQuery};
use crate::shape::{Cuboid, FeatureId};
impl PointQuery for Cuboid {
#[inline]
fn project_local_point(&self, pt: &Point<Real>, solid: bool) -> PointProjection {
let dl = Point::from(-self.half_extents);
let ur = Point::from(self.half_extents);
AABB::new(dl, ur).project_local_point(pt, solid)
}
#[inline]
fn project_local_point_and_get_feature(
&self,
pt: &Point<Real>,
) -> (PointProjection, FeatureId) {
let dl = Point::from(-self.half_extents);
let ur = Point::from(self.half_extents);
AABB::new(dl, ur).project_local_point_and_get_feature(pt)
}
#[inline]
fn distance_to_local_point(&self, pt: &Point<Real>, solid: bool) -> Real {
let dl = Point::from(-self.half_extents);
let ur = Point::from(self.half_extents);
AABB::new(dl, ur).distance_to_local_point(pt, solid)
}
#[inline]
fn contains_local_point(&self, pt: &Point<Real>) -> bool {
let dl = Point::from(-self.half_extents);
let ur = Point::from(self.half_extents);
AABB::new(dl, ur).contains_local_point(pt)
}
}