Discover what MATLAB® can do for your career.

Problem 1720. Do the lines intersect?

Consider one segment as (x1,y1) to (x2,y2), the other segment as (x3,y3) to (x4,y4). You are given a = [x1 y1; x2 y2]; b = [x3 y3; x4 y4]. Return tf=true if a and b intersect or tf=false if a and b do not touch.

All lines will intersect cleanly at exactly one non-endpoint. That is, they will not nest, overlap, or "kiss" at the endpoints.

Problem Comments

Hi Celestino. I added a little bit more clarifying text to the problem statement. That's an interesting test case, but not one I will use for this problem. You could make your own extension to this problem, though!