pub trait CompositeShape {
// Required methods
fn map_part_at(
&self,
shape_id: u32,
f: &mut dyn FnMut(Option<&Pose2>, &(dyn Shape + 'static), Option<&(dyn NormalConstraints + 'static)>),
);
fn bvh(&self) -> &Bvh;
}Expand description
Trait implemented by shapes composed of multiple simpler shapes.
A composite shape is composed of several shapes. For example, this can be a convex decomposition of a concave shape; or a triangle-mesh.
This trait is mostly useful for using composite shapes as trait-objects.
For other use-cases, call methods from TypedCompositeShape to avoid
dynamic dispatches instead.
Required Methods§
Sourcefn map_part_at(
&self,
shape_id: u32,
f: &mut dyn FnMut(Option<&Pose2>, &(dyn Shape + 'static), Option<&(dyn NormalConstraints + 'static)>),
)
fn map_part_at( &self, shape_id: u32, f: &mut dyn FnMut(Option<&Pose2>, &(dyn Shape + 'static), Option<&(dyn NormalConstraints + 'static)>), )
Applies a function to one sub-shape of this composite shape.
This method is mostly useful for using composite shapes as trait-objects.
For other use-cases, call methods from TypedCompositeShape to avoid
dynamic dispatches instead.
Note that if your structure also implements TypedCompositeShape, this method
can be implemented simply as:
self.map_untyped_part_at(shape_id, f);Trait Implementations§
Source§impl TypedCompositeShape for dyn CompositeShape + '_
Available on crate feature alloc only.
impl TypedCompositeShape for dyn CompositeShape + '_
alloc only.type PartShape = dyn Shape
type PartNormalConstraints = dyn NormalConstraints
fn map_typed_part_at<T>( &self, shape_id: u32, f: impl FnMut(Option<&Pose2>, &<dyn CompositeShape + '_ as TypedCompositeShape>::PartShape, Option<&<dyn CompositeShape + '_ as TypedCompositeShape>::PartNormalConstraints>) -> T, ) -> Option<T>
fn map_untyped_part_at<T>( &self, shape_id: u32, f: impl FnMut(Option<&Pose2>, &(dyn Shape + 'static), Option<&(dyn NormalConstraints + 'static)>) -> T, ) -> Option<T>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".