@turf/lineIntersect false negatives
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 10.5k
- Forks
- 1k
- Avg merge
- 1h 11m
- Merged PRs (30d)
- 4
Description
Checking line intersections with a line segment between two exact matching coordinates returns only one of the coordinates. This may be related to #2947, but I find it notable that turf.booleanIntersects does recognize the second point as being on the line.
const a = {"type":"Feature","properties":{},"geometry":{"type":"LineString","coordinates":[[0,2],[0,0],[4,0],[4,4],[3,4],[3,1],[1,1],[1,2],[0,2]]}}
const b = {"type":"Feature","properties":{},"geometry":{"type":"LineString","coordinates":[[3,2],[4,2]]}}
const intersections = turf.lineIntersect(a, b) // only [4,2] included in output in Node v22.20
const isIntersectingDirectly = turf.booleanIntersect(a, turf.point([3,2])) // true
(Side note: I hope these three issues are not spammy. If they should be merged, I'm happy to do that. I just wanted to document some distinct behaviors I was seeing)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the @turf/lineIntersect entry point and reproduce the supplied Node v22.20 example, comparing its output with turf.booleanIntersects for the [3,2] endpoint. Trace the intersection handling for exact matching coordinates and confirm the fix with a regression test showing both expected intersection points are returned.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js, typescript
- Domain
- backend-api-design, computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100