A company has to hang a high-voltage cable that goes in a straight line between point $$A$$ and point $$B$$. However, there's an obstacle $$O$$ on the terrain, and the company fears that it might be in the way of the cable. They need your help to determine whether the obstacle is in the way or not.
Although the earth is a globe, the distances here are small enough to assume that we are working in a flat area. We treat the degrees of latitude and longitude as $$x$$ and $$y$$ co-ordinates. If the co-ordinates of $$A$$, $$B$$ and $$O$$ respectively are $$(x_A,y_A)$$, $$(x_B,y_B)$$ and $$(x_O,y_O)$$, you can use the following equation to determine whether these points are on the same line: \[\left(y_A-y_B\right)\,x_O - \left(x_A-x_B\right)\,y_O + x_A\,y_B - x_B\,y_A=0\]
If the equation is true, the three points are in one line. However, it is only an issue if the obstacle is situated between $$A$$ and $$B$$. Check whether the obstacle is situated between $$A$$ and $$B$$, horizontally as well as vertically.
Write a function isObstacle that takes 6 co-ordinates (in this order: $$x_A, y_A,x_B, y_B, x_O, y_O$$). As a result, the function should return a Boolean value, that indicates whether the obstacle is in the way if we want to hang a high-voltage cable between point $$A$$ and point $$B$$. For this assignment you may assume that a value is 0, if the deviation is less than $$10^{-6}$$ .
>>> isObstacle(51.022, 3.7095, 51.028, 3.7185, 51.025, 3.715)
False
>>> isObstacle(51.022, 3.7095, 51.028, 3.7185, 51.025, 3.714)
True