UV

namespace UV
universeVector.ts:1

Members

approxEquals

approxEquals(a: UniverseVector, b: UniverseVector, epsilon: number) → boolean
aUniverseVector
Undocumented
bUniverseVector
Undocumented
epsilonnumber
Undocumented

approxMeters

approxMeters(uv: UniverseVector) → Vec3

Absolute position as plain meters. Lossy by construction (that is the whole point of UniverseVector) — for display, coarse culling and tests only.

uvUniverseVector
Undocumented

difference

difference(a: UniverseVector, b: UniverseVector) → Vec3

a - b as a displacement in meters.

Valid at any separation: the result is a double, so a galaxy-crossing difference is quantized to ~1e5 m, while the near-field differences that actually feed physics and rendering keep full double precision.

aUniverseVector
Undocumented
bUniverseVector
Undocumented

distance

distance(a: UniverseVector, b: UniverseVector) → number
aUniverseVector
Undocumented
bUniverseVector
Undocumented

distanceSquared

distanceSquared(a: UniverseVector, b: UniverseVector) → number

Squared distance without the sqrt. Overflows to Infinity past ~1e154 m; harmless here.

aUniverseVector
Undocumented
bUniverseVector
Undocumented

equals

equals(a: UniverseVector, b: UniverseVector) → boolean
aUniverseVector
Undocumented
bUniverseVector
Undocumented

format

format(uv: UniverseVector) → string
uvUniverseVector
Undocumented

fromMeters

fromMeters(x: number, y: number, z: number) → UniverseVector

Build from absolute meters.

The conversion itself is exact; the input is a double, so a galactic-scale literal has already lost precision before it arrives (~2 km at 1e19 m). That is fine for the only thing that uses it — placing catalog stars, whose published positions are uncertain by far more than that — and wrong for anything else, which should be translating from an existing position instead.

xnumber
Undocumented
ynumber
Undocumented
znumber
Undocumented

fromVec3

fromVec3(v: Vec3) → UniverseVector
vVec3
Undocumented

isValid

isValid(uv: UniverseVector) → boolean
uvUniverseVector
Undocumented

POSITION_RESOLUTION

POSITION_RESOLUTION: Meters

Worst-case position resolution anywhere in the universe, in meters.

SECTOR_EXPONENT

SECTOR_EXPONENT: 40

log2 of the sector edge length in meters.

SECTOR_INDEX_LIMIT

SECTOR_INDEX_LIMIT: number

Exclusive bound on |sector index| — sector indices are int32.

SECTOR_SIZE

SECTOR_SIZE: Meters

Sector edge length in meters (2^40 ≈ 7.35 AU).

sectorKey

sectorKey(uv: UniverseVector) → string

Stable key for the containing sector — used by spatial indexes and streaming.

uvUniverseVector
Undocumented

translate

translate(uv: UniverseVector, delta: Vec3) → UniverseVector

Move by a displacement expressed in universe axes.

uvUniverseVector
Undocumented
deltaVec3
Undocumented

UNIVERSE_HALF_EXTENT

UNIVERSE_HALF_EXTENT: Meters

Half the addressable universe, in meters.

UNIVERSE_ORIGIN

UNIVERSE_ORIGIN: UniverseVector

universeVector

universeVector(sx: number, sy: number, sz: number, ox: number, oy: number, oz: number) → UniverseVector
sxnumber
Undocumented
synumber
Undocumented
sznumber
Undocumented
oxnumber
Undocumented
oynumber
Undocumented
oznumber
Undocumented

UniverseVector

UniverseVector: unknown

Absolute position in the universe.

Invariant, maintained by every constructor here: each offset component lies in [0, SECTOR_SIZE) and each sector component is an integer in (-SECTOR_INDEX_LIMIT, SECTOR_INDEX_LIMIT). Callers must not build these by object literal; use universeVector / fromMeters / translate.

Generated from the source of @inertialref/spatial and its comments. Nothing on this page is written by hand.