pub trait Shape: RayCast + PointQuery + DowncastSync {
Show 16 methods
fn compute_local_aabb(&self) -> AABB;
fn compute_local_bounding_sphere(&self) -> BoundingSphere;
fn clone_box(&self) -> Box<dyn Shape + 'static, Global>;
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;
fn compute_aabb(
&self,
position: &Isometry<f32, Unit<Quaternion<f32>>, 3_usize>
) -> AABB { ... }
fn compute_bounding_sphere(
&self,
position: &Isometry<f32, Unit<Quaternion<f32>>, 3_usize>
) -> 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_usize>>
) -> Option<Unit<Matrix<f32, Const<{_: usize}>, Const<1_usize>, ArrayStorage<f32, 3_usize, 1_usize>>>> { ... }
fn compute_swept_aabb(
&self,
start_pos: &Isometry<f32, Unit<Quaternion<f32>>, 3_usize>,
end_pos: &Isometry<f32, Unit<Quaternion<f32>>, 3_usize>
) -> AABB { ... }
}
Expand description
Trait implemented by shapes usable by Rapier.
Required methods
fn compute_local_aabb(&self) -> AABB
fn compute_local_aabb(&self) -> AABB
Computes the AABB of this shape.
fn compute_local_bounding_sphere(&self) -> BoundingSphere
fn compute_local_bounding_sphere(&self) -> BoundingSphere
Computes the bounding-sphere of this shape.
Clones this shape into a boxed trait-object.
fn mass_properties(&self, density: f32) -> MassProperties
fn mass_properties(&self, density: f32) -> MassProperties
Compute the mass-properties of this shape given its uniform density.
fn shape_type(&self) -> ShapeType
fn shape_type(&self) -> ShapeType
Gets the type tag of this shape.
fn as_typed_shape(&self) -> TypedShape<'_>
fn as_typed_shape(&self) -> TypedShape<'_>
Gets the underlying shape as an enum.
fn ccd_thickness(&self) -> f32
fn ccd_angular_thickness(&self) -> f32
Provided methods
fn compute_aabb(
&self,
position: &Isometry<f32, Unit<Quaternion<f32>>, 3_usize>
) -> AABB
fn compute_aabb(
&self,
position: &Isometry<f32, Unit<Quaternion<f32>>, 3_usize>
) -> AABB
Computes the AABB of this shape with the given position.
fn compute_bounding_sphere(
&self,
position: &Isometry<f32, Unit<Quaternion<f32>>, 3_usize>
) -> BoundingSphere
fn compute_bounding_sphere(
&self,
position: &Isometry<f32, Unit<Quaternion<f32>>, 3_usize>
) -> BoundingSphere
Computes the bounding-sphere of this shape with the given position.
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.
fn as_support_map(&self) -> Option<&dyn SupportMap>
fn as_support_map(&self) -> Option<&dyn SupportMap>
Convents this shape into its support mapping, if it has one.
fn as_composite_shape(&self) -> Option<&dyn SimdCompositeShape>
fn as_polygonal_feature_map(&self) -> Option<(&dyn PolygonalFeatureMap, f32)>
fn as_polygonal_feature_map(&self) -> Option<(&dyn PolygonalFeatureMap, f32)>
Converts this shape to a polygonal feature-map, if it is one.
The shape’s normal at the given point located on a specific feature.
fn compute_swept_aabb(
&self,
start_pos: &Isometry<f32, Unit<Quaternion<f32>>, 3_usize>,
end_pos: &Isometry<f32, Unit<Quaternion<f32>>, 3_usize>
) -> AABB
fn compute_swept_aabb(
&self,
start_pos: &Isometry<f32, Unit<Quaternion<f32>>, 3_usize>,
end_pos: &Isometry<f32, Unit<Quaternion<f32>>, 3_usize>
) -> 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
Converts this abstract shape to the given shape, if it is one.
Converts this abstract shape to the given mutable shape, if it is one.
Converts this abstract shape to a mutable ball, if it is one.
Converts this abstract shape to a cuboid, if it is one.
Converts this abstract shape to a mutable cuboid, if it is one.
Converts this abstract shape to a halfspace, if it is one.
Converts this abstract shape to a halfspace, if it is one.
Converts this abstract shape to a segment, if it is one.
Converts this abstract shape to a mutable segment, if it is one.
Converts this abstract shape to a capsule, if it is one.
Converts this abstract shape to a mutable capsule, if it is one.
Converts this abstract shape to a triangle, if it is one.
Converts this abstract shape to a mutable triangle, if it is one.
Converts this abstract shape to a compound shape, if it is one.
Converts this abstract shape to a mutable compound shape, if it is one.
Converts this abstract shape to a triangle mesh, if it is one.
Converts this abstract shape to a mutable triangle mesh, if it is one.
Converts this abstract shape to a polyline, if it is one.
Converts this abstract shape to a mutable polyline, if it is one.
Converts this abstract shape to a heightfield, if it is one.
Converts this abstract shape to a mutable heightfield, if it is one.
Converts this abstract shape to a round cuboid, if it is one.
Converts this abstract shape to a mutable round cuboid, if it is one.
Converts this abstract shape to a round triangle, if it is one.
Converts this abstract shape to a round triangle, if it is one.
Converts this abstract shape to a cylinder, if it is one.
Converts this abstract shape to a mutable cylinder, if it is one.
Converts this abstract shape to a mutable cone, if it is one.
Converts this abstract shape to a round cylinder, if it is one.
Converts this abstract shape to a mutable round cylinder, if it is one.
Converts this abstract shape to a round cone, if it is one.
Converts this abstract shape to a mutable round cone, if it is one.
Converts this abstract shape to a round convex polyhedron, if it is one.
pub fn as_round_convex_polyhedron_mut(
&mut self
) -> Option<&mut RoundShape<ConvexPolyhedron>>
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.
Returns true if the trait object wraps an object of type __T
.
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.
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.
Returns a reference to the object within the trait object if it is of type __T
, or
None
if it isn’t.
Returns a mutable reference to the object within the trait object if it is of type
__T
, or None
if it isn’t.