Skip to content

Documentation / @interstellar-tools/maps / ellipseOutline

Function: ellipseOutline() ​

ts
function ellipseOutline(
  grid: GridInterface,
  ellipse: GroundEllipseInterface,
  points?: number
): GridPositionInterface[];

Defined in: terrain/ellipse.ts:89

The outline of an ellipse on the ground, as places on a grid, to draw it.

e=acos⁡tsin⁡ψ+bsin⁡tcos⁡ψn=acos⁡tcos⁡ψ−bsin⁡tsin⁡ψ

Where:

  • a and b are its semi-major and semi-minor axes, and ψ its azimuth
  • e and n are how far east and north of its centre the place at t is, in m, turned into rows and columns by the cell size

Notes

  • The first place, at t=0, is the long axis's end in the direction of azimuth; the places go round from there, a quarter turn later at the short axis's end on its right. The last is the first again, to close it.
  • The grid is taken as flat with north up, so it suits an ellipse a few kilometres across on a map with little distortion there.

Parameters ​

ParameterTypeDefault valueDescription
gridGridInterfaceundefinedThe grid, for its cell size.
ellipseGroundEllipseInterfaceundefinedThe ellipse.
points?number96How many places round it (an integer ≥ 3). Defaults to 96.

Returns ​

GridPositionInterface[]

points + 1 places, in grid coordinates.

Throws ​

  • If a size, cell size or the ellipse's centre, axes or azimuth is not finite.
  • If the grid's parts don't fit together, an axis is not > 0, or points is not an integer ≥ 3.

Example ​

ts
// Perseverance's landing ellipse, 7.7 km × 6.6 km, long side east–west
ellipseOutline(grid, {
  centre,
  semiMajorAxis: 3850,
  semiMinorAxis: 3300,
  azimuth: toRad(90)
});

See ​

ellipseCells