Trait parry3d::query::QueryDispatcher
source · pub trait QueryDispatcher: Send + Sync {
// Required methods
fn intersection_test(
&self,
pos12: &Isometry<Real>,
g1: &dyn Shape,
g2: &dyn Shape
) -> Result<bool, Unsupported>;
fn distance(
&self,
pos12: &Isometry<Real>,
g1: &dyn Shape,
g2: &dyn Shape
) -> Result<Real, Unsupported>;
fn contact(
&self,
pos12: &Isometry<Real>,
g1: &dyn Shape,
g2: &dyn Shape,
prediction: Real
) -> Result<Option<Contact>, Unsupported>;
fn closest_points(
&self,
pos12: &Isometry<Real>,
g1: &dyn Shape,
g2: &dyn Shape,
max_dist: Real
) -> Result<ClosestPoints, Unsupported>;
fn cast_shapes(
&self,
pos12: &Isometry<Real>,
local_vel12: &Vector<Real>,
g1: &dyn Shape,
g2: &dyn Shape,
options: ShapeCastOptions
) -> Result<Option<ShapeCastHit>, Unsupported>;
fn cast_shapes_nonlinear(
&self,
motion1: &NonlinearRigidMotion,
g1: &dyn Shape,
motion2: &NonlinearRigidMotion,
g2: &dyn Shape,
start_time: Real,
end_time: Real,
stop_at_penetration: bool
) -> Result<Option<ShapeCastHit>, Unsupported>;
// Provided method
fn chain<U: QueryDispatcher>(
self,
other: U
) -> QueryDispatcherChain<Self, U>
where Self: Sized { ... }
}
Expand description
Dispatcher for pairwise queries.
Custom implementations allow crates that support an abstract QueryDispatcher
to handle custom
shapes.
The pos12
argument to most queries is the transform from the local space of g2
to that of
g1
.
Required Methods§
sourcefn intersection_test(
&self,
pos12: &Isometry<Real>,
g1: &dyn Shape,
g2: &dyn Shape
) -> Result<bool, Unsupported>
fn intersection_test( &self, pos12: &Isometry<Real>, g1: &dyn Shape, g2: &dyn Shape ) -> Result<bool, Unsupported>
Tests whether two shapes are intersecting.
sourcefn distance(
&self,
pos12: &Isometry<Real>,
g1: &dyn Shape,
g2: &dyn Shape
) -> Result<Real, Unsupported>
fn distance( &self, pos12: &Isometry<Real>, g1: &dyn Shape, g2: &dyn Shape ) -> Result<Real, Unsupported>
Computes the minimum distance separating two shapes.
Returns 0.0
if the objects are touching or penetrating.
sourcefn contact(
&self,
pos12: &Isometry<Real>,
g1: &dyn Shape,
g2: &dyn Shape,
prediction: Real
) -> Result<Option<Contact>, Unsupported>
fn contact( &self, pos12: &Isometry<Real>, g1: &dyn Shape, g2: &dyn Shape, prediction: Real ) -> Result<Option<Contact>, Unsupported>
Computes one pair of contact points point between two shapes.
Returns None
if the objects are separated by a distance greater than prediction
.
sourcefn closest_points(
&self,
pos12: &Isometry<Real>,
g1: &dyn Shape,
g2: &dyn Shape,
max_dist: Real
) -> Result<ClosestPoints, Unsupported>
fn closest_points( &self, pos12: &Isometry<Real>, g1: &dyn Shape, g2: &dyn Shape, max_dist: Real ) -> Result<ClosestPoints, Unsupported>
Computes the pair of closest points between two shapes.
Returns ClosestPoints::Disjoint
if the objects are separated by a distance greater than max_dist
.
sourcefn cast_shapes(
&self,
pos12: &Isometry<Real>,
local_vel12: &Vector<Real>,
g1: &dyn Shape,
g2: &dyn Shape,
options: ShapeCastOptions
) -> Result<Option<ShapeCastHit>, Unsupported>
fn cast_shapes( &self, pos12: &Isometry<Real>, local_vel12: &Vector<Real>, g1: &dyn Shape, g2: &dyn Shape, options: ShapeCastOptions ) -> Result<Option<ShapeCastHit>, Unsupported>
Computes the smallest time when two shapes under translational movement are separated by a
distance smaller or equal to distance
.
Returns 0.0
if the objects are touching or penetrating.
§Parameters
pos12
: the position of the second shape relative to the first shape.local_vel12
: the relative velocity between the two shapes, expressed in the local-space of the first shape. In other world:pos1.inverse() * (vel2 - vel1)
.g1
: the first shape involved in the shape-cast.g2
: the second shape involved in the shape-cast.target_dist
: a hit will be returned as soon as the two shapes get closer thantarget_dist
.max_time_of_impact
: the maximum allowed travel time. This method returnsNone
if the time-of-impact detected is theater than this value.
sourcefn cast_shapes_nonlinear(
&self,
motion1: &NonlinearRigidMotion,
g1: &dyn Shape,
motion2: &NonlinearRigidMotion,
g2: &dyn Shape,
start_time: Real,
end_time: Real,
stop_at_penetration: bool
) -> Result<Option<ShapeCastHit>, Unsupported>
fn cast_shapes_nonlinear( &self, motion1: &NonlinearRigidMotion, g1: &dyn Shape, motion2: &NonlinearRigidMotion, g2: &dyn Shape, start_time: Real, end_time: Real, stop_at_penetration: bool ) -> Result<Option<ShapeCastHit>, Unsupported>
Computes the smallest time of impact of two shapes under translational and rotational movement.
§Parameters
motion1
- The motion of the first shape.g1
- The first shape involved in the query.motion2
- The motion of the second shape.g2
- The second shape involved in the query.start_time
- The starting time of the interval where the motion takes place.end_time
- The end time of the interval where the motion takes place.stop_at_penetration
- If the casted shape starts in a penetration state with any collider, two results are possible. Ifstop_at_penetration
istrue
then, the result will have atime_of_impact
equal tostart_time
. Ifstop_at_penetration
isfalse
then the nonlinear shape-casting will see if further motion wrt. the penetration normal would result in tunnelling. If it does not (i.e. we have a separating velocity along that normal) then the nonlinear shape-casting will attempt to find another impact, at a time> start_time
that could result in tunnelling.
Provided Methods§
sourcefn chain<U: QueryDispatcher>(self, other: U) -> QueryDispatcherChain<Self, U>where
Self: Sized,
fn chain<U: QueryDispatcher>(self, other: U) -> QueryDispatcherChain<Self, U>where
Self: Sized,
Construct a QueryDispatcher
that falls back on other
for cases not handled by self