Skip to content

Upgrade sweepline-intersections - #3070

Merged
mfedderly merged 7 commits into
masterfrom
mf/upgrade-sweepline-intersections
Jun 22, 2026
Merged

Upgrade sweepline-intersections#3070
mfedderly merged 7 commits into
masterfrom
mf/upgrade-sweepline-intersections

Conversation

@mfedderly

@mfedderly mfedderly commented May 28, 2026

Copy link
Copy Markdown
Collaborator

Upgrades sweepline-intersections to pick up fixes for arethetypeswrong. There is also a change rowanwins/sweepline-intersections@e7a48be where it adds detection for endpoint intersections which previously did not exist.

Breaking:

This changes the behavior of @turf/boolean-crosses from returning true to false when the line/line intersection is on an end point. I think this matches the DE9IM intended behavior now.

Todo:

Note: tinyqueue@3 (released nearly 2 years ago) breaks node@18 compatibility. So that's another point towards only including this in turf@8.

mfedderly added 2 commits May 28, 2026 08:44
…rtex

Upgrading sweepline-intersections in line-intersect started to cause failures in boolean-crosses. It looks like rowanwins/sweepline-intersections@e7a48be added endpoint intersection detection.

When trying to grapple with this back in boolean-crosses, I noticed that the booleanEqual first parameter was a geometry but the second was a feature which was causing it to return false even when the [1, 1] point was used in the coordinate arrays of both.

After fixing the doLineStringsCross method, it fixed the test that had been marked as false, but now the true test is failing. From spot-checking against PostGIS I think we're actually supposed to return false if two linestrings only cross at an end point.

postgres=# SELECT ST_Crosses(
postgres(#     'LINESTRING(-2 1, 4 1)'::geometry,
postgres(#     'LINESTRING(1 1, 1 2, 1 3, 1 4)'::geometry
postgres(# );
 st_crosses
------------
 f
(1 row)

postgres=# SELECT ST_Crosses(
    'LINESTRING(-2 2, 1 1)'::geometry,
    'LINESTRING(1 1, 1 2, 1 3, 1 4)'::geometry
);
 st_crosses
------------
 f
(1 row)
@mfedderly mfedderly added this to the v8 milestone May 28, 2026
@mfedderly mfedderly mentioned this pull request May 28, 2026
@mfedderly

Copy link
Copy Markdown
Collaborator Author

@rexxars Any chance you have a minute to verify that the change to line/line intersect behavior (under Breaking in the PR description) is the right thing to do?

@mfedderly
mfedderly marked this pull request as ready for review June 21, 2026 23:47
@mfedderly

Copy link
Copy Markdown
Collaborator Author

I've convinced myself that this can belong in 7.x because we're fixing a correctness bug to match DE-9IM and the docs as written. It also updates the sweepline-intersections code to pick up the latest changes, but sadly we had to inline it because the maintainer has been unresponsive to a PR that fixes some of its dependencies. If we took the newer versions as-is, we would be declaring an old version of esbuild as a transitive (non-dev) dependency.

@mfedderly

Copy link
Copy Markdown
Collaborator Author

I backed out tinyqueue@3 and robust-predicates@3 (both to 2.x) to fix issues with node@18 compat in turf@7. I intend to bump everything to the newer versions once we start working towards turf@8 and drop support for node@18.

@mfedderly
mfedderly merged commit e0c345f into master Jun 22, 2026
5 checks passed
@mfedderly
mfedderly deleted the mf/upgrade-sweepline-intersections branch June 22, 2026 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant