Trait oxygengine_physics_2d::prelude::ncollide2d::query::TOIDispatcher
source · pub trait TOIDispatcher<N>: Send + Syncwhere
N: RealField + Copy,{
// Required methods
fn nonlinear_time_of_impact(
&self,
root_dispatcher: &dyn TOIDispatcher<N>,
motion1: &dyn RigidMotion<N>,
g1: &(dyn Shape<N> + 'static),
motion2: &dyn RigidMotion<N>,
g2: &(dyn Shape<N> + 'static),
max_toi: N,
target_distance: N
) -> Result<Option<TOI<N>>, Unsupported>;
fn time_of_impact(
&self,
root_dispatcher: &dyn TOIDispatcher<N>,
m1: &Isometry<N, Unit<Complex<N>>, 2>,
vel1: &Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>,
g1: &(dyn Shape<N> + 'static),
m2: &Isometry<N, Unit<Complex<N>>, 2>,
vel2: &Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>,
g2: &(dyn Shape<N> + 'static),
max_toi: N,
target_distance: N
) -> Result<Option<TOI<N>>, Unsupported>;
// Provided method
fn chain<U>(self, other: U) -> Chain<Self, U>
where U: TOIDispatcher<N>,
Self: Sized { ... }
}
Expand description
Dispatcher for time-of-impact queries
Custom implementations allow crates that support an abstract TOIDispatcher
to handle custom
shapes. Methods take root_dispatcher
to allow dispatchers to delegate to eachother. Callers
that will not themselves be used to implement a TOIDispatcher
should pass self
.
Required Methods§
sourcefn nonlinear_time_of_impact(
&self,
root_dispatcher: &dyn TOIDispatcher<N>,
motion1: &dyn RigidMotion<N>,
g1: &(dyn Shape<N> + 'static),
motion2: &dyn RigidMotion<N>,
g2: &(dyn Shape<N> + 'static),
max_toi: N,
target_distance: N
) -> Result<Option<TOI<N>>, Unsupported>
fn nonlinear_time_of_impact( &self, root_dispatcher: &dyn TOIDispatcher<N>, motion1: &dyn RigidMotion<N>, g1: &(dyn Shape<N> + 'static), motion2: &dyn RigidMotion<N>, g2: &(dyn Shape<N> + 'static), max_toi: N, target_distance: N ) -> Result<Option<TOI<N>>, Unsupported>
Computes the smallest time of impact of two shapes under translational movement.
sourcefn time_of_impact(
&self,
root_dispatcher: &dyn TOIDispatcher<N>,
m1: &Isometry<N, Unit<Complex<N>>, 2>,
vel1: &Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>,
g1: &(dyn Shape<N> + 'static),
m2: &Isometry<N, Unit<Complex<N>>, 2>,
vel2: &Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>,
g2: &(dyn Shape<N> + 'static),
max_toi: N,
target_distance: N
) -> Result<Option<TOI<N>>, Unsupported>
fn time_of_impact( &self, root_dispatcher: &dyn TOIDispatcher<N>, m1: &Isometry<N, Unit<Complex<N>>, 2>, vel1: &Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>, g1: &(dyn Shape<N> + 'static), m2: &Isometry<N, Unit<Complex<N>>, 2>, vel2: &Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>, g2: &(dyn Shape<N> + 'static), max_toi: N, target_distance: N ) -> Result<Option<TOI<N>>, Unsupported>
Computes the smallest time at with 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.
Provided Methods§
sourcefn chain<U>(self, other: U) -> Chain<Self, U>where
U: TOIDispatcher<N>,
Self: Sized,
fn chain<U>(self, other: U) -> Chain<Self, U>where U: TOIDispatcher<N>, Self: Sized,
Construct a TOIDispatcher
that falls back on other
for cases not handled by self