Skip to content

Documentation / @interstellar-tools/equations / isOnTriaxialEllipsoidSurface

Function: isOnTriaxialEllipsoidSurface() ​

ts
function isOnTriaxialEllipsoidSurface(
  x: number,
  y: number,
  z: number,
  a: number,
  b: number,
  c: number,
  eps?: number
): boolean;

Defined in: cartography/is-on-triaxial-ellipsoid-surface.ts:53

Test whether a 3D point lies on the surface of a triaxial ellipsoid (within a tolerance).

A triaxial ellipsoid centered at the origin with semi-axes (a), (b), (c) aligned to the (x), (y), (z) axes is defined by the implicit surface:

x2a2+y2b2+z2c2=1

This function evaluates the left-hand side and checks whether it is within eps of 1.

Notes:

  • This is a pure geometric surface membership test; it does not compute the closest point on the ellipsoid or any geodetic latitude/longitude.
  • For ellipsoids of revolution (oblate/prolate), you typically have (a=b), but this supports the general triaxial case.

Parameters ​

ParameterTypeDefault valueDescription
xnumberundefinedX coordinate (finite).
ynumberundefinedY coordinate (finite).
znumberundefinedZ coordinate (finite).
anumberundefinedSemi-axis length along x (finite, > 0).
bnumberundefinedSemi-axis length along y (finite, > 0).
cnumberundefinedSemi-axis length along z (finite, > 0).
epsnumber1e-12Allowed absolute tolerance on the implicit value (finite, >= 0). Defaults to 1e-12.

Returns ​

boolean

true if the point satisfies the ellipsoid equation within eps, otherwise false.

Throws ​

If any input is not a finite number.

Throws ​

If a <= 0, b <= 0, c <= 0, or eps < 0.

Examples ​

ts
// Ellipsoid with semi-axes a=3, b=2, c=1
// Point on +X axis should be on the surface: (x,y,z) = (a,0,0)
const onSurface = isOnTriaxialEllipsoidSurface(3, 0, 0, 3, 2, 1);
// onSurface === true
ts
// Slightly off the surface (use a looser eps if needed)
const onSurface = isOnTriaxialEllipsoidSurface(3.0000001, 0, 0, 3, 2, 1, 1e-6);
// onSurface === true

See ​