astro.Function.sectorGridPositionFromGalacticPosition - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki
@elite-dangerous-almanac/core / astro / sectorGridPositionFromGalacticPosition
sectorGridPositionFromGalacticPosition(
position):SectorGridPosition
Defined in: src/astro/galaxy-grid.ts:65
The sector cube a galactic position falls in.
Galactic position in light-years, Sol at the origin (a journal
StarPos, an EDSM/Spansh coordinate, a ProceduralSystem.position).
The integer SectorGridPosition of the 1280 ly sector cube containing that point, ready for sectorNameFromGridPosition.
If the position lies outside the 128×128×128 sector grid (i.e. outside the addressable galaxy). The message names the offending position.
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 }