parry icon indicating copy to clipboard operation
parry copied to clipboard

`Triangle::contains_point` gives false-positives

Open wlinna opened this issue 2 years ago • 1 comments

Triangle::contains_point gives false-positives. I have a point and a triangle pair for which rapier3d::parry::query::PointQuery::distance_to_local_point returns 0.15627049. When I check the point and the triangle visually, the point is clearly NOT at/in the triangle. However, Triangle::contains_point returns true for the pair. Here's the code to reproduce.

        let p = na::Point3::new(22.01,3.7,-0.291);
        let tri = rapier3d::prelude::Triangle::new(
            na::Point3::new(21.94, 3.7, 0.0), 
            na::Point3::new(22.255, 3.7, -0.315),
            na::Point3::new(22.255, 3.5, -0.315)
        );
        let dist = rapier3d::parry::query::PointQuery::distance_to_local_point(&tri, &p, true);
        dbg!(dist); // 0.15627049
        assert!(!tri.contains_point(&p)); // FAILS

I'm using rapier3d 0.11.1, which still installs the old parry3d 0.7.1.

wlinna avatar Apr 18 '22 13:04 wlinna

Just tested this on parry3d 0.9, and the bug remains. The numbers haven't changed

wlinna avatar May 03 '22 05:05 wlinna

I tested this with parry 0.14, and the bug is gone Fixed by https://github.com/dimforge/parry/pull/78

wlinna avatar May 01 '24 10:05 wlinna