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

booleanIntersects unpredictable, given two line segments sharing an endpoint #2539

Open
bblack opened this issue Nov 14, 2023 · 2 comments
Open

Comments

@bblack
Copy link

bblack commented Nov 14, 2023

turf 6.5.0

var turf = require("@turf/turf");

// Two line segments that share the same start point:
var a = [
  [ -64.4522672777778, 53.738182155555506 ],
  [ -64.45201727777784, 53.7386266 ]
];
var b = [
  [ -64.4522672777778, 53.738182155555506 ],
  [ -64.45223950000003, 53.738182155555506 ]
];

turf.booleanIntersects(
  turf.lineString(a), turf.lineString(b)
); // true
turf.booleanIntersects(
  turf.lineString(a), turf.lineString(b.toReversed())
); // true
turf.booleanIntersects(
  turf.lineString(a.toReversed()), turf.lineString(b)
); // true
turf.booleanIntersects(
  turf.lineString(a.toReversed()), turf.lineString(b.toReversed())
); // false
@smallsaucepan
Copy link
Member

Hi @bblack. Would you mind trying this with one of the available Turf alphas? For example 7.0.0-alpha.2

I tried to reproduce this locally and all four returned true. If a newer version of Turf doesn't help, something else to try is I used a.splice().reverse() rather than a.toReversed() to get a reversed copy of the array.

Let us know what you find, and we can dig further if those don't work.

@bblack
Copy link
Author

bblack commented Jan 15, 2024

@smallsaucepan : i tried my example on 7.0.0-alpha.2 , and the issue does not occur there: all four cases return "true", including the last one which was returning "false" on 6.5.0.

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

No branches or pull requests

2 participants