Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

orient function robustness issue #43

Open
MFraters opened this issue Apr 7, 2023 · 1 comment
Open

orient function robustness issue #43

MFraters opened this issue Apr 7, 2023 · 1 comment

Comments

@MFraters
Copy link

MFraters commented Apr 7, 2023

I found that line

return (qy - py) * (rx - qx) - (qx - px) * (ry - qy) < 0.0;
can cause differences between debug and release mode in some edge cases. In debug mode the result is exactly zero, which means the line evaluates to false, but in release mode the result is a very small negative number.

This can be prevented by using return (qy - py) * (rx - qx) - (qx - px) * (ry - qy) < -std::numeric_limits<double>::epsilon(); instead, which seems to solve the problem in my case (the value is on the order of -1e-21). I am curious to know if this is a good solution in general and I am happy to make a pull request out of it if desired.

For reference: GeodynamicWorldBuilder/WorldBuilder#479

@abellgithub
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants