ncollide3d/query/point/
point_shape.rs
1use crate::math::{Isometry, Point};
2use crate::query::{PointProjection, PointQuery};
3use crate::shape::{FeatureId, Shape};
4use na::RealField;
5
6impl<N: RealField + Copy> PointQuery<N> for dyn Shape<N> {
7 #[inline]
8 fn project_point(&self, m: &Isometry<N>, pt: &Point<N>, solid: bool) -> PointProjection<N> {
9 self.as_point_query()
10 .expect("No PointQuery implementation for the underlying shape.")
11 .project_point(m, pt, solid)
12 }
13
14 #[inline]
15 fn project_point_with_feature(
16 &self,
17 m: &Isometry<N>,
18 pt: &Point<N>,
19 ) -> (PointProjection<N>, FeatureId) {
20 self.as_point_query()
21 .expect("No PointQuery implementation for the underlying shape.")
22 .project_point_with_feature(m, pt)
23 }
24
25 #[inline]
26 fn distance_to_point(&self, m: &Isometry<N>, pt: &Point<N>, solid: bool) -> N {
27 self.as_point_query()
28 .expect("No PointQuery implementation for the underlying shape.")
29 .distance_to_point(m, pt, solid)
30 }
31
32 #[inline]
33 fn contains_point(&self, m: &Isometry<N>, pt: &Point<N>) -> bool {
34 self.as_point_query()
35 .expect("No PointQuery implementation for the underlying shape.")
36 .contains_point(m, pt)
37 }
38}