proximity_query2d/
proximity_query2d.rs

1use parry2d::math::{Pose, Vector};
2use parry2d::query;
3use parry2d::shape::{Ball, Cuboid};
4
5fn main() {
6    let cuboid = Cuboid::new(Vector::new(1.0, 1.0));
7    let ball = Ball::new(1.0);
8
9    let cuboid_pos = Pose::identity();
10    let ball_pos_intersecting = Pose::translation(1.0, 1.0);
11    let ball_pos_disjoint = Pose::translation(3.0, 3.0);
12
13    assert!(query::intersection_test(&ball_pos_intersecting, &ball, &cuboid_pos, &cuboid).unwrap());
14    assert!(!query::intersection_test(&ball_pos_disjoint, &ball, &cuboid_pos, &cuboid).unwrap());
15}