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.
npm install orbjs
var orb = require('orbjs');
import orb from 'orbjs';
<script src="dist/orb.min.js"></script>
# orb.constants.common
# orb.constants.time
# orb.constants.earth
# orb.constants.earth.wgs84
# orb.constants.earth.grs80
# orb.common.deg2rad(deg) Converts degree to radian
# orb.common.rad2deg(rad) Converts radian to degree
# 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, ms].
# 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, α, axis)
- Input:
- x: [x, y, z] Inertial
- α: angle between the inertial and fixed systems
- axis: 1, 2 or 3
- Output:
- x: [x, y, z] Fixed
# orb.transformations.fixedToInertial(x, α, axis)
- Input:
- x: [x, y, z] Fixed
- α: angle between the fixed and inertial systems
- 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.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
- [ x, xDot ]
# 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.functions.era(days)
- Input:
- days: UT1 days since J2000.0
- Output:
- era: ERA (radians)
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.