UNPKG

ootk-core

Version:

Orbital Object Toolkit. A modern typed replacement for satellite.js including SGP4 propagation, TLE parsing, Sun and Moon calculations, and more.

189 lines (188 loc) 9.01 kB
/** * @author Theodore Kruczek. * @license MIT * @copyright (c) 2022-2025 Theodore Kruczek Permission is * hereby granted, free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the * Software without restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * the Software, and to permit persons to whom the Software is furnished to do * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ import { Degrees, EcefVec3, EcfVec3, EciVec3, EnuVec3, GreenwichMeanSiderealTime, Kilometers, LlaVec3, Radians, RaeVec3, Sensor, SezVec3 } from '../main.js'; /** * Converts ECF to ECI coordinates. * * [X] [C -S 0][X] * [Y] = [S C 0][Y] * [Z]eci [0 0 1][Z]ecf * @param ecf takes xyz coordinates * @param gmst takes a number in gmst time * @returns array containing eci coordinates */ export declare function ecf2eci<T extends number>(ecf: EcfVec3<T>, gmst: number): EciVec3<T>; /** * Converts ECEF coordinates to ENU coordinates. * @param ecf - The ECEF coordinates. * @param lla - The LLA coordinates. * @returns The ENU coordinates. */ export declare function ecf2enu<T extends number>(ecf: EcefVec3<T>, lla: LlaVec3): EnuVec3<T>; /** * Converts ECI to ECF coordinates. * * [X] [C -S 0][X] * [Y] = [S C 0][Y] * [Z]eci [0 0 1][Z]ecf * * Inverse: * [X] [C S 0][X] * [Y] = [-S C 0][Y] * [Z]ecf [0 0 1][Z]eci * @param eci takes xyz coordinates * @param gmst takes a number in gmst time * @returns array containing ecf coordinates */ export declare function eci2ecf<T extends number>(eci: EciVec3<T>, gmst: number): EcfVec3<T>; /** * EciToGeodetic converts eci coordinates to lla coordinates * @variation cached - results are cached * @param eci takes xyz coordinates * @param gmst takes a number in gmst time * @returns array containing lla coordinates */ export declare function eci2lla(eci: EciVec3, gmst: number): LlaVec3<Degrees, Kilometers>; /** * Converts geodetic coordinates (longitude, latitude, altitude) to Earth-Centered Earth-Fixed (ECF) coordinates. * @param lla The geodetic coordinates in radians and meters. * @returns The ECF coordinates in meters. */ export declare function llaRad2ecf<AltitudeUnits extends number>(lla: LlaVec3<Radians, AltitudeUnits>): EcfVec3<AltitudeUnits>; /** * Converts geodetic coordinates (longitude, latitude, altitude) to Earth-Centered Earth-Fixed (ECF) coordinates. * @param lla The geodetic coordinates in degrees and meters. * @returns The ECF coordinates in meters. */ export declare function lla2ecf<AltitudeUnits extends number>(lla: LlaVec3<Degrees, AltitudeUnits>): EcfVec3<AltitudeUnits>; /** * Converts geodetic coordinates (latitude, longitude, altitude) to Earth-centered inertial (ECI) coordinates. * @variation cached - results are cached * @param lla The geodetic coordinates in radians and meters. * @param gmst The Greenwich Mean Sidereal Time in seconds. * @returns The ECI coordinates in meters. */ export declare function lla2eci(lla: LlaVec3<Radians, Kilometers>, gmst: GreenwichMeanSiderealTime): EciVec3<Kilometers>; /** * Calculates Geodetic Lat Lon Alt to ECEF coordinates. * @deprecated This needs to be validated. * @param lla The geodetic coordinates in degrees and meters. * @returns The ECEF coordinates in meters. */ export declare function lla2ecef<D extends number>(lla: LlaVec3<Degrees, D>): EcefVec3<D>; /** * Converts LLA to SEZ coordinates. * @see http://www.celestrak.com/columns/v02n02/ * @param lla The LLA coordinates. * @param ecf The ECF coordinates. * @returns The SEZ coordinates. */ export declare function lla2sez<D extends number>(lla: LlaVec3<Radians, D>, ecf: EcfVec3<D>): SezVec3<D>; /** * Converts a vector in Right Ascension, Elevation, and Range (RAE) coordinate system * to a vector in South, East, and Zenith (SEZ) coordinate system. * @param rae The vector in RAE coordinate system. * @returns The vector in SEZ coordinate system. */ export declare function rae2sez<D extends number>(rae: RaeVec3<D, Radians>): SezVec3<D>; /** * Converts a vector in Right Ascension, Elevation, and Range (RAE) coordinate system * to Earth-Centered Fixed (ECF) coordinate system. * @template D - The dimension of the RAE vector. * @template A - The dimension of the LLA vector. * @param rae - The vector in RAE coordinate system. * @param lla - The vector in LLA coordinate system. * @returns The vector in ECF coordinate system. */ export declare function rae2ecf<D extends number>(rae: RaeVec3<D, Degrees>, lla: LlaVec3<Degrees, D>): EcfVec3<D>; /** * Converts a vector from RAE (Range, Azimuth, Elevation) coordinates to ECI (Earth-Centered Inertial) coordinates. * @variation cached - results are cached * @param rae The vector in RAE coordinates. * @param lla The vector in LLA (Latitude, Longitude, Altitude) coordinates. * @param gmst The Greenwich Mean Sidereal Time. * @returns The vector in ECI coordinates. */ export declare function rae2eci<D extends number>(rae: RaeVec3<D, Degrees>, lla: LlaVec3<Degrees, D>, gmst: number): EciVec3<D>; /** * Converts a vector in RAE (Range, Azimuth, Elevation) coordinates to ENU (East, North, Up) coordinates. * @param rae - The vector in RAE coordinates. * @returns The vector in ENU coordinates. */ export declare function rae2enu(rae: RaeVec3): EnuVec3<Kilometers>; /** * Converts South, East, and Zenith (SEZ) coordinates to Right Ascension, Elevation, and Range (RAE) coordinates. * @param sez The SEZ coordinates. * @returns Rng, Az, El array */ export declare function sez2rae<D extends number>(sez: SezVec3<D>): RaeVec3<D, Radians>; /** * Converts Earth-Centered Fixed (ECF) coordinates to Right Ascension (RA), * Elevation (E), and Azimuth (A) coordinates. * @param lla The Latitude, Longitude, and Altitude (LLA) coordinates. * @param ecf The Earth-Centered Fixed (ECF) coordinates. * @returns The Right Ascension (RA), Elevation (E), and Azimuth (A) coordinates. */ export declare function ecfRad2rae<D extends number>(lla: LlaVec3<Radians, D>, ecf: EcfVec3<D>): RaeVec3<D, Degrees>; /** * Converts Earth-Centered Fixed (ECF) coordinates to Right Ascension (RA), * Elevation (E), and Azimuth (A) coordinates. * @variation cached - results are cached * @param lla The Latitude, Longitude, and Altitude (LLA) coordinates. * @param ecf The Earth-Centered Fixed (ECF) coordinates. * @returns The Right Ascension (RA), Elevation (E), and Azimuth (A) coordinates. */ export declare function ecf2rae<D extends number>(lla: LlaVec3<Degrees, D>, ecf: EcfVec3<D>): RaeVec3<D, Degrees>; export declare const jday: (year?: number, mon?: number, day?: number, hr?: number, minute?: number, sec?: number) => number; /** * Calculates the Greenwich Mean Sidereal Time (GMST) for a given date. * @param date - The date for which to calculate the GMST. * @returns An object containing the GMST value and the Julian date. */ export declare function calcGmst(date: Date): { gmst: GreenwichMeanSiderealTime; j: number; }; /** * Converts ECI coordinates to RAE (Right Ascension, Azimuth, Elevation) coordinates. * @variation cached - results are cached * @param now - Current date and time. * @param eci - ECI coordinates of the satellite. * @param sensor - Sensor object containing observer's geodetic coordinates. * @returns Object containing azimuth, elevation and range in degrees and kilometers respectively. */ export declare function eci2rae(now: Date, eci: EciVec3<Kilometers>, sensor: Sensor): RaeVec3<Kilometers, Degrees>; /** * Calculates the inertial azimuth of a satellite given its latitude and inclination. * @param lat - The latitude of the satellite in degrees. * @param inc - The inclination of the satellite in degrees. * @returns The inertial azimuth of the satellite in degrees. */ export declare function calcInertAz(lat: Degrees, inc: Degrees): Degrees; /** * Calculates the inclination angle of a satellite from its launch azimuth and latitude. * @param lat - The latitude of the observer in degrees. * @param az - The launch azimuth angle of the satellite in degrees clockwise from north. * @returns The inclination angle of the satellite in degrees. */ export declare function calcIncFromAz(lat: number, az: number): number;