Package-level declarations
Types
Where the spatial map reads elevation from: the terrain store in the app, a synthetic source in tests.
The round area the spatial map shows. The terrain is a disk of this radius; the elevation grid, the map image and terrain downloads cover bounds, the square around it.
The local frame a spatial map is built in: meters from the center of a geographic box, with x east, y up and z south (north is away from a viewer standing south of the model). The box is small enough that a flat-earth conversion around its center is accurate to well under a meter, which is finer than any mesh position.
Elevations sampled on a regular lon/lat grid over a box: the ground the terrain mesh is built on.
Which circle the spatial map shows. The circle is rebuilt only when it has to be: a node outside it, or the mesh having shrunk well inside it, so the terrain is not rebuilt on every refresh.
Scales the local meters frame into the model: the box fits a footprint of about a meter and relief is exaggerated so a tabletop model still reads as hills.
What the spatial map needs to know about one mesh node.
The buffers of a mesh drawn over the terrain. Positions and normals are xyz triples, uvs are uv pairs.
How well the connected radio hears a node, weakest first.
Storage caps the download decision measures against.
What the spatial map should do to keep its box covered by an offline map: streets and terrain. The app keeps one full offline map of its own and grows or moves it as the mesh changes; the user's regions count as coverage but are never changed.
Retry rules for automatic downloads, per target area: a failure waits 10 min · 2^n before the next try and stops after three; a cancel stops automatic tries for that area this session.
Why the spatial map can't download its map for the whole box.
How much of a box the downloaded terrain covers.
The terrain mesh plus the height field it was built from, in model units. The mesh is a disk inscribed in the box: a regular grid with the vertices outside the circle moved onto it, and a round skirt below the edge so the model reads as a solid table. Buffers are flat: positions and normals hold xyz triples, textureCoordinates uv pairs.
How the round map sits in the volume: centered on the baseplate and filling its footprint, less a margin around the rim for the bezel and its handles. Resizing the volume resizes the map.
A drag that follows the hand around the middle of the table, like turning a wheel.
Sizes of the compass bezel and the handles around the disk, in meters.
The wheel's turn as it is shown, stepped once per frame. A drag sets where the wheel is heading; each frame eases the shown turn toward it, and a release with some speed keeps the wheel spinning until friction stops it. Times are in seconds, angles in radians.
Turns a sideways hand movement into a spin. A look-and-pinch drag moves the hand only a few centimeters, so following its angle around the middle barely turned the map; this turns the map by the distance moved, in the direction that carries the grabbed point along with the hand.
Zooming the spatial map into the geography. The table keeps its size; the circle it shows gets smaller around a center, and the terrain is rebuilt for it. Zoom 1 is the whole mesh.
Tile-grid math the height grid samples through.
Functions
Pads each side by max(minPadMeters, ratio × the box's size) and snaps outward to z10 tile edges, so small moves of the mesh give the same area and nothing is downloaded again.
Width and height in meters, measured across the middle of the box.