I have a triangle and a point for which I need to compute the distance. However, when the triangle is degenerate, the result can be very very wrong. Here's a test to demonstrate the issue:
let p = na::Point3::new(1.10000002, -7.9000001, 16.5879993);
let a = na::Point3::new(2.27699995, -7.9000001, 16.3180008);
let b = na::Point3::new(-0.569999993, -8.10000038, 16.6070004);
let c = na::Point3::new(-0.569999993, -8.10000038, 16.6070004);
let line = rapier3d::parry::shape::Polyline::new(vec![a, b], None);
let tri = rapier3d::parry::shape::Triangle::new(a, b, c);
assert_eq!(tri.area(), 0.0);
assert!(tri.local_aabb().contains_local_point(&p));
let tri_dist = rapier3d::parry::query::PointQuery::distance_to_local_point(&tri, &p, true);
let line_dist = rapier3d::parry::query::PointQuery::distance_to_local_point(&line, &p, true);
assert!(line_dist > 0.0);
assert_eq!(tri_dist, line_dist);
// :tri_pt_dist_degen' panicked at 'assertion failed: `(left == right)`
// left: `0.0`,
// right: `0.17147861`'
If I treat the triangle as a line, the distance is computed correctly. At least it looks correct visually judging.
I'm using rapier3d 0.11.1, which still installs the old parry3d 0.7.1.0
I have a triangle and a point for which I need to compute the distance. However, when the triangle is degenerate, the result can be very very wrong. Here's a test to demonstrate the issue:
If I treat the triangle as a line, the distance is computed correctly. At least it looks correct visually judging.
I'm using rapier3d 0.11.1, which still installs the old parry3d 0.7.1.0