Different articles have discussed about the intersection of two line segments in Python such as
How do I compute the intersection point of two lines?,
How can I check if two segments intersect?
But, no one made it perfect since, they did not cover an especial case. Given the following two line segments:
a = [(0, 2), (2, 4)]
b = [(-2, 0), (0, 2)]
These two segment lines have the same slope. In fact, they intersect at (0, 2). How can we obtain such the intersection point?
The second part of my question, what if two line segments overlap (partially/totally)? That is,
a = [(0, 2), (2, 4)]
b = [(-2, 0), (1, 3)]