Posts

Showing posts with the label intersect

How do I compute the intersection point of two lines in Python?

How do I compute the intersection point of two lines in Python? I have two lines that intersect at a point. I know the endpoints of the two lines. How do I compute the intersection point in Python? # Given these endpoints #line 1 A = [X, Y] B = [X, Y] #line 2 C = [X, Y] D = [X, Y] # Compute this: point_of_intersection = [X, Y] Are these line segments, or lines? – user2357112 Dec 19 '13 at 9:31 This problem mostly boils down to "do the math". You can use algebraic manipulation to find an expression for the coordinates of the intersection, then insert that expression into your program. Remember to check for parallel lines first, though. – user2357112 Dec 19 '13 at 9:33 ...