regionDirection

function regionDirection
universe/src/terrain.ts:187
regionDirection(region: RegionAddress, s: number, t: number) → BodyFixedDirection

Direction of a normalized (s, t) position inside a region.

s and t are in [0,1] over the region itself and may run outside it. That is not a tolerated overflow, it is the mechanism a bordered patch and a cross-face neighbor both rest on: the gnomonic map extends smoothly past a cube face's edge, and normalize of the extended coordinate lands on exactly the direction the adjacent face parameterizes at that point. Face 0 at u = 1 + ε is face 5 at u = −1/(1 + ε), which is inside face 5 by construction — so a patch that samples one row beyond its own edge is sampling its neighbor's first interior row, whichever face that neighbor is on, with no rotation table and no special case at a face corner.

The one limit is range: past |u| ≈ 3 the gnomonic extension is approaching the perpendicular and the cell it names stops being adjacent to anything. Callers step by a border ring or by a cell, which is far inside that.

regionRegionAddress
Undocumented
snumber
Undocumented
tnumber
Undocumented