| 17 | double constexpr kEarthRadiusMetersSquared = kEarthRadiusMeters * kEarthRadiusMeters; |
| 18 | |
| 19 | m3::PointD GetPointOnSphere(LatLon const & ll, double sphereRadius) |
| 20 | { |
| 21 | ASSERT(LatLon::kMinLat <= ll.m_lat && ll.m_lat <= LatLon::kMaxLat, (ll)); |
| 22 | ASSERT(LatLon::kMinLon <= ll.m_lon && ll.m_lon <= LatLon::kMaxLon, (ll)); |
| 23 | |
| 24 | double const latRad = math::DegToRad(ll.m_lat); |
| 25 | double const lonRad = math::DegToRad(ll.m_lon); |
| 26 | |
| 27 | double const x = sphereRadius * cos(latRad) * cos(lonRad); |
| 28 | double const y = sphereRadius * cos(latRad) * sin(lonRad); |
| 29 | double const z = sphereRadius * sin(latRad); |
| 30 | |
| 31 | return {x, y, z}; |
| 32 | } |
| 33 | } // namespace |
| 34 | |
| 35 | // Look to https://en.wikipedia.org/wiki/Solid_angle for more details. |
no test coverage detected