Intersecting Circles of Common Radii

Problem #44

Tags: geometry

Who solved this?

Previous:Casino City Highway Access Next:Intersecting Circles of Different Radii


Let's imagine two circles each having the equal radii r but with different centerpoints located at (x1, y1) and (x2, y2), such that the two circles intersect. What is the area of the intersecting region?

intersection

What is the total area of the purple region bounded by the intersecting circles?

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 x2 y2 describing two intersecting circles with radius r.

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

Example

input data:
2
1 0 0 1 0
10 47 40 35 42

answer:
1.228370 86.820991
You need to login to get test data and submit solution.