MGRS/UTM geodetic conversion and 3D screen-to-sphere raycasting
TerraGemini integrates a full WGS84 ellipsoid geodetic conversion engine with real-time screen-to-sphere raycasting and 3D target lock tracking.
1. Screen-to-Sphere Raycasting
When the user clicks or hovers at screen coordinate , the coordinate is unprojected into spherical unit space relative to center and scale :
If , front-hemisphere depth is computed and multiplied by the inverse camera rotation matrix to extract geodetic latitude and longitude .
2. WGS84 to MGRS (1-Meter Precision)
The geodetic coordinates are processed through a UTM projection engine (calculating meridian arc distance and 5th-order series expansions) and mapped to the Military Grid Reference System (MGRS):
- Derives the 6° UTM zone and 8° latitude band.
- Identifies the 100,000m grid square using DoD/NGA row letter offset sets.
- Produces 1-meter precision coordinates (e.g.
18T WL 83959 07350).
The locked target maintains dynamic 3D-to-2D screen tracking, rendering animated radar rings, occlusion culling on back-face rotation, and dynamic SVG leader lines anchored to the telemetry HUD.