Used std::atan2 to handle most of the work in get_distance.
Merge pull request #582 from Morwenn/get_distance

Used std::atan2 to handle most of the work in get_distance.