isValidUserPosition

open fun isValidUserPosition(p: Position): Boolean

True when p represents a real positioning fix, not the engine's uninitialized sentinel. Used to gate distance/proximity computations so they don't silently use Mercator origin (0, 0) as the user location.

Rejects:

  • null
  • timestamp <= 0 — no fix has been produced yet
  • NaN on either x or y — engine quaternion div-by-zero corruption
  • Near-origin coords (|x| < 1 && |y| < 1) — the engine's partial-fusion sentinel where propertyId has been stamped but Mercator coords haven't been computed yet. Mapsted properties are never within 1 m of Mercator origin (lat=0, lon=0 in the Gulf of Guinea); this is a safe defensive zone.

Without the near-origin reject, a Position like (propertyId=1639, x=0.001, y=0.0, timestamp>0) passed the strict (x==0 && y==0) check, producing pseudoManhattan((0,0), SardarMercator) * 0.92 ≈ 11,065 km for every nearby-POI distance — the user-visible "11,000 km" bug.