Giter Club home page Giter Club logo

kepler.js's Introduction

Kepler.js

Build Status

A package for working with two-body Keplerian Orbits.

Installation

Release pending, but you can source it in your package.json from Github for now.

package.json

{
  "name": "my-package",
  "dependencies": {
    "kepler.js": "jordanstephens/kepler.js"
  }
}

Usage

Defining an Orbit

The easiest way to define an orbit is with common orbital elements.

var qzss = Kepler.Orbit.fromParams({
  semimajorAxis: 42164, // km
  eccentricity: 0.075,
  inclination: 43, // deg
  rightAscension: 195, // deg
  argumentOfPeriapsis: 270 // deg
});

QZSS orbital parameters from Wikipedia.

You can also use more colloquial elements like perigee and apogee instead of semimajorAxis and eccentricity.

var iss = Kepler.Orbit.fromParams({
  apogee: 426.9, // km
  perigee: 416.2, // km
  inclination: 51.65, // deg
  rightAscension: 304.1, // deg
  argumentOfPeriapsis: 117.8 // deg
});

ISS orbital parameters from Wolfram Alpha.

Or you can use position (r) and velocity (v) vectors.

var r = [-6045, -3490, 2500],
    v = [-3.457, 6.618, 2.533],
    orbit = new Kepler.Orbit(r, v);

Orbital Attributes

Defining an orbit gives you access to the object's current position (r) and velocity (v) vectors along with many other attributes, including:

  • semimajorAxis
  • semilatusRectum
  • apoapsis
  • periapsis
  • eccentricity
  • angularMomentum
  • radialVelocity
  • inclination
  • rightAscension
  • argumentOfPeriapsis
  • trueAnomaly
  • period

Updating an Orbit After dt

Once you have an initial orbit defined, you can get updated position (r) and velocity (v) vectors after a period of time (in seconds) has passed.

iss.r // => [4427.6294614883145, 662.2433879237291, 5103.355851378229]
iss.v // => [-3.000020372892516, 6.843005359324254, 1.7091866273043546]

// Update vectors after 45 minutes have passed
iss.update(60 * 45)

iss.r // => [-4662.9620885090435, -88.56494596532605, -4943.141439770972]
iss.v // => [2.5073027532818064, -6.876096362825007, -2.248327189819066]

Caveats

  • Only point objects are considered in a two-body environment.
  • Perturbations due to atmospheric drag, solar radiation, etc are not considered.
  • Nodal precession is not considered.

Tests

Tests can be run with npm

$ npm test

Most of the specs contain values used in examples found in Orbital Mechanics for Engineering Students.

kepler.js's People

Contributors

jordanstephens avatar 09silverware avatar

Stargazers

 avatar AllenGair avatar Albert R. Timashev avatar  avatar Scott Lott avatar Jeff Wakeman avatar Lourenzo Ferreira avatar Dave Thomas avatar Marcel Greter avatar

Watchers

Stefano Cudini avatar  avatar James Cloos avatar

kepler.js's Issues

Publish a package in npm

It would be convenient to publish the package in npm. That's rather straightforward and fast to do.
For some reason re. the tooling I use in my CI/CD, I cannot use the turnaround solution that is mentionned in the README.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.