Trait rapier3d::geometry::Shape

source ·
pub trait Shape: RayCast + PointQuery + DowncastSync {
Show 16 methods // Required methods fn compute_local_aabb(&self) -> Aabb; fn compute_local_bounding_sphere(&self) -> BoundingSphere; fn clone_box(&self) -> Box<dyn Shape>; fn mass_properties(&self, density: f32) -> MassProperties; fn shape_type(&self) -> ShapeType; fn as_typed_shape(&self) -> TypedShape<'_>; fn ccd_thickness(&self) -> f32; fn ccd_angular_thickness(&self) -> f32; // Provided methods fn compute_aabb( &self, position: &Isometry<f32, Unit<Quaternion<f32>>, 3> ) -> Aabb { ... } fn compute_bounding_sphere( &self, position: &Isometry<f32, Unit<Quaternion<f32>>, 3> ) -> BoundingSphere { ... } fn is_convex(&self) -> bool { ... } fn as_support_map(&self) -> Option<&dyn SupportMap> { ... } fn as_composite_shape(&self) -> Option<&dyn SimdCompositeShape> { ... } fn as_polygonal_feature_map( &self ) -> Option<(&dyn PolygonalFeatureMap, f32)> { ... } fn feature_normal_at_point( &self, _feature: FeatureId, _point: &OPoint<f32, Const<3>> ) -> Option<Unit<Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>>> { ... } fn compute_swept_aabb( &self, start_pos: &Isometry<f32, Unit<Quaternion<f32>>, 3>, end_pos: &Isometry<f32, Unit<Quaternion<f32>>, 3> ) -> Aabb { ... }
}
Expand description

Trait implemented by shapes usable by Rapier.

Required Methods§

source

fn compute_local_aabb(&self) -> Aabb

Computes the Aabb of this shape.

source

fn compute_local_bounding_sphere(&self) -> BoundingSphere

Computes the bounding-sphere of this shape.

source

fn clone_box(&self) -> Box<dyn Shape>

Clones this shape into a boxed trait-object.

source

fn mass_properties(&self, density: f32) -> MassProperties

Compute the mass-properties of this shape given its uniform density.

source

fn shape_type(&self) -> ShapeType

Gets the type tag of this shape.

source

fn as_typed_shape(&self) -> TypedShape<'_>

Gets the underlying shape as an enum.

source

fn ccd_thickness(&self) -> f32

source

fn ccd_angular_thickness(&self) -> f32

Provided Methods§

source

fn compute_aabb( &self, position: &Isometry<f32, Unit<Quaternion<f32>>, 3> ) -> Aabb

Computes the Aabb of this shape with the given position.

source

fn compute_bounding_sphere( &self, position: &Isometry<f32, Unit<Quaternion<f32>>, 3> ) -> BoundingSphere

Computes the bounding-sphere of this shape with the given position.

source

fn is_convex(&self) -> bool

Is this shape known to be convex?

If this returns true then self is known to be convex. If this returns false then it is not known whether or not self is convex.

source

fn as_support_map(&self) -> Option<&dyn SupportMap>

Convents this shape into its support mapping, if it has one.

source

fn as_composite_shape(&self) -> Option<&dyn SimdCompositeShape>

source

fn as_polygonal_feature_map(&self) -> Option<(&dyn PolygonalFeatureMap, f32)>

Converts this shape to a polygonal feature-map, if it is one.

source

fn feature_normal_at_point( &self, _feature: FeatureId, _point: &OPoint<f32, Const<3>> ) -> Option<Unit<Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>>>

The shape’s normal at the given point located on a specific feature.

source

fn compute_swept_aabb( &self, start_pos: &Isometry<f32, Unit<Quaternion<f32>>, 3>, end_pos: &Isometry<f32, Unit<Quaternion<f32>>, 3> ) -> Aabb

Computes the swept Aabb of this shape, i.e., the space it would occupy by moving from the given start position to the given end position.

Implementations§

source§

impl dyn Shape

source

pub fn is<__T>(&self) -> bool
where __T: Shape,

Returns true if the trait object wraps an object of type __T.

source

pub fn downcast<__T>(self: Box<dyn Shape>) -> Result<Box<__T>, Box<dyn Shape>>
where __T: Shape,

Returns a boxed object from a boxed trait object if the underlying object is of type __T. Returns the original boxed trait if it isn’t.

source

pub fn downcast_rc<__T>(self: Rc<dyn Shape>) -> Result<Rc<__T>, Rc<dyn Shape>>
where __T: Shape,

Returns an Rc-ed object from an Rc-ed trait object if the underlying object is of type __T. Returns the original Rc-ed trait if it isn’t.

source

pub fn downcast_ref<__T>(&self) -> Option<&__T>
where __T: Shape,

Returns a reference to the object within the trait object if it is of type __T, or None if it isn’t.

source

pub fn downcast_mut<__T>(&mut self) -> Option<&mut __T>
where __T: Shape,

Returns a mutable reference to the object within the trait object if it is of type __T, or None if it isn’t.

source

pub fn downcast_arc<__T>( self: Arc<dyn Shape> ) -> Result<Arc<__T>, Arc<dyn Shape>>
where __T: Shape + Any + Send + Sync,

Returns an Arc-ed object from an Arc-ed trait object if the underlying object is of type __T. Returns the original Arc-ed trait if it isn’t.

source§

impl dyn Shape

source

pub fn as_shape<T>(&self) -> Option<&T>
where T: Shape,

Converts this abstract shape to the given shape, if it is one.

source

