Checking if two line segments intersect returns True if they intersect and False otherwise.
Solution for How to check if two line segments intersect in Python : You can use algebraic concepts to check if two segments intersect Define a function to check whether a point lies on a line segment. Define another function to determine the orientation between three points. Use these two functions to define a function which checks whether two segments intersect. The solution below assumes that coordinates are integers and that a line segment is defined by two points.
Here is a more detailed explanation of the algorithm above.