Trait CompositeShape

Source
pub trait CompositeShape {
    // Required methods
    fn map_part_at(
        &self,
        shape_id: u32,
        f: &mut dyn FnMut(Option<&Isometry<f32>>, &dyn Shape, Option<&dyn NormalConstraints>),
    );
    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§

Source

fn map_part_at( &self, shape_id: u32, f: &mut dyn FnMut(Option<&Isometry<f32>>, &dyn Shape, Option<&dyn NormalConstraints>), )

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);
Source

fn bvh(&self) -> &Bvh

Gets the acceleration structure of the composite shape.

Trait Implementations§

Source§

impl TypedCompositeShape for dyn CompositeShape + '_

Source§

type PartShape = dyn Shape

Source§

type PartNormalConstraints = dyn NormalConstraints

Source§

fn map_typed_part_at<T>( &self, shape_id: u32, f: impl FnMut(Option<&Isometry<f32>>, &Self::PartShape, Option<&Self::PartNormalConstraints>) -> T, ) -> Option<T>

Source§

fn map_untyped_part_at<T>( &self, shape_id: u32, f: impl FnMut(Option<&Isometry<f32>>, &dyn Shape, Option<&dyn NormalConstraints>) -> T, ) -> Option<T>

Implementors§