Skip to content

orient function robustness issue #43

@MFraters

Description

@MFraters

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions