The Lake Voyage

Problem #33

Tags: geometry

Who solved this?

Previous:A Heron's Journey Next:Ant Colonies


Marisol lives in a small village nearby the shore of a large circular lake. Today is her Grandmother's birthday, who lives on the other side of the lake. Marisol plans to leave her house and take a directly straight path to her Grandmother's village, using a raft or canoe to cross the lake if necessary.

Given the positions of Marisol's house, her Grandmother's house, and the lake, what percentage of Marisol's path will consist of traveling over the lake?

Voyage

The path directly between Marisol's house and her Grandmother's house, which crosses over the lake for some portion of the total journey (about 53% in this example).

Problem Statement

Input Data
The first line will be Q, the quantity of testcases.
Q lines will then follow, each with seven space-separated values in the format xM yM xG yG xL yL R, with (xM, yM) being the coordinates of Marisol's house, (xG, yG) being the coordinates of the Grandmother's house, (xL, yL) being the coordinates of the lake's centerpoint, and R being the radius of the lake.

Answer
Should consist of Q space-separated values corresponding to the percentage of Marisol's path which will consist of water-travel.
Report this percetage as a decimal values between 0 and 1.
Error should be less than 1e-6.

Example

input data:
3
1 1 -1 -1 0 0 1
0 2 2 -1 0 0 1
1 2 -3 -4 -1 -2 2

answer:
0.707107 0 0.532939
You need to login to get test data and submit solution.