dimforge / ncollide

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

is_point_in_triangle is broken #368

Closed EmbersArc closed 1 year ago

EmbersArc commented 3 years ago

This returns true, even though (0., 0.) is not inside the triangle:

is_point_in_triangle(
        &Point2d::new(0., 0.),
        &Point2d::new(1., 0.),
        &Point2d::new(0., 1.),
        &Point2d::new(1., 1.),
);

This seems to be independent of the triangle vertex order.

Same issue for the 3D case, this returns true:

is_point_in_triangle(
        &Point3d::new(0., 0., 0.),
        &Point3d::new(1., 0., 0.),
        &Point3d::new(0., 1., 0.),
        &Point3d::new(1., 1., 0.),
);