File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,17 +22,13 @@ export function getAzEl(
2222) : { az : number ; el : number } {
2323 const DEG2RAD = Math . PI / 180 ;
2424
25- const satR = Math . sqrt ( eciX * eciX + eciY * eciY + eciZ * eciZ ) ;
26- if ( satR === 0 ) return { az : 0 , el : - 90 } ;
25+ if ( eciX === 0 && eciY === 0 && eciZ === 0 ) return { az : 0 , el : - 90 } ;
2726
28- // Satellite geocentric lat/lon from ECI, then to ECEF
29- const satLat = Math . asin ( eciZ / satR ) ;
30- const satLonEci = Math . atan2 ( eciY , eciX ) ;
31- const satLonEcef = satLonEci - gmstRad ;
32-
33- const sx = satR * Math . cos ( satLat ) * Math . cos ( satLonEcef ) ;
34- const sy = satR * Math . cos ( satLat ) * Math . sin ( satLonEcef ) ;
35- const sz = satR * Math . sin ( satLat ) ;
27+ // ECI to ECEF via Rz(-GMST)
28+ const cg = Math . cos ( gmstRad ) , sg = Math . sin ( gmstRad ) ;
29+ const sx = cg * eciX + sg * eciY ;
30+ const sy = - sg * eciX + cg * eciY ;
31+ const sz = eciZ ;
3632
3733 // Observer ECEF position (WGS-84 ellipsoid)
3834 const obs = geodeticToEcef ( obsLatDeg , obsLonDeg , obsAltM ) ;
You can’t perform that action at this time.
0 commit comments