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

corner_direction wrongly returns Orientation::None #99

Open
hannobraun opened this issue Oct 13, 2022 · 0 comments
Open

corner_direction wrongly returns Orientation::None #99

hannobraun opened this issue Oct 13, 2022 · 0 comments

Comments

@hannobraun
Copy link

I'm getting a wrong result from corner_direction for a specific set of points. The following test fails, even though the points are clearly not on a line:

#[test]
fn corner_direction_bug() {
    let p1 = Point::from([-0.5, 0.8660254037844387]);
    let p2 = Point::from([1., 1.7320508075688772]);
    let p3 = Point::from([-2., 0.]);

    assert_ne!(corner_direction(&p1, &p2, &p3), Orientation::None);
}

I don't know what is special about these values. These just happened to be the points I've seen this issue with in my code base (modulo some light rounding). If I round the longer values (to 0.9 or 1.7), the test no longer fails.

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

1 participant