astro.codex region lookup.Function.findCodexRegionForBoxel - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki
@elite-dangerous-almanac/core / astro/codex-region-lookup / findCodexRegionForBoxel
findCodexRegionForBoxel(
id64):BoxelCodexRegionLookup
Defined in: src/astro/codex-region-lookup.ts:246
Find the galactic region of a system's boxel, from its system address (id64).
This is the region written to the player journal and shown on the codex main
page for the system. It is resolved from the 0/0/0 corner of the system's
boxel, which can differ from findCodexRegionAt of the system's exact
coordinates near a region border.
The 64-bit system address, as a bigint, a normally parsed journal
number, or a decimal string (see SystemAddressInput).
The boxel corner coordinates — galactic light-years, Sol at origin —
and the region there. Those coordinates are also the closest this library gets to
a position for an id64 alone: the corner of the system's boxel, so they are
accurate to one boxel edge (boxelEdgeLy of the size class: 10 ly for mass
code a, 1280 ly for h).
If id64 is not a usable address representation.
If the address is outside 64 bits.
import { findCodexRegionForBoxel } from '@elite-dangerous-almanac/core/astro/codex-region-lookup';
findCodexRegionForBoxel(5306097239922n).region?.name; // -> the codex region
// Approximate position from an id64 alone (boxel corner, in light-years):
const { x, y, z } = findCodexRegionForBoxel(3309179996515n);
({ x, y, z }); // -> { x: 735, y: -185, z: -105 }