0067. Three Spheres

Имя входного файла: spheres.in
Имя выходного файла: spheres.out
Ограничение по времени: 1 s
Ограничение по памяти: 64 megabytes

You are given three spheres in the space. Find all their common tangent planes, i.e. such planes that touch each of the given spheres in exactly one point.

Input file

The first line of the input file contains one integer number M – the number of test cases. The following 3M lines contain descriptions of test cases, three lines per test case. Each line in the test case describes one sphere. Each description contains four integer numbers: x, y, z and r – coordinates of the center and the radius of the sphere (-500 ≤ x, y, z ≤ 500, 0 < r ≤ 500). Sphere centers do not coincide and do not lie on the same line.

Output file

For each test case first output K – the number of different tangent planes for given spheres. Next K lines must contain four real numbers A, B, C and D each, such that A2+B2+C2=1 and the equation describing the plane is Ax+By+Cz=D. Plane descriptions may be printed in arbitary order. Output all numbers with at least eight digits after the decimal point.

Examples:

spheres.inspheres.out
1 0 0 0 1 0 2 0 1 2 0 0 14 0.00000000 1.00000000 0.00000000 1.00000000 1.00000000 0.00000000 0.00000000 1.00000000 0.00000000 0.00000000 1.00000000 -1.00000000 0.00000000 0.00000000 1.00000000 1.00000000


Источник: Petrozavodsk Winter 2003. St. Petersburg Contest I

Обсудить       Отправить решение



Версия для печати