ZoranPandovski / al-go-rithms

:musical_note: Algorithms written in different programming languages - https://zoranpandovski.github.io/al-go-rithms/
Creative Commons Zero v1.0 Universal
1.33k stars 1.95k forks source link

Geometry Algorithms: Check if two segments intersect #3446

Closed the-good-boy closed 1 year ago

the-good-boy commented 1 year ago

You are given two segments AB and CD, described as pairs of their endpoints. Each segment can be a single point if its endpoints are the same. You have to find the intersection of these segments, which can be empty (if the segments don't intersect), a single point or a segment (if the given segments overlap). linesegments1