I asked a question on stackoverflow about how to know if a line is coinciding with another polygon. [http://stackoverflow.com/q/13304575/1362544]
The answer I got suggested checking intersection of the line with each edge of the polygon. Precisely, this is what the answer said:
Checking crossing of the line with edge is a geometry problem. If bounding-points of line we are checking are P1=(x1,y1) and P2=(x2,y2), and bounding points of edge are P3=(x3,y3) and P4=(x4,y4) then you should solve the linear system:
(x2 - x1) y + (y1 - y2) x = x1 y2 - x2 y1 , (x4 - x3) y + (y3 - y4) x = x3 y4 - x4 y3 .
After getting a value for (x, y) you should check that it is on parts between bounding-points on both lines (line we're checking and the edge). If that is true your lines cross each other
I don't understand how he got the 2 equations- an explanation would be greatly appreciated.