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: Real) -> MassProperties;
fn shape_type(&self) -> ShapeType;
fn as_typed_shape(&self) -> TypedShape<'_>;
fn ccd_thickness(&self) -> Real;
fn ccd_angular_thickness(&self) -> Real;
// Provided methods
fn compute_aabb(&self, position: &Isometry<Real>) -> Aabb { ... }
fn compute_bounding_sphere(
&self,
position: &Isometry<Real>
) -> 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, Real)> { ... }
fn feature_normal_at_point(
&self,
_feature: FeatureId,
_point: &Point<Real>
) -> Option<Unit<Vector<Real>>> { ... }
fn compute_swept_aabb(
&self,
start_pos: &Isometry<Real>,
end_pos: &Isometry<Real>
) -> Aabb { ... }
}
Expand description
Trait implemented by shapes usable by Rapier.
Required Methods§
sourcefn compute_local_aabb(&self) -> Aabb
fn compute_local_aabb(&self) -> Aabb
Computes the Aabb
of this shape.
sourcefn compute_local_bounding_sphere(&self) -> BoundingSphere
fn compute_local_bounding_sphere(&self) -> BoundingSphere
Computes the bounding-sphere of this shape.
sourcefn mass_properties(&self, density: Real) -> MassProperties
fn mass_properties(&self, density: Real) -> MassProperties
Compute the mass-properties of this shape given its uniform density.
sourcefn shape_type(&self) -> ShapeType
fn shape_type(&self) -> ShapeType
Gets the type tag of this shape.
sourcefn as_typed_shape(&self) -> TypedShape<'_>
fn as_typed_shape(&self) -> TypedShape<'_>
Gets the underlying shape as an enum.
fn ccd_thickness(&self) -> Real
fn ccd_angular_thickness(&self) -> Real
Provided Methods§
sourcefn compute_aabb(&self, position: &Isometry<Real>) -> Aabb
fn compute_aabb(&self, position: &Isometry<Real>) -> Aabb
Computes the Aabb
of this shape with the given position.
sourcefn compute_bounding_sphere(&self, position: &Isometry<Real>) -> BoundingSphere
fn compute_bounding_sphere(&self, position: &Isometry<Real>) -> BoundingSphere
Computes the bounding-sphere of this shape with the given position.
sourcefn is_convex(&self) -> bool
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.
sourcefn 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>
sourcefn as_polygonal_feature_map(&self) -> Option<(&dyn PolygonalFeatureMap, Real)>
fn as_polygonal_feature_map(&self) -> Option<(&dyn PolygonalFeatureMap, Real)>
Converts this shape to a polygonal feature-map, if it is one.
Implementations§
source§impl dyn Shape
impl dyn Shape
sourcepub fn is<__T: Shape>(&self) -> bool
pub fn is<__T: Shape>(&self) -> bool
Returns true if the trait object wraps an object of type __T
.
sourcepub fn downcast<__T: Shape>(self: Box<Self>) -> Result<Box<__T>, Box<Self>>
pub fn downcast<__T: Shape>(self: Box<Self>) -> Result<Box<__T>, Box<Self>>
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.
sourcepub fn downcast_rc<__T: Shape>(self: Rc<Self>) -> Result<Rc<__T>, Rc<Self>>
pub fn downcast_rc<__T: Shape>(self: Rc<Self>) -> Result<Rc<__T>, Rc<Self>>
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.
sourcepub fn downcast_ref<__T: Shape>(&self) -> Option<&__T>
pub fn downcast_ref<__T: Shape>(&self) -> Option<&__T>
Returns a reference to the object within the trait object if it is of type __T
, or
None
if it isn’t.
sourcepub fn downcast_mut<__T: Shape>(&mut self) -> Option<&mut __T>
pub fn downcast_mut<__T: Shape>(&mut self) -> Option<&mut __T>
Returns a mutable reference to the object within the trait object if it is of type
__T
, or None
if it isn’t.
source§impl dyn Shape
impl dyn Shape
sourcepub fn as_shape<T: Shape>(&self) -> Option<&T>
pub fn as_shape<T: Shape>(&self) -> Option<&T>
Converts this abstract shape to the given shape, if it is one.
sourcepub fn as_shape_mut<T: Shape>(&mut self) -> Option<&mut T>
pub fn as_shape_mut<T: Shape>(&mut self) -> Option<&mut T>
Converts this abstract shape to the given mutable shape, if it is one.
sourcepub fn as_ball_mut(&mut self) -> Option<&mut Ball>
pub fn as_ball_mut(&mut self) -> Option<&mut Ball>
Converts this abstract shape to a mutable ball, if it is one.
sourcepub fn as_cuboid(&self) -> Option<&Cuboid>
pub fn as_cuboid(&self) -> Option<&Cuboid>
Converts this abstract shape to a cuboid, if it is one.
sourcepub fn as_cuboid_mut(&mut self) -> Option<&mut Cuboid>
pub fn as_cuboid_mut(&mut self) -> Option<&mut Cuboid>
Converts this abstract shape to a mutable cuboid, if it is one.
sourcepub fn as_halfspace(&self) -> Option<&HalfSpace>
pub fn as_halfspace(&self) -> Option<&HalfSpace>
Converts this abstract shape to a halfspace, if it is one.
sourcepub fn as_halfspace_mut(&mut self) -> Option<&mut HalfSpace>
pub fn as_halfspace_mut(&mut self) -> Option<&mut HalfSpace>
Converts this abstract shape to a halfspace, if it is one.
sourcepub fn as_segment(&self) -> Option<&Segment>
pub fn as_segment(&self) -> Option<&Segment>
Converts this abstract shape to a segment, if it is one.
sourcepub fn as_segment_mut(&mut self) -> Option<&mut Segment>
pub fn as_segment_mut(&mut self) -> Option<&mut Segment>
Converts this abstract shape to a mutable segment, if it is one.
sourcepub fn as_capsule(&self) -> Option<&Capsule>
pub fn as_capsule(&self) -> Option<&Capsule>
Converts this abstract shape to a capsule, if it is one.
sourcepub fn as_capsule_mut(&mut self) -> Option<&mut Capsule>
pub fn as_capsule_mut(&mut self) -> Option<&mut Capsule>
Converts this abstract shape to a mutable capsule, if it is one.
sourcepub fn as_triangle(&self) -> Option<&Triangle>
pub fn as_triangle(&self) -> Option<&Triangle>
Converts this abstract shape to a triangle, if it is one.
sourcepub fn as_triangle_mut(&mut self) -> Option<&mut Triangle>
pub fn as_triangle_mut(&mut self) -> Option<&mut Triangle>
Converts this abstract shape to a mutable triangle, if it is one.
sourcepub fn as_compound(&self) -> Option<&Compound>
pub fn as_compound(&self) -> Option<&Compound>
Converts this abstract shape to a compound shape, if it is one.
sourcepub fn as_compound_mut(&mut self) -> Option<&mut Compound>
pub fn as_compound_mut(&mut self) -> Option<&mut Compound>
Converts this abstract shape to a mutable compound shape, if it is one.
sourcepub fn as_trimesh(&self) -> Option<&TriMesh>
pub fn as_trimesh(&self) -> Option<&TriMesh>
Converts this abstract shape to a triangle mesh, if it is one.
sourcepub fn as_trimesh_mut(&mut self) -> Option<&mut TriMesh>
pub fn as_trimesh_mut(&mut self) -> Option<&mut TriMesh>
Converts this abstract shape to a mutable triangle mesh, if it is one.
sourcepub fn as_polyline(&self) -> Option<&Polyline>
pub fn as_polyline(&self) -> Option<&Polyline>
Converts this abstract shape to a polyline, if it is one.
sourcepub fn as_polyline_mut(&mut self) -> Option<&mut Polyline>
pub fn as_polyline_mut(&mut self) -> Option<&mut Polyline>
Converts this abstract shape to a mutable polyline, if it is one.
sourcepub fn as_heightfield(&self) -> Option<&HeightField>
pub fn as_heightfield(&self) -> Option<&HeightField>
Converts this abstract shape to a heightfield, if it is one.
sourcepub fn as_heightfield_mut(&mut self) -> Option<&mut HeightField>
pub fn as_heightfield_mut(&mut self) -> Option<&mut HeightField>
Converts this abstract shape to a mutable heightfield, if it is one.
sourcepub fn as_round_cuboid(&self) -> Option<&RoundCuboid>
pub fn as_round_cuboid(&self) -> Option<&RoundCuboid>
Converts this abstract shape to a round cuboid, if it is one.
sourcepub fn as_round_cuboid_mut(&mut self) -> Option<&mut RoundCuboid>
pub fn as_round_cuboid_mut(&mut self) -> Option<&mut RoundCuboid>
Converts this abstract shape to a mutable round cuboid, if it is one.
sourcepub fn as_round_triangle(&self) -> Option<&RoundTriangle>
pub fn as_round_triangle(&self) -> Option<&RoundTriangle>
Converts this abstract shape to a round triangle, if it is one.
sourcepub fn as_round_triangle_mut(&mut self) -> Option<&mut RoundTriangle>
pub fn as_round_triangle_mut(&mut self) -> Option<&mut RoundTriangle>
Converts this abstract shape to a round triangle, if it is one.
pub fn as_convex_polyhedron(&self) -> Option<&ConvexPolyhedron>
pub fn as_convex_polyhedron_mut(&mut self) -> Option<&mut ConvexPolyhedron>
sourcepub fn as_cylinder(&self) -> Option<&Cylinder>
pub fn as_cylinder(&self) -> Option<&Cylinder>
Converts this abstract shape to a cylinder, if it is one.
sourcepub fn as_cylinder_mut(&mut self) -> Option<&mut Cylinder>
pub fn as_cylinder_mut(&mut self) -> Option<&mut Cylinder>
Converts this abstract shape to a mutable cylinder, if it is one.
sourcepub fn as_cone_mut(&mut self) -> Option<&mut Cone>
pub fn as_cone_mut(&mut self) -> Option<&mut Cone>
Converts this abstract shape to a mutable cone, if it is one.
sourcepub fn as_round_cylinder(&self) -> Option<&RoundCylinder>
pub fn as_round_cylinder(&self) -> Option<&RoundCylinder>
Converts this abstract shape to a round cylinder, if it is one.
sourcepub fn as_round_cylinder_mut(&mut self) -> Option<&mut RoundCylinder>
pub fn as_round_cylinder_mut(&mut self) -> Option<&mut RoundCylinder>
Converts this abstract shape to a mutable round cylinder, if it is one.
sourcepub fn as_round_cone(&self) -> Option<&RoundCone>
pub fn as_round_cone(&self) -> Option<&RoundCone>
Converts this abstract shape to a round cone, if it is one.
sourcepub fn as_round_cone_mut(&mut self) -> Option<&mut RoundCone>
pub fn as_round_cone_mut(&mut self) -> Option<&mut RoundCone>
Converts this abstract shape to a mutable round cone, if it is one.
sourcepub fn as_round_convex_polyhedron(&self) -> Option<&RoundConvexPolyhedron>
pub fn as_round_convex_polyhedron(&self) -> Option<&RoundConvexPolyhedron>
Converts this abstract shape to a round convex polyhedron, if it is one.
sourcepub fn as_round_convex_polyhedron_mut(
&mut self
) -> Option<&mut RoundConvexPolyhedron>
pub fn as_round_convex_polyhedron_mut( &mut self ) -> Option<&mut RoundConvexPolyhedron>
Converts this abstract shape to a mutable round convex polyhedron, if it is one.