pub struct CompositeShapeRef<'a, S: ?Sized>(pub &'a S);Expand description
A helper struct that implements scene queries on any composite shapes.
For example, the RayCast implementation of a composite shape can use this wrapper or
provide its own implementation. This is for working around the lack of specialization in
(stable) rust. If we did have specialization, this would just be a blanket implementation
of all the geometric query traits for all S: CompositeShape.
Tuple Fields§
§0: &'a SImplementations§
Source§impl<S: ?Sized + TypedCompositeShape> CompositeShapeRef<'_, S>
impl<S: ?Sized + TypedCompositeShape> CompositeShapeRef<'_, S>
Sourcepub fn closest_points_to_shape<D: ?Sized + QueryDispatcher>(
&self,
dispatcher: &D,
pose12: &Isometry<f32>,
shape2: &dyn Shape,
margin: f32,
) -> Option<(u32, ClosestPoints)>
pub fn closest_points_to_shape<D: ?Sized + QueryDispatcher>( &self, dispatcher: &D, pose12: &Isometry<f32>, shape2: &dyn Shape, margin: f32, ) -> Option<(u32, ClosestPoints)>
Returns the closest points between self and the given shape2 positioned at
pose12 relative to self.
Returns the index of the sub-shape of self involved in the contact as well as the closest
points information.
Returns ClosestPoints::Disjoint if self and shape2 are separated by a distance larger
than margin.
Returns None if no closest point could be calculated (e.g. if the dispatcher doesn’t
support the involved shapes at all, or if self is empty).
Source§impl<S: ?Sized + CompositeShape> CompositeShapeRef<'_, S>
impl<S: ?Sized + CompositeShape> CompositeShapeRef<'_, S>
Sourcepub fn contact_with_shape<D: ?Sized + QueryDispatcher>(
&self,
dispatcher: &D,
pose12: &Isometry<f32>,
shape2: &dyn Shape,
prediction: f32,
) -> Option<(u32, Contact)>
pub fn contact_with_shape<D: ?Sized + QueryDispatcher>( &self, dispatcher: &D, pose12: &Isometry<f32>, shape2: &dyn Shape, prediction: f32, ) -> Option<(u32, Contact)>
Returns the closest/deepest contact between self and the given shape2 positioned at
pose12 relative to self.
Returns None if self and shape2 are separated by a distance larger than
prediction. Otherwise, returns the index of the sub-shape of self involved in the contact
as well as the contact information.
Source§impl<S: ?Sized + TypedCompositeShape> CompositeShapeRef<'_, S>
impl<S: ?Sized + TypedCompositeShape> CompositeShapeRef<'_, S>
Sourcepub fn distance_to_shape<D: ?Sized + QueryDispatcher>(
&self,
dispatcher: &D,
pose12: &Isometry<f32>,
shape2: &dyn Shape,
) -> Option<(u32, f32)>
pub fn distance_to_shape<D: ?Sized + QueryDispatcher>( &self, dispatcher: &D, pose12: &Isometry<f32>, shape2: &dyn Shape, ) -> Option<(u32, f32)>
Calculates the closest distance between self and the given shape2 positioned at
pose12 relative to self.
Returns the distance and the index of the sub-shape of self that is closest to shape2.
Source§impl<S: ?Sized + TypedCompositeShape> CompositeShapeRef<'_, S>
impl<S: ?Sized + TypedCompositeShape> CompositeShapeRef<'_, S>
Sourcepub fn intersects_shape<D: ?Sized + QueryDispatcher>(
&self,
dispatcher: &D,
pose12: &Isometry<f32>,
shape: &dyn Shape,
) -> Option<u32>
pub fn intersects_shape<D: ?Sized + QueryDispatcher>( &self, dispatcher: &D, pose12: &Isometry<f32>, shape: &dyn Shape, ) -> Option<u32>
Returns the index of the shape in self that intersects the given other shape positioned
at pose12 relative to self.
Returns None if no intersection is found.
Source§impl<S: ?Sized + TypedCompositeShape> CompositeShapeRef<'_, S>
impl<S: ?Sized + TypedCompositeShape> CompositeShapeRef<'_, S>
Sourcepub fn cast_shape_nonlinear<D: ?Sized + QueryDispatcher>(
&self,
dispatcher: &D,
motion1: &NonlinearRigidMotion,
motion2: &NonlinearRigidMotion,
shape2: &dyn Shape,
start_time: f32,
end_time: f32,
stop_at_penetration: bool,
) -> Option<(u32, ShapeCastHit)>
pub fn cast_shape_nonlinear<D: ?Sized + QueryDispatcher>( &self, dispatcher: &D, motion1: &NonlinearRigidMotion, motion2: &NonlinearRigidMotion, shape2: &dyn Shape, start_time: f32, end_time: f32, stop_at_penetration: bool, ) -> Option<(u32, ShapeCastHit)>
Performs a non-linear shape-cast between self animated subject to the motion1 and
the shape2 subject to the motion2.
Returns the shape-cast hit (if any) as well as the index of the sub-shape of self involved
in the hit.
Source§impl<S: TypedCompositeShape> CompositeShapeRef<'_, S>
impl<S: TypedCompositeShape> CompositeShapeRef<'_, S>
Sourcepub fn project_local_point_and_get_location(
&self,
point: &Point<f32>,
max_dist: f32,
solid: bool,
) -> Option<(u32, (PointProjection, <S::PartShape as PointQueryWithLocation>::Location))>where
S::PartShape: PointQueryWithLocation,
pub fn project_local_point_and_get_location(
&self,
point: &Point<f32>,
max_dist: f32,
solid: bool,
) -> Option<(u32, (PointProjection, <S::PartShape as PointQueryWithLocation>::Location))>where
S::PartShape: PointQueryWithLocation,
Project a point on this composite shape.
Returns the projected point as well as the index of the sub-shape of self that was hit.
The third tuple element contains some shape-specific information about the projected point.
Sourcepub fn project_local_point(
&self,
point: &Point<f32>,
solid: bool,
) -> (u32, PointProjection)
pub fn project_local_point( &self, point: &Point<f32>, solid: bool, ) -> (u32, PointProjection)
Project a point on this composite shape.
Returns the projected point as well as the index of the sub-shape of self that was hit.
If solid is false then the point will be projected to the closest boundary of self even
if it is contained by one of its sub-shapes.
Sourcepub fn project_local_point_and_get_feature(
&self,
point: &Point<f32>,
) -> (u32, (PointProjection, FeatureId))
pub fn project_local_point_and_get_feature( &self, point: &Point<f32>, ) -> (u32, (PointProjection, FeatureId))
Project a point on this composite shape.
Returns the projected point as well as the index of the sub-shape of self that was hit.
The third tuple element contains some shape-specific information about the shape feature
hit by the projection.
Source§impl<S: TypedCompositeShape> CompositeShapeRef<'_, S>
impl<S: TypedCompositeShape> CompositeShapeRef<'_, S>
Sourcepub fn cast_local_ray(
&self,
ray: &Ray,
max_time_of_impact: f32,
solid: bool,
) -> Option<(u32, f32)>
pub fn cast_local_ray( &self, ray: &Ray, max_time_of_impact: f32, solid: bool, ) -> Option<(u32, f32)>
Casts a ray on this composite shape.
The ray is effectively limited to a segment that starts at Ray::origin and ends at
Ray::origin + Ray::direction * max_time_of_impact. Set max_time_of_impact to Real::MAX
for an unbounded ray.
If solid is false, then the sub-shapes of self are seen as hollow and the ray won’t
immediately stop until it reaches a boundary even if it started inside a shape.
Returns the ray’s time of impact and the index of the sub-shape of self that was hit.
The hit point can be retrieved with ray.point_at(t) where t is the value returned
by this function.
Sourcepub fn cast_local_ray_and_get_normal(
&self,
ray: &Ray,
max_time_of_impact: f32,
solid: bool,
) -> Option<(u32, RayIntersection)>
pub fn cast_local_ray_and_get_normal( &self, ray: &Ray, max_time_of_impact: f32, solid: bool, ) -> Option<(u32, RayIntersection)>
Same as Self::cast_local_ray but also computes the normal at the hit location.
Source§impl<S: ?Sized + TypedCompositeShape> CompositeShapeRef<'_, S>
impl<S: ?Sized + TypedCompositeShape> CompositeShapeRef<'_, S>
Sourcepub fn cast_shape<D: ?Sized + QueryDispatcher>(
&self,
dispatcher: &D,
pose12: &Isometry<f32>,
vel12: &Vector<f32>,
g2: &dyn Shape,
options: ShapeCastOptions,
) -> Option<(u32, ShapeCastHit)>
pub fn cast_shape<D: ?Sized + QueryDispatcher>( &self, dispatcher: &D, pose12: &Isometry<f32>, vel12: &Vector<f32>, g2: &dyn Shape, options: ShapeCastOptions, ) -> Option<(u32, ShapeCastHit)>
Performs a shape-cast between self and a shape2 positioned at pose12 and subject to
a linear velocity vel12, relative to self.
Returns the shape-cast hit (if any) as well as the index of the sub-shape of self involved
in the hit.
Auto Trait Implementations§
impl<'a, S> Freeze for CompositeShapeRef<'a, S>where
S: ?Sized,
impl<'a, S> RefUnwindSafe for CompositeShapeRef<'a, S>where
S: RefUnwindSafe + ?Sized,
impl<'a, S> Send for CompositeShapeRef<'a, S>
impl<'a, S> Sync for CompositeShapeRef<'a, S>
impl<'a, S> Unpin for CompositeShapeRef<'a, S>where
S: ?Sized,
impl<'a, S> UnwindSafe for CompositeShapeRef<'a, S>where
S: RefUnwindSafe + ?Sized,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.