ncollide3d/query/nonlinear_time_of_impact/
nonlinear_time_of_impact_ball_ball.rs1use na::RealField;
2
3use crate::interpolation::RigidMotion;
4use crate::math::Isometry;
5use crate::query::{self, ClosestPoints, TOI};
6use crate::shape::Ball;
7
8#[inline]
10pub fn nonlinear_time_of_impact_ball_ball<N: RealField + Copy>(
11 motion1: &(impl RigidMotion<N> + ?Sized),
12 b1: &Ball<N>,
13 motion2: &(impl RigidMotion<N> + ?Sized),
14 b2: &Ball<N>,
15 max_toi: N,
16 target_distance: N,
17) -> Option<TOI<N>> {
18 fn closest_points<N: RealField + Copy>(
19 m1: &Isometry<N>,
20 g1: &Ball<N>,
21 m2: &Isometry<N>,
22 g2: &Ball<N>,
23 prediction: N,
24 ) -> ClosestPoints<N> {
25 query::closest_points_ball_ball(
26 &m1.translation.vector.into(),
27 g1,
28 &m2.translation.vector.into(),
29 g2,
30 prediction,
31 )
32 }
33
34 query::nonlinear_time_of_impact_support_map_support_map_with_closest_points_function(
35 motion1,
36 b1,
37 motion2,
38 b2,
39 max_toi,
40 target_distance,
41 closest_points,
42 )
43}