Center of the Outer Triangles
Time limit1sMemory limit128 MB
Given a triangle, construct outward squares on each side, form outer triangles, and compute the common intersection point of three specific medians (Vecten point).
- Level
Medium6 of 10
- Topics
- Geometry, Math, Simulation
- Solved
- No attempts yet
Problem
For triangle ABC, construct a square outward on each side. Let ABDE be the square on side AB, BCHJ the square on side BC, and ACFG the square on side AC.
By connecting the adjacent outer vertices of these squares around each vertex of triangle ABC, three outer triangles AGD, BEJ, and CFH are formed.
For each outer triangle, take the median that passes through the corresponding vertex of triangle ABC and extend that median toward the inside of triangle ABC. These three outer medians meet at one point.
Given triangle ABC, write a program that computes the coordinates of this intersection point.
Input
The first line contains the number of test cases T. Each test case consists of three lines. Each of those lines gives the x- and y-coordinates of points A, B, and C in order.
No two points are the same, and the three points are never collinear.
Output
For each test case, print the x-coordinate and y-coordinate of the intersection point, separated by a space and rounded to four digits after the decimal point.