In some cases when the point lies on a triangle edge project_local_point with solid = false project the point to some other edge. Interestingly enough, this seems to be winding order sensitive, because for tri2 the correct projection is computed.
Here's a code that reproduces the bug
fn main() {
let verts = [Point::new(2.0, 1.0), Point::new(0.0, 1.0), Point::new(1.0, 0.0)];
let tri1 = Triangle::new(verts[0], verts[1], verts[2]);
let tri2 = Triangle::new(verts[2], verts[0], verts[1]);
let query_pt = Point::new(1.4, 1.0);
let proj1 = tri1.project_local_point(&query_pt, false); // FAILS
let proj2 = tri2.project_local_point(&query_pt, false); // SUCCEEDS
assert_eq!(proj1.point, proj2.point);
// assertion `left == right` failed
// left: [1.7, 0.7]
// right: [1.4, 1.0]
}
In some cases when the point lies on a triangle edge
project_local_point
withsolid = false
project the point to some other edge. Interestingly enough, this seems to be winding order sensitive, because for tri2 the correct projection is computed.Here's a code that reproduces the bug
Tested with parry2d 0.14 and parry2d 0.13.8