Euclid
Time limit1sMemory limit128 MB
For each case, find G and H so that ABGH is a parallelogram, H sits on ray AC, and the parallelogram's area equals triangle DEF's area.
- Level
Easy3 of 10
- Topics
- Geometry, Math, Implementation
- Solved
- No attempts yet
Problem
Euclid wrote down an elaborate construction for the following problem in his notebook. With a computer, though, it is easy to compute.
On the two-dimensional plane there is a segment , a point , and a triangle . The point does not lie on line ; equivalently, , , are not collinear, so a non-degenerate parallelogram can be built. You must find points and such that:
- lies on the ray that starts at and goes through .
- is a parallelogram (with its vertices in this order).
- The area of parallelogram equals the area of triangle .
Input
The input consists of several test cases. Each test case is a list of 12 real numbers, none of which has more than 3 digits after the decimal point:
AX AY BX BY CX CY DX DY EX EY FX FY
The coordinates of are , of are , and so on for the other points. Points , , are pairwise distinct and not collinear, and , , form a triangle (they too are pairwise distinct and not collinear, so its area is positive). Every number lies in the closed interval from to . The input ends with a line of twelve values.
Output
For each test case, output four real numbers — the coordinates of and — in the format:
GX GY HX HY
Here and . Every value must be rounded to 3 decimal places (rounding at the 4th decimal place) and printed with exactly 3 digits after the decimal point. Print a single space between consecutive numbers.