| 9 | |
| 10 | template<typename T> |
| 11 | T Haversine(const cv::Point_<T>& from, const cv::Point_<T>& to) |
| 12 | { |
| 13 | constexpr T Deg2Rad = static_cast<T>(DEG_TO_RAD); |
| 14 | |
| 15 | T lat_arc = (from.x - to.x) * Deg2Rad; |
| 16 | T lon_arc = (from.y - to.y) * Deg2Rad; |
| 17 | T lat_h = sin(lat_arc * static_cast<T>(0.5)); |
| 18 | lat_h *= lat_h; |
| 19 | T lon_h = sin(lon_arc * static_cast<T>(0.5)); |
| 20 | lon_h *= lon_h; |
| 21 | T tmp = cos(from.x * Deg2Rad) * cos(to.y * Deg2Rad); |
| 22 | return static_cast<T>(2.0) * asin(sqrt(lat_h + tmp * lon_h)); |
| 23 | } |
| 24 | |
| 25 | /// |
| 26 | template<typename T> |
no test coverage detected