bevy_rapier3d/geometry/shape_views/
convex_polyhedron.rs

1use crate::math::Vect;
2use rapier::parry::shape::ConvexPolyhedron;
3
4/// Read-only access to the properties of a convex polyhedron.
5#[derive(Copy, Clone)]
6pub struct ConvexPolyhedronView<'a> {
7    /// The raw shape from Rapier.
8    pub raw: &'a ConvexPolyhedron,
9}
10
11impl ConvexPolyhedronView<'_> {
12    /// The vertices of this convex polygon.
13    pub fn points(&self) -> impl ExactSizeIterator<Item = Vect> + '_ {
14        self.raw.points().iter().map(|pt| (*pt).into())
15    }
16
17    // TODO: add retrieval of topology information.
18}
19
20/// Read-write access to the properties of a convex polyhedron.
21pub struct ConvexPolyhedronViewMut<'a> {
22    /// The raw shape from Rapier.
23    pub raw: &'a mut ConvexPolyhedron,
24}
25
26impl ConvexPolyhedronViewMut<'_> {
27    /// The vertices of this convex polygon.
28    pub fn points(&self) -> impl ExactSizeIterator<Item = Vect> + '_ {
29        self.raw.points().iter().map(|pt| (*pt).into())
30    }
31
32    // TODO: add retrieval of topology information and modification.
33}