Answer the question
In order to leave comments, you need to log in
Formula for the intersection of line segments?
There are two line segments on it. Let's say a straight line from 0 to 15. Examples of segments.
Segment A (2, 5) segment B (6, 9) do not intersect.
Segment A (5, 7) segment B (3, 9) intersect.
Segment A (5, 9) segment B (7, 11) intersect.
I think it's understandable ...
Is there a formula to determine whether the segments intersect or not?
Answer the question
In order to leave comments, you need to log in
I will take the notation from the previous answer
A(x1, x2)
B(y1, y2)
the segments intersect if any of the four conditions is met:
y1 <= x1 < y2 или
y1 < x2 <= y2 или
x1 <= y1 < x2 или
x1 < y2 <= x2
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question