dimforge / ncollide

2 and 3-dimensional collision detection library in Rust.
https://ncollide.org
Apache License 2.0
921 stars 107 forks source link

Shape::contains_point fails with big numbers #367

Open wucke13 opened 3 years ago

wucke13 commented 3 years ago

Why does this code fail? Making the 1e19 small enough (1e18) eventually makes it work, but that seems quite ugh. Is this expected behavior?

let poly = ConvexPolygon::try_from_points(&vec![
            Point::new(1600.0f64, 100.0),
            Point::new(10100.0, 1958.0),
            Point::new(1e20, 1958.0),
            Point::new(1e20, 100.0),
        ]).expect("Convex hull computation failed.");

  assert!(poly.contains_point(
    &Isometry::identity(),
    &Point::new(1e19, 300.0)
));