parry3d/query/point/
point_round_shape.rs

1use crate::math::Vector;
2#[cfg(feature = "alloc")]
3use crate::query::gjk::VoronoiSimplex;
4use crate::query::{PointProjection, PointQuery};
5use crate::shape::{FeatureId, RoundShape, SupportMap};
6
7// TODO: if PointQuery had a `project_point_with_normal` method, we could just
8// call this and adjust the projected point accordingly.
9impl<S: SupportMap> PointQuery for RoundShape<S> {
10    #[inline]
11    #[allow(unreachable_code)]
12    #[allow(clippy::diverging_sub_expression)]
13    fn project_local_point(&self, _point: Vector, _solid: bool) -> PointProjection {
14        #[cfg(not(feature = "alloc"))]
15        return unimplemented!(
16            "The projection of points on a round shape isn't supported without alloc yet."
17        );
18
19        #[cfg(feature = "alloc")]
20        return crate::query::details::local_point_projection_on_support_map(
21            self,
22            &mut VoronoiSimplex::new(),
23            _point,
24            _solid,
25        );
26    }
27
28    #[inline]
29    fn project_local_point_and_get_feature(&self, point: Vector) -> (PointProjection, FeatureId) {
30        (self.project_local_point(point, false), FeatureId::Unknown)
31    }
32}