Skip to content

spatial-monorepo


spatial-monorepo / wayfinding/src / getBaseOccupancyGridForLevel

Function: getBaseOccupancyGridForLevel()

getBaseOccupancyGridForLevel(archive, levelId, opts?): BaseOccupancyGrid

Defined in: packages/wayfinding/src/grid-relaxation.ts:115

Returns the cached per-level BaseOccupancyGrid (walls + openings + fixtures — everything not relaxation-rung-specific), building and caching it on first use (issue #483 AC1: "base grid build happens once per level per IMDF version, not once per route call"). Keyed by archive object identity, so a caller must construct a new IMDFArchive object on IMDF mutation for this to invalidate (the existing pattern getFloorConnectivityGraph already relies on) — call invalidateBaseOccupancyGridCache explicitly if a caller ever mutates an archive object in place instead of replacing it.

opts.fixtures, when the caller supplies it explicitly, is deliberately excluded from the cache key (baseGridCacheKey/BaseGridCacheOptions only cover the resolution/stroke/fixture-upscale knobs) — two calls that differ only in opts.fixtures would otherwise silently reuse whichever fixture set was rasterized first. Bypassing the cache entirely whenever opts.fixtures is explicitly supplied keeps that override correct (at the cost of not caching it); the canonical, cached path is the normal one where fixtures are derived from archive.fixtures/archive.kiosks filtered to levelId.

Parameters

archive

IMDFArchive

levelId

string

opts?

GridLadderOptions = {}

Returns

BaseOccupancyGrid

Released under commercial licensing.