diff --git a/crates/parry2d/examples/bounding_sphere2d.rs b/crates/parry2d/examples/bounding_sphere2d.rs index 66bd4de6..81c05eab 100644 --- a/crates/parry2d/examples/bounding_sphere2d.rs +++ b/crates/parry2d/examples/bounding_sphere2d.rs @@ -48,8 +48,15 @@ async fn main() { GREEN }; - //assert!(bounding_bounding_sphere.contains(&bounding_sphere_cube1)); - //assert!(bounding_bounding_sphere.contains(&bounding_sphere_cube2)); + // Due to float imprecisions, it's dangerous to assume that both shapes will be + // contained in the merged. + // You can leverage `BoundingVolume::loosened` with an epsilon for expected results. + // + // These might fail: + // assert!(bounding_bounding_sphere.contains(&bounding_sphere_cube1)); + // assert!(bounding_bounding_sphere.contains(&bounding_sphere_cube2)); + + assert!(loose_bounding_sphere_cube2.contains(&bounding_sphere_cube1)); assert!(loose_bounding_sphere_cube2.contains(&bounding_sphere_cube2)); let cube1_translation =