Current lineIntersects function calculates intersections of arbitrary lines, but we have a much simpler use case. We only need 2 algorithms — one for vertical line intersection and another one for horizontal one, which are trivial, and will allow us to handle trivial rejects (where a segment doesn't intersect) incredibly fast.
Current
lineIntersects
function calculates intersections of arbitrary lines, but we have a much simpler use case. We only need 2 algorithms — one for vertical line intersection and another one for horizontal one, which are trivial, and will allow us to handle trivial rejects (where a segment doesn't intersect) incredibly fast.