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

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

Function: absoluteBoxelToBoxelCode()

absoluteBoxelToBoxelCode(sizeClass, absoluteBoxel, origin): number | null

Defined in: src/astro/system-address.ts:177

Boxel code (base-26 index) of an absolute boxel relative to a region origin, or null when the boxel does not sit inside that region.

Used by the hand-authored-sector override: the same physical boxel yields a different boxel code under a hand-authored region whose origin differs from the procedural sector's. This is the inverse of boxelCodeToAbsoluteBoxel.

Parameters

sizeClass

number

Size class 0–7 (mass code ah).

absoluteBoxel

AbsoluteBoxel

The boxel's absolute grid indices, as decodeSystemAddress returns in absoluteBoxel.

origin

NamingRegionOrigin

The region origin to measure against (internal units, 32 per light-year), from ./naming-region-origins.

Returns

number | null

The base-26 boxel code within that region, or null when the boxel lies outside the region or the origin has a negative coordinate.

Example

import { resolveNamingRegionOrigin } from '@elite-dangerous-almanac/core/astro/naming-region-origins';
import { absoluteBoxelToBoxelCode, decodeSystemAddress } from '@elite-dangerous-almanac/core/astro/system-address';

declare const id64: bigint;

const { sizeClass, absoluteBoxel } = decodeSystemAddress(id64);
absoluteBoxelToBoxelCode(sizeClass, absoluteBoxel, resolveNamingRegionOrigin('Pleiades Sector')!);
⚠️ **GitHub.com Fallback** ⚠️