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.

133 lines (132 loc) 5.27 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 { Minutes, PositionVelocity, Degrees, Kilometers, Radians } from '../main.js'; import { EpochUTC } from '../time/EpochUTC.js'; import { EquinoctialElements } from './EquinoctialElements.js'; import { OrbitRegime } from '../enums/OrbitRegime.js'; import { StateVector } from './StateVector.js'; import { ClassicalElementsParams } from '../interfaces/ClassicalElementsParams.js'; /** * The ClassicalElements class represents the classical orbital elements of an object. * @example * ```ts * const epoch = EpochUTC.fromDateTime(new Date('2024-01-14T14:39:39.914Z')); * const elements = new ClassicalElements({ * epoch, * semimajorAxis: 6943.547853722985 as Kilometers, * eccentricity: 0.0011235968124658146, * inclination: 0.7509087232045765 as Radians, * rightAscension: 0.028239555738616327 as Radians, * argPerigee: 2.5386411901807353 as Radians, * trueAnomaly: 0.5931399364974058 as Radians, * }); * ``` */ export declare class ClassicalElements { epoch: EpochUTC; semimajorAxis: Kilometers; eccentricity: number; inclination: Radians; rightAscension: Radians; argPerigee: Radians; trueAnomaly: Radians; /** Gravitational parameter in km³/s². */ mu: number; constructor({ epoch, semimajorAxis, eccentricity, inclination, rightAscension, argPerigee, trueAnomaly, mu, }: ClassicalElementsParams); /** * Creates a new instance of ClassicalElements from a StateVector. * @param state The StateVector to convert. * @param mu The gravitational parameter of the central body. Default value is Earth's gravitational parameter. * @returns A new instance of ClassicalElements. * @throws Error if the StateVector is not in an inertial frame. */ static fromStateVector(state: StateVector, mu?: number): ClassicalElements; /** * Gets the inclination in degrees. * @returns The inclination in degrees. */ get inclinationDegrees(): Degrees; /** * Gets the right ascension in degrees. * @returns The right ascension in degrees. */ get rightAscensionDegrees(): Degrees; /** * Gets the argument of perigee in degrees. * @returns The argument of perigee in degrees. */ get argPerigeeDegrees(): Degrees; /** * Gets the true anomaly in degrees. * @returns The true anomaly in degrees. */ get trueAnomalyDegrees(): Degrees; /** * Gets the apogee of the classical elements. It is measured from the surface of the earth. * @returns The apogee in kilometers. */ get apogee(): Kilometers; /** * Gets the perigee of the classical elements. The perigee is the point in an * orbit that is closest to the surface of the earth. * @returns The perigee distance in kilometers. */ get perigee(): number; toString(): string; /** * Calculates the mean motion of the celestial object. * @returns The mean motion in radians. */ get meanMotion(): Radians; /** * Calculates the period of the orbit. * @returns The period in seconds. */ get period(): Minutes; /** * Compute the number of revolutions completed per day for this orbit. * @returns The number of revolutions per day. */ get revsPerDay(): number; /** * Returns the orbit regime based on the classical elements. * @returns The orbit regime. */ getOrbitRegime(): OrbitRegime; /** * Converts the classical orbital elements to position and velocity vectors. * @returns An object containing the position and velocity vectors. */ toPositionVelocity(): PositionVelocity; /** * Converts the classical elements to equinoctial elements. * @returns The equinoctial elements. */ toEquinoctialElements(): EquinoctialElements; /** * Propagates the classical elements to a given epoch. * @param propEpoch - The epoch to propagate the classical elements to. * @returns The classical elements at the propagated epoch. */ propagate(propEpoch: EpochUTC): ClassicalElements; }