dimforge / parry

2D and 3D collision-detection library for Rust.
https://parry.rs
Apache License 2.0
557 stars 97 forks source link

Check all signs are equal #32

Closed MJohnson459 closed 3 years ago

MJohnson459 commented 3 years ago

Fix a bug when tracing a ray against a triangle in 2d. I've tested this locally and it seems to fix the failure case. Existing tests should be passing.

Is there somewhere I should add new tests to cover this case?

Discussed on discord: https://discord.com/channels/507548572338880513/748627261384556715/847755138641952800

sebcrozet commented 3 years ago

Thank you for this PR! For clarity, the variables should be renamed to perp_sign1. You can add the new tests in the build/parry2d/tests/geometry/ray_cast.rs file.

MJohnson459 commented 3 years ago

Added three tests to cover the starting inside, starting outside, and starting on the edge cases. I confirmed that the tests fail with the old check and pass with the new. Also updated the variable names.

sebcrozet commented 3 years ago

Thanks!