orbjs v0.2.2
orb
orb offers a few simple methods for several common problems of orbital mechanics, like transformations between various coordinate systems and simple orbit propagation using Keplerian elements.
Installation
npm install orbjs
Usage
ES5 - CommonJS
var orb = require('orbjs');
ES5 - Browser
<script src="dist/orb.min.js"></script>
ES6
import orb from 'orbjs/src/orb';
API
orb.constants
# orb.constants.common
# orb.constants.time
# orb.constants.earth
# orb.constants.earth.wgs84
# orb.constants.earth.grs80
orb.common
# orb.common.deg2rad(deg) Converts degree to radian
# orb.common.rad2deg(rad) Converts radian to degree
orb.time
# orb.time.JDtoMJD(jd) JD to MJD days
# orb.time.MJDtoJD(mjd) MJD to JD days
# orb.time.TAItoTT(tai) TAI to TT
# orb.time.TTtoTAI(tt) TT to TAI
# orb.time.TAItoUTC(tai) TAI to UTC
# orb.time.UTCtoTAI(utc) UTC to TAI
# orb.time.TAItoGPS(tai) TAI to GPS
# orb.time.GPStoTAI(gps) GPS to TAI
# orb.time.UTCtoGPS(utc) UTC to GPS
# orb.time.GPStoUTC(gps) GPS to UTC
# orb.time.leapSeconds(date) Amount of leap seconds that occurred before date
. date
is a JS Date object.
# orb.time.dateToJD(date) Convert a date to Julian Date. date
is either a Date object, or an array of the form y, m, d, h, m, s.
orb.transformations
# orb.transformations.sphericalToCartesian(x)
- Input: * x: λ, φ, r Spherical (longitude, (geocentric) latitude, radius)
- Output: * x: x, y, z Cartesian
# orb.transformations.cartesianToSpherical(x)
- Input: * x: x, y, z Cartesian
- Output: * x: λ, φ, r Spherical (longitude, (geocentric) latitude, radius)
# orb.transformations.ellipsoidalToCartesian(x, a, e)
- Input: x: L, β Ellipsoidal (longitude, reduced latitude) a: semimajor-axis of body * e: eccentricity of body
- Output: * x: x, y, z Cartesian
# orb.transformations.cartesianToEllipsoidal(x, a, e)
- Input: x: x, y, z Cartesian a: semimajor-axis of body * e: eccentricity of body
- Output: * x: L, β Ellipsoidal (longitude, reduced latitude)
# orb.transformations.geodeticToCartesian(x, a, e)
- Input: x: L, B, h Geodetic (longitude, geodetic latitude, height above ellipsoid) a: semimajor-axis of body * e: eccentricity of body
- Output: * x: x, y, z Cartesian
# orb.transformations.cartesianToGeodetic(x, a, e)
- Input: x: x, y, z Cartesian a: semimajor-axis of body * e: eccentricity of body
- Output: * x: L, B, h Geodetic (longitude, geodetic latitude, height above ellipsoid)
# orb.transformations.orbitalPlaneToInertial(x, Ω, ω, i)
- Input: x: x, y Position of object in orbital plane Ω: right ascension of the ascending node ω: argument of periapsis i: inclination
- Output: * x: x, y, z Inertial
# orb.transformations.inertialToFixed(x, Δt, ω, axis)
- Input: x: x, y, z Inertial Δt: time since x1 axis of inertial and fixed were congruent ω: rotational speed of body axis: 1, 2 or 3
- Output: * x: x, y, z Fixed
# orb.transformations.fixedToInertial(x, Δt, ω, axis)
- Input: x: x, y, z Fixed Δt: time since x1 axis of inertial and fixed were congruent ω: rotational speed of body axis: 1, 2 or 3
- Output: * x: x, y, z Inertial
# orb.transformations.fixedToTopocentric(x, obs, a, e, nwu)
- Input: x: x, y, z Fixed obs: L, B, h a: semimajor-axis of body e: eccentricity of body
- Output: * x: x, y, z Topocentric
# orb.transformations.topocentricToFixed(x, obs, a, e, nwu)
- Input: x: x, y, z Topocentric obs: L, B, h a: semimajor-axis of body e: eccentricity of body
- Output: * x: x, y, z Fixed
# orb.transformations.topocentricToHorizontal(x)
- Input: * x: x, y, z Topocentric
- Output: * x: azimuth, elevation, distance Horizontal
# orb.transformations.horizontalToTopocentric(x)
- Input: * x: azimuth, elevation, distance Horizontal
- Output: * x: x, y, z Topocentric
orb.position
# orb.position.keplerEquation(e, M)
- Input: e: eccentricity M: mean anomaly
- Output: * ν: true anomaly
# orb.position.keplerian(a, e, i, Ω, ω, t, t0, M0, m1, m2)
- Input: a: semimajor-axis of orbit e: eccentricity i: inclination Ω: right ascension of the ascending node ω: argument of periapsis t: time t t0: epoch of given elements M0: mean anomaly at epoch (optional, default: 0) m1: mass of body 1 (optional, default: GM = orb.constants.earth.GM) m2: mass of body 2 (optional, default: 0)
- Output: x, xDot x: x, y, z Position in inertial CRS * xDot: vx, vy, vz Velocity in inertial CRS
# orb.position.stateToKepler(x, xDot, t, m1, m2)
- Input:
- x: x, y, z Position in inertial CRS
- xDot: vx, vy, vz Velocity in inertial CRS
- t: time t
- m1: mass of body 1 (optional, default: GM = orb.constants.earth.GM)
- m2: mass of body 2 (optional, default: 0)
- Output:
- a, e, i, Ω, ω, T0
- a: semimajor-axis of orbit (or focal parameter for e = 1)
- e: eccentricity
- i: inclination
- Ω: right ascension of the ascending node
- ω: argument of periapsis
- T0: time of perihelion passage
- a, e, i, Ω, ω, T0
orb.vector
Common vector and matrix operations, these are only included to make dependencies unnecessary. Don’t use these, there are a lot of better, more comprehensive and well tested libraries to do this.