Skip to content

Documentation / @interstellar-tools/equations / planetocentricLatitude

Function: planetocentricLatitude() ​

ts
function planetocentricLatitude(x: number, y: number, z: number): number;

Defined in: cartography/planetocentric-latitude.ts:37

Compute planetocentric latitude (φc) from body-fixed Cartesian coordinates.

Planetocentric latitude is defined as the angle between the body's equatorial plane and the radius vector from the body's center of mass to the point:

φc=arctan(zx2+y2)

Implementation note:

  • This uses atan2(z, hypot(x,y)) for numerical stability and correct quadrant handling.

Parameters ​

ParameterTypeDescription
xnumberX coordinate in a body-fixed frame (finite).
ynumberY coordinate in a body-fixed frame (finite).
znumberZ coordinate in a body-fixed frame (finite).

Returns ​

number

Planetocentric latitude (φc) in radians (range: ([−π/2,π/2])).

Throws ​

If any input is not a finite number.

Example ​

ts
// Point directly above the equator on +X axis:
const phi = planetocentricLatitude(1, 0, 0);
// phi === 0

// Point on +Z axis:
const northPole = planetocentricLatitude(0, 0, 1);
// northPole === Math.PI / 2

See ​