Rangefinder
Semantic Source Selection

An iOS rangefinder that selects the best depth source per frame across six heterogeneous sensors—from LiDAR at arm's length to terrain ray-casting at 2,000 meters.

iOS 18+ Swift 6.0 312 Tests LiDAR Required

Every depth sensor has a range where it works and a range where it lies. LiDAR is centimeter-accurate at 3 meters but returns nothing at 50. Neural depth estimation looks plausible at 30 meters but hallucinates mountains into nearby hills at 200. No weighted average of sources that individually produce wrong answers can produce a right answer.

Rangefinder replaces weighted-average fusion with a deterministic priority chain. Instead of blending all sources, the system selects one authoritative source per frame—the one that is mathematically trustworthy at the current distance and scene geometry. A second hypothesis is tracked independently via dual Kalman filters, giving the operator context about what's in front of and behind the primary target.

Stadiametric LiDAR Object Detection DEM Neural Geometric
SourceRangeMethod
LiDAR 0.3–12m Direct time-of-flight depth from ARKit
Neural Depth 2–50m DepthAnythingV2 with continuous LiDAR calibration
Geometric 5–200m Ground-plane trigonometry via IMU pitch
DEM Ray-Cast 20–2,000m Digital elevation model terrain intersection
Object Detection 20–1,000m Known-size object pinhole ranging via CoreML
Stadiametric 5–1,500m User-directed bracket overlay with target presets

Dual Kalman Filters

Foreground and background depth tracked independently with automatic filter reset on semantic source switches.

Neural Hard Cap

Inverse-depth noise amplification makes neural estimates unreliable beyond 50m. The system knows when to stop trusting the model.

Operator Guidance

IMU-based coaching engine modeled on military marksmanship doctrine: stability detection, respiratory pause windows, reading lock confirmation.

Golf Mode

Stadiametric ranging with USGA regulation flagstick preset (2.13m). Club-selection accuracy: ±2 yards at 150 yards at 5–8× zoom.

DEM Map Verification

MapKit picture-in-picture showing the ray-cast hit point on satellite imagery. See exactly where the terrain intersection landed.

Ballistic Solver

Inclination-corrected distance output with optional holdover computation for angled shots. True horizontal distance, not line-of-sight.

Layer 8  UI Presentation
         RangefinderView, SceneRangeOverlay, HUD, Operator Guidance

Layer 7  Operator Guidance Engine
         IMU stability, coaching hints, respiratory pause capture

Layer 6  Output Processing
         Ballistics solver, inclination corrector

Layer 5  Temporal Filtering
         Dual Kalman (fg + bg), motion-aware smoother, outlier reject

Layer 4  Semantic Source Selection
         Priority state machine: one source per frame

Layer 3  Depth Source Estimation
         LiDAR, Neural+Cal, Geometric, DEM, Object, Stadiametric

Layer 2  Sensor Abstraction
         CameraManager, InclinationManager, LocationManager

Layer 1  Hardware
         LiDAR, Camera, IMU, GPS, Magnetometer, Barometer
312
Unit Tests
6
Depth Sources
2km
Max Range
60Hz
Frame Rate
<10%
Mean Error
8
Architecture Layers
Swift 6.0 SwiftUI ARKit CoreML Vision DepthAnythingV2 MapKit CoreMotion CoreLocation Metal XcodeGen Kalman Filters