Intersecting Spheres of Common Radii

Problem #47

Tags: geometry

Who solved this?

Previous:3 Points on a Plane Next:Intersecting Spheres of Different Radii


Now that we have observed the areas formed by intersecting circles, the next logical step is to observe the volumes formed by two intersecting spheres, each having centerpoints at some coordinates (x1, y1, z1) and (x2, y2, z2) and both having equal radii r.

intersection

What is the total area of the green region bounded by these intersecting spheres?

Problem Statement

Input Data
First line will be Q, the quantity of testcases.
Q lines will then follow, each holding a testcase in the format r x1 y1 x1 x2 y2 z2 describing two intersecting spheres with radius r.

Answer
Should consists of Q space-separated values corresponding to the volume of the region formed by the intersection of the two spheres described in each testcase.
Error should be less than 1e-3.

Example

input data:
1 0 0 0 1 0 0
21 -9 -8 -7 6 5 4

answer:
1.309 10411.400
You need to login to get test data and submit solution.