Nine-Point Circle

In geometry, the nine-point circle is a circle that can be con- structed for any given triangle. It is so named because it passes through nine significant points defined from the triangle. These nine points are: • The midpoint of each side of the triangle • The foot of each altitude • The midpoint of the line segment from each vertex of the triangle to the orthocenter (where the three altitudes meet; these line segments lie on their respective altitudes). The nine-point circle is also known as Feuerbach’s circle, Euler’s circle, Terquem’s circle, the six- point circle, the twelve-point circle, the n-point circle, the medioscribed circle, the mid circle or the circum-midcircle. Given three non-collinear points A, B and C, you’re to calculate the center position and radius of triangle ABC’s nine-point circle. Input There will be at most 100 test cases. Each case contains 6 integers x1, y1, x2, y2, x3, y3 (0 ≤ x1,y1,x2,y2,x3,y3 ≤ 1000), the coordinates of A, B and C. The last test case is followed by a line with six ‘-1’, which should not be processed. Output For each test case, print three real numbers x, y, r, indicating that the nine point circle is centered at (x, y), with radius r. The numbers should be rounded to six decimal places. Sample Input 0 0 10 0 3 4 -1 -1 -1 -1 -1 -1 Sample Output 4.000000 2.312500 2.519456