Table of Contents

Class TerrainCoverageClamp

Namespace
LansMap.Core.View

Derives the tightest pitch and zoom bounds tile selection can still promise full coverage for, once NearEdgeTerrainMarginPx(double) is accounted for.

public static class TerrainCoverageClamp
Inheritance
object
TerrainCoverageClamp

Remarks

Static, deterministic: a pure function of its arguments, no state. Not allocation-free itself (each probe builds a short-lived MapViewTransform), so callers on an interaction path belong behind a cache that recomputes only on real input drift - see TerrainCoverageClampCache. On flat terrain (pose.MaxElevationMeters zero or less) every method here returns its staticCapDeg/staticFloorZoom argument unchanged, so a caller with elevation off pays nothing and behaves byte-identical to today.

Methods

MaxCoveredPitchDeg(in CoverageClampPose, double, List<TileCoord>)

Largest pitch, in degrees, at which the elevation-expanded footprint still fits LayerBudget and the ground-plane solve still succeeds over the expanded rect.

public static double MaxCoveredPitchDeg(in CoverageClampPose pose, double staticCapDeg, List<TileCoord> scratch)

Parameters

pose CoverageClampPose

The probe inputs. ZoomOrPitch is read as the fixed zoom level to probe at.

staticCapDeg double

The cap that applies with elevation off; also the ceiling this method bisects down from, since the clamp only ever tightens.

scratch List<TileCoord>

Reused scratch list for the probe sweeps. Cleared and refilled by every probe; the caller owns its lifetime so a recompute allocates no list of its own.

Returns

double

A pitch in [0, staticCapDeg]. Never larger than staticCapDeg.

MinCoveredZoom(in CoverageClampPose, double, List<TileCoord>)

Smallest zoom at which the elevation-expanded footprint still fits LayerBudget and the ground-plane solve still succeeds over the expanded rect.

public static double MinCoveredZoom(in CoverageClampPose pose, double staticFloorZoom, List<TileCoord> scratch)

Parameters

pose CoverageClampPose

The probe inputs. ZoomOrPitch is read as the fixed pitch to probe at.

staticFloorZoom double

The floor that applies with elevation off; also the floor this method bisects up from, since the clamp only ever tightens.

scratch List<TileCoord>

Reused scratch list; see MaxCoveredPitchDeg(in CoverageClampPose, double, List<TileCoord>).

Returns

double

A zoom at or above staticFloorZoom. Never smaller.

Remarks

Zooming out shrinks WorldSizePx, which shrinks the elevation margin in lockstep (it is proportional to world size px), so in practice this rarely raises the floor above staticFloorZoom. It exists for the same reason MaxCoveredPitchDeg(in CoverageClampPose, double, List<TileCoord>) does: a caller that clamps one axis and not the other still has a documented answer for both.