Struct Longitude
Geodetic longitude in the closed interval [-pi,+pi] radians.
struct Longitude(T)
if (isGeodesyScalar!T);
The equivalent degree domain is [-180,+180]. Both antimeridian endpoint
representations are accepted by construction. normalized maps the
positive endpoint to the unique half-open representation from -pi
inclusive to +pi exclusive. is the prime meridian.
Checked factories return false for non-finite or out-of-domain input;
throwing factories throw GeodesyValueException for the same inputs.
Properties
| Name | Type | Description |
|---|---|---|
asAngle[get]
|
Angle!T | Return the same angular value as a general Angle!T.
|
degrees[get]
|
T | Longitude in degrees. |
normalized[get]
|
Longitude | Return the unique representation from -pi inclusive to +pi exclusive. |
radians[get]
|
T | Longitude in radians. |
Methods
| Name | Description |
|---|---|
fromDegrees
(degrees)
|
Construct a longitude from degrees. |
fromRadians
(radians)
|
Construct a longitude from radians. |
tryFromDegrees
(degrees, result)
|
Construct a longitude from degrees without throwing. |
tryFromRadians
(radians, result)
|
Construct a longitude from radians without throwing. |
Example
Example constructing and normalizing a longitude.
import geodesy;
const eastAntimeridian = Longitude!double .fromDegrees(180.0);
assert(eastAntimeridian .degrees == 180.0);
assert(eastAntimeridian .normalized .degrees == -180.0);
Longitude!double checked;
assert(!Longitude!double .tryFromDegrees(181.0, checked));