Struct GeocentricCoordinate

A geocentric Cartesian coordinate (x, y, z).

struct GeocentricCoordinate(T)
  
if (isGeodesyScalar!T);

The type does not encode a CRS, datum, ellipsoid, or linear unit. All three components use one caller-selected linear unit; when combined with an ellipsoid, its axes must use that same unit.

.init is the representable geocentre (0,0,0). Whether an operation is mathematically defined there is the responsibility of that operation. Checked construction rejects non-finite components without throwing; throwing construction uses GeodesyValueException.

Properties

NameTypeDescription
x[get] TGeocentric X component.
y[get] TGeocentric Y component.
z[get] TGeocentric Z component.

Methods

NameDescription
fromComponents (x, y, z) Construct from finite X/Y/Z components.
tryFromComponents (x, y, z, result) Construct from finite X/Y/Z components without throwing.

Example

Example constructing a geocentric coordinate.

import geodesy;

const p = GeocentricCoordinate!double.fromComponents(
    4_085_000.0, 1_260_000.0, 4_717_000.0);

assert(p.x == 4_085_000.0);
assert(p.y == 1_260_000.0);
assert(p.z == 4_717_000.0);