parry3d_f64/bounding_volume/aabb_support_map.rs
1use crate::bounding_volume;
2use crate::bounding_volume::Aabb;
3use crate::math::{Isometry, Real};
4use crate::shape::Segment;
5#[cfg(feature = "dim3")]
6use crate::shape::{Cone, Cylinder};
7
8#[cfg(feature = "dim3")]
9impl Cone {
10 /// Computes the world-space [`Aabb`] of this cone, transformed by `pos`.
11 #[inline]
12 pub fn aabb(&self, pos: &Isometry<Real>) -> Aabb {
13 bounding_volume::details::support_map_aabb(pos, self)
14 }
15
16 /// Computes the local-space [`Aabb`] of this cone.
17 #[inline]
18 pub fn local_aabb(&self) -> Aabb {
19 bounding_volume::details::local_support_map_aabb(self)
20 }
21}
22
23#[cfg(feature = "dim3")]
24impl Cylinder {
25 /// Computes the world-space [`Aabb`] of this cylinder, transformed by `pos`.
26 #[inline]
27 pub fn aabb(&self, pos: &Isometry<Real>) -> Aabb {
28 bounding_volume::details::support_map_aabb(pos, self)
29 }
30
31 /// Computes the local-space [`Aabb`] of this cylinder.
32 #[inline]
33 pub fn local_aabb(&self) -> Aabb {
34 bounding_volume::details::local_support_map_aabb(self)
35 }
36}
37
38impl Segment {
39 /// Computes the world-space [`Aabb`] of this segment, transformed by `pos`.
40 #[inline]
41 pub fn aabb(&self, pos: &Isometry<Real>) -> Aabb {
42 self.transformed(pos).local_aabb()
43 }
44
45 /// Computes the local-space [`Aabb`] of this segment.
46 #[inline]
47 pub fn local_aabb(&self) -> Aabb {
48 bounding_volume::details::local_support_map_aabb(self)
49 }
50}