pub fn as_shape_mut<T>(&mut self) -> Option<&mut T>
where T: Shape,

Converts this abstract shape to the given mutable shape, if it is one.

source

pub fn as_ball(&self) -> Option<&Ball>

Converts this abstract shape to a ball, if it is one.

source

pub fn as_ball_mut(&mut self) -> Option<&mut Ball>

Converts this abstract shape to a mutable ball, if it is one.

source

pub fn as_cuboid(&self) -> Option<&Cuboid>

Converts this abstract shape to a cuboid, if it is one.

source

pub fn as_cuboid_mut(&mut self) -> Option<&mut Cuboid>

Converts this abstract shape to a mutable cuboid, if it is one.

source

pub fn as_halfspace(&self) -> Option<&HalfSpace>

Converts this abstract shape to a halfspace, if it is one.

source

pub fn as_halfspace_mut(&mut self) -> Option<&mut HalfSpace>

Converts this abstract shape to a halfspace, if it is one.

source

pub fn as_segment(&self) -> Option<&Segment>

Converts this abstract shape to a segment, if it is one.

source

pub fn as_segment_mut(&mut self) -> Option<&mut Segment>

Converts this abstract shape to a mutable segment, if it is one.

source

pub fn as_capsule(&self) -> Option<&Capsule>

Converts this abstract shape to a capsule, if it is one.

source

pub fn as_capsule_mut(&mut self) -> Option<&mut Capsule>

Converts this abstract shape to a mutable capsule, if it is one.

source

pub fn as_triangle(&self) -> Option<&Triangle>

Converts this abstract shape to a triangle, if it is one.

source

pub fn as_triangle_mut(&mut self) -> Option<&mut Triangle>

Converts this abstract shape to a mutable triangle, if it is one.

source

pub fn as_compound(&self) -> Option<&Compound>

Converts this abstract shape to a compound shape, if it is one.

source

pub fn as_compound_mut(&mut self) -> Option<&mut Compound>

Converts this abstract shape to a mutable compound shape, if it is one.

source

pub fn as_trimesh(&self) -> Option<&GenericTriMesh<DefaultStorage>>

Converts this abstract shape to a triangle mesh, if it is one.

source

pub fn as_trimesh_mut(&mut self) -> Option<&mut GenericTriMesh<DefaultStorage>>

Converts this abstract shape to a mutable triangle mesh, if it is one.

source

pub fn as_polyline(&self) -> Option<&Polyline>

Converts this abstract shape to a polyline, if it is one.

source

pub fn as_polyline_mut(&mut self) -> Option<&mut Polyline>

Converts this abstract shape to a mutable polyline, if it is one.

source

pub fn as_heightfield(&self) -> Option<&GenericHeightField<DefaultStorage>>

Converts this abstract shape to a heightfield, if it is one.

source

pub fn as_heightfield_mut( &mut self ) -> Option<&mut GenericHeightField<DefaultStorage>>

Converts this abstract shape to a mutable heightfield, if it is one.

source

pub fn as_round_cuboid(&self) -> Option<&RoundShape<Cuboid>>

Converts this abstract shape to a round cuboid, if it is one.

source

pub fn as_round_cuboid_mut(&mut self) -> Option<&mut RoundShape<Cuboid>>

Converts this abstract shape to a mutable round cuboid, if it is one.

source

pub fn as_round_triangle(&self) -> Option<&RoundShape<Triangle>>

Converts this abstract shape to a round triangle, if it is one.

source

pub fn as_round_triangle_mut(&mut self) -> Option<&mut RoundShape<Triangle>>

Converts this abstract shape to a round triangle, if it is one.

source

pub fn as_convex_polyhedron(&self) -> Option<&ConvexPolyhedron>

source

pub fn as_convex_polyhedron_mut(&mut self) -> Option<&mut ConvexPolyhedron>

source

pub fn as_cylinder(&self) -> Option<&Cylinder>

Converts this abstract shape to a cylinder, if it is one.

source

pub fn as_cylinder_mut(&mut self) -> Option<&mut Cylinder>

Converts this abstract shape to a mutable cylinder, if it is one.

source

pub fn as_cone(&self) -> Option<&Cone>

Converts this abstract shape to a cone, if it is one.

source

pub fn as_cone_mut(&mut self) -> Option<&mut Cone>

Converts this abstract shape to a mutable cone, if it is one.

source

pub fn as_round_cylinder(&self) -> Option<&RoundShape<Cylinder>>

Converts this abstract shape to a round cylinder, if it is one.

source

pub fn as_round_cylinder_mut(&mut self) -> Option<&mut RoundShape<Cylinder>>

Converts this abstract shape to a mutable round cylinder, if it is one.

source

pub fn as_round_cone(&self) -> Option<&RoundShape<Cone>>

Converts this abstract shape to a round cone, if it is one.

source

pub fn as_round_cone_mut(&mut self) -> Option<&mut RoundShape<Cone>>

Converts this abstract shape to a mutable round cone, if it is one.

source

pub fn as_round_convex_polyhedron( &self ) -> Option<&RoundShape<ConvexPolyhedron>>

Converts this abstract shape to a round convex polyhedron, if it is one.

source

pub fn as_round_convex_polyhedron_mut( &mut self ) -> Option<&mut RoundShape<ConvexPolyhedron>>

Converts this abstract shape to a mutable round convex polyhedron, if it is one.

Trait Implementations§

source§

impl AsRef<dyn Shape> for SharedShape

source§

fn as_ref(&self) -> &(dyn Shape + 'static)

Converts this type into a shared reference of the (usually inferred) input type.

Implementors§