world-topology

The pure spatial math behind the coordinate-free MinSimApi surface (world-contract §8).

The contract's whole bet is that coordinates never cross the membrane — the driver (and a human) see topology + a qualitative distance ladder, never x/y/z. But the sim still keeps real geometry on its own side to compute those qualities. This module is that computation, factored out Babylon-free and deterministic so it can be unit-tested without a store or an engine — same discipline as fly-by-wire / formations / ballistics. The stateful WorldStore holds the place graph + sim-private positions and delegates the maths here.

Three pure functions, three jobs:

Example

import { proximityRung, routePortals } from 'tosijs-3d'
// proximityRung(1.8, 'small') → 'reach';  proximityRung(1.8, 'vast') → 'same-spot'
// routePortals(portals, 'study', 'garden') → { portals: ['door-1','gate-2'], cost: 45 } | null