npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

orbjs

v0.2.2

Published

orb offers a few simple methods for several common problems of orbital mechanics

Downloads

23,872

Readme

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.

npm version Build Status Join the chat at https://gitter.im/benelsen/orb

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

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.

License

MIT