Brief Problem Explanation
Write a program to find the minimum distance between two points traveling only on rays emanating from the origin and circles centered on the origin.
Explanation of Premise
Now let's imagine we are on a plane, and on this plane we are only allowed to travel in special ways. We are allowed to travel on any ray emanating from the origin.
We can also travel on any circle centered at a circle
Now our goal is to travel from one point on this plane to another. However, we can't just travel in a simple Euclidian path, we can only do this if the points happen to fall on a ray emanating from the center.
We can travel on this one because it falls on a one of our rays.
We can also travel on circles centered at the origin.
Now here is the challenge:
We've got to get from one point to another in the shortest path; often this is a combination of traveling on circles and rays.
This, however, it could also be traveling on two rays.
Sometimes there exist two paths that travel the minimum distance.
Your challenge is to write a program that when given two points will give us the minimum distance between them if we follow these rules. The inputs can be given in either rectangular or polar forms and the output ought to be one number, the distance between.
(with rectangular input)
(1,1) (1,-1) -> ~ 2.22144 (0,0) (1, 1) -> ~ 1.41421 (1,0) (-0.4161 , 0.90929) -> ~ 2 (1,1) (1, 0) -> ~ 1.19961 (1,2) (3, 4) -> ~ 3.16609