LINESEG - Intersection
Being a student of engineering, you got a craze for Geometry problems. You just started solving some simple geometry problems, and you wondered how about finding whether two given lines intersect, and in what manner. You will be given two line segments on the plane. Each one of them is either vertical or horizontal, ie parallel to X axis or Y axis. You have to determine whether the two segments intersect or not, and if they do, does the segments' intersection forms a point or a line segment?
The first line consists of the number T <= 100 - the number of test cases. Each test case consists of 2 lines, each line consisting of 4 integers x1,y1,x2,y2. (x1,y1) and (x2,y2) are the end points of respective line segments. All co-ordinates will lie between -1000 and 1000 inclusive.
For each test case, if the two segments do not intersect at all, print "NO", and if they do, if they intersect at a point, print "POINT", otherwise if their intersection forms a segment, print "SEGMENT".
Input: 3 0 0 0 10 0 0 0 0 0 0 0 1
1 0 1 1
0 0 2 0 1 0 10 0 Output: POINT NO SEGMENT
can be moved to classicalLast edit: 2017-03-12 19:51:38
no tags, Wow.