GeoCoord constructor

const GeoCoord(
  1. double latitude,
  2. double longitude
)

Creates a geographical location specified in degrees latitude and longitude.

The latitude is clamped to the inclusive interval from -90.0 to +90.0.

The longitude is normalized to the half-open interval from -180.0 (inclusive) to +180.0 (exclusive)

Implementation

const GeoCoord(double latitude, double longitude)
    : latitude =
          (latitude < -90.0 ? -90.0 : (90.0 < latitude ? 90.0 : latitude)),
      longitude = (longitude + 180.0) % 360.0 - 180.0;