Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/turf-boolean-disjoint/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,19 @@ function isLineOnLine(
if (doLinesIntersect.features.length > 0) {
return true;
}
// lineIntersect() only reports points where segments cross, so collinear
// (partially) overlapping lines are missed. Check whether a vertex of either
// line lies on the other line to also catch those overlapping cases.
for (const coords of lineString1.coordinates) {
if (isPointOnLine(lineString2, { type: "Point", coordinates: coords })) {
return true;
}
}
for (const coords of lineString2.coordinates) {
if (isPointOnLine(lineString1, { type: "Point", coordinates: coords })) {
return true;
}
}
return false;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [
[4, 1],
[5, 4]
]
}
},
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [
[4, 1],
[6, 7]
]
}
}
]
}