//NOTE: I have modified this program such that it returns a '0'
// if there is no intersection and a '1' if the segments do
// intersect. This function will open a file containing the
// line segments that make up the obstacles in a map and check
// for intersection.
/* lines intersect: AUTHOR: Mukesh Prasad
*
* This function computes whether two line segments,
* respectively joining the input points (xl,yl) -- (x2,y2)
* and the input points (x3,y3) -- (x4,y4) intersect.
* If the lines intersect, the output variables x, y are
* set to coordinates of the point of intersection.
*
* All values are in integers. The returned value is rounded
* to the nearest integer point.
*
* If non-integral grid points are relevant, the function
* can easily be transformed by substituting floating point
* calculations instead of integer calculations.
*
* Entry
* xl, yl, x2, y2 Coordinates of endpoints of one segment.
* x3, y3, x4, y4 Coordinates of endpoints of other segment.
*
* Exit
* x, y Coordinates of intersection point.
*
* The value returned by the function is one of:
* DON'T INTERSECT
* DO INTERSECT 0
* DO INTERSECT 1
* COLLINEAR 2
*
* Error conditions:
*
* Depending upon the possible ranges, and particularly on 16-bit
* computers, care should be taken to protect from overflow.
*
* In the following code, 'long' values have been used for this
* purpose, instead of'int'.
*