astro.Function.sectorGridPositionFromGalacticPosition - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki

@elite-dangerous-almanac/core / astro / sectorGridPositionFromGalacticPosition

Function: sectorGridPositionFromGalacticPosition()

sectorGridPositionFromGalacticPosition(position): SectorGridPosition

Defined in: src/astro/galaxy-grid.ts:65

The sector cube a galactic position falls in.

Parameters

position

GalacticPosition

Galactic position in light-years, Sol at the origin (a journal StarPos, an EDSM/Spansh coordinate, a ProceduralSystem.position).

Returns

SectorGridPosition

The integer SectorGridPosition of the 1280 ly sector cube containing that point, ready for sectorNameFromGridPosition.

Throws

If the position lies outside the 128×128×128 sector grid (i.e. outside the addressable galaxy). The message names the offending position.

Example

import { sectorGridPositionFromGalacticPosition } from '@elite-dangerous-almanac/core/astro/galaxy-grid';

// Synuefe EN-H d11-96 sits at (751, -179, -91) per EDSM
sectorGridPositionFromGalacticPosition({ x: 751, y: -179, z: -91 });
// -> { sectorX: 39, sectorY: 31, sectorZ: 18 }
⚠️ **GitHub.com Fallback** ⚠️