In one of his notebooks, Euclid gave a complex procedure for solving the following problem. With computers, perhaps there is an easier way.
In a 2D plane, consider a line segment AB, another point C which is not collinear with AB, and a triangle DEF. The goal is to find points G and H such that:
H is on the ray AC (it may be closer to A than C or further away, but angle CAB is the same as angle HAB)
ABGH is a parallelogram (AB is parallel to HG, AH is parallel to BG)
The area of parallelogram ABGH is the same as the area of triangle DEF
There will be several test cases. Each test case will consist of twelve real numbers, with no more than 3 decimal places each, on a single line. Those numbers will represent, in order:
AX AY BX BY CX CY DX DY EX EY FX FY
For each test case, print a single line with four decimal numbers. These represent points G and H, like this:
GX GY HX HY
0 0 5 0 0 5 3 2 7 2 0 4 1.3 2.6 12.1 4.5 8.1 13.7 2.2 0.1 9.8 6.6 1.9 6.7 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
5.000 0.800 0.000 0.800 13.756 7.204 2.956 5.304