Intersection of segments
Two line segments [A, B]
and [C, D]
are defined on a plane by their endpoints: A
, B
, C
, and D
, with coordinates (X[A], Y[A])
, (X[B], Y[B])
, (X[C], Y[C])
, (X[D], Y[D])
.
Your task is to determine the intersection of these segments and provide the following output:
The word Empty if the segments do not intersect.
The coordinates of the intersection point if the intersection is a single point.
The coordinates of the endpoints of the intersection segment, listed in lexicographical order, if the segments intersect over a segment.
Input Data
The input consists of four lines, each containing two integers, representing the coordinates of the endpoints A
, B
, C
, and D
. These integers do not exceed 1000 in absolute value. Note that the segments can be degenerate.
Output Data
Any numerical values in the output should be rounded to 10 decimal places.