How do I tell if two line segments are intercepting?I have a line segment going from (2,2) to (3,5), and another going from (7,2) (3,0), which formula(s) should I be looking for to solve this?
Two lines which are not parallel to each other are intersecting. As your question mentions line segments there could be a possibility that they don't intersect but if they are extended to form complete lines, they will intersect if they are not parallel.
Let's take the lines passing through the points you have provided. To calculate the slope of a line passing through (x1, y1) and (x2, y2) we need to evaluate: (y2 - y1) / (x2 - x1)
(2, 2) and (3, 5): the slope of the line through them is (5 - 2) / (3 - 2) = 3.
(7, 2) and (3, 0): the slope of the line through them is (2- 0)/ (7 - 3) = 2 / 4 = 1/2.
Therefore the lines passing through the given sets of points are intersecting as the slopes are not equal.