Documentation / @interstellar-tools/equations / geodeticToBodyFixed
Function: geodeticToBodyFixed()
ts
function geodeticToBodyFixed(
phi: Radians,
lambda: Radians,
h: number,
a: number,
eSquared: number
): Vector3DTupleType;Defined in: cartography/geodetic-to-body-fixed.ts:76
Convert geodetic coordinates (latitude, longitude, height) to a body-fixed Cartesian position, ECEF for Earth.
Where:
is the geodetic latitude and the longitude (rad) is the height above the ellipsoid, along its normal (m) is the equatorial radius (m) and the first eccentricity squared is the prime vertical radius of curvature (m), from primeVerticalRadiusOfCurvature
Units
- Inputs:
phiandlambdain radians,handain m,eSquareddimensionless. - Output:
[x, y, z]in m, withalong the rotation axis and through the prime meridian.
Notes
- Geodetic latitude is the angle of the ellipsoid's normal, the latitude on maps. The geocentric latitude, the angle seen from the centre, is
atan2(z, hypot(x, y))of the result, and is smaller everywhere but the equator and the poles. - WGS84:
m, . Get from the radii with eccentricitySquaredOblateSpheroid. - bodyFixedToGeodetic goes the other way.
In practiceApollo 11, on Pad 39A
6 373.3 km
From Earth's centre, at 28.608° N geodetic, 80.604° W on the WGS84 ellipsoid
The geocentric latitude is 28.447°, 0.161° less than on the map. That's the latitude the launch-site formulas such as surfaceRotationSpeed need.
ts
const [x, y, z] = geodeticToBodyFixed(
toRad(28.608422),
toRad(-80.604133),
0,
6_378_137,
0.00669437999014
);
Math.hypot(x, y, z); // ≈ 6 373 266 m
toDeg(Math.atan2(z, Math.hypot(x, y))); // ≈ 28.447°Parameters
| Parameter | Type | Description |
|---|---|---|
phi | Radians | Geodetic latitude |
lambda | Radians | Longitude |
h | number | Height |
a | number | Equatorial radius |
eSquared | number | First eccentricity squared |
Returns
Body-fixed position [x, y, z] in m.
Throws
- If any input is not a finite number.
- If
phiis outside [-π/2, π/2],a <= 0, oreSquaredis outside [0, 1).
Example
ts
import type { Radians } from '@interstellar-tools/types';
// On the equator at the prime meridian, 100 m up
geodeticToBodyFixed(
0 as Radians,
0 as Radians,
100,
6_378_137,
0.00669437999014
);
// [6 378 237, 0, 0]See
- bodyFixedToGeodetic
- eccentricitySquaredOblateSpheroid
- https://en.wikipedia.org/wiki/Geographic_coordinate_conversion Geographic coordinate conversion