Astronomical Algorithms in JavaScript.
The ongoing rewrite for v3 will have arbitrary-precision, thanks to decimal.js.
Other implementations: Swift (SwiftAA) , C# (AASharp).
At the beginning, aa-js
is the port in javascript of the C++ implementation of Astronomical
Algorithms by J.P. Naughter, called AA+,
based on the reference text book by Jean Meeus. It is written in TypeScript, and
covered as much as possible with tests validating the correctness
of the algorithms. Tests are inspired from Jean Meeus' book and those written in
SwiftAA, and are much more extended than what is available
in AA+.
aa-js
is the backbone of scientific algorithms used
in Arcsecond.io.
I am the author of the Swift version too. It's called SwiftAA.
- All algorithms based on arbitrary-precision operations thanks to decimal.js.
nutation
module moved inside theearth
module.- Moved all (non-Earth) planets modules inside a
planets
folder. - Addition of numerous orbital getters for planets (mean longitude, semi-major axis, inclination, eccentricity...)
- Much easier and cleaner distinction between heliocentric and geocentric coordinates of planets.
- Added a transformation from equatorial to topocentric coordinates.
- Important bugfix on
getPositionAngle
andgetPhaseAngle
in theMoon
module.
- Planets: all the (static and dynamic) details, coordinates, quantities about
Mercury
,Venus
,Mars
,Jupiter
,Saturn
,Neptune
and of coursePluto
: planet constants, aphelion, perihelion, phase angle, illuminated fraction, magnitude, semi-diameters. - In addition, for
Mars
: the planetocentric declination of the Sun and the Earth - In addition, for
Jupiter
: the planetocentric declination of the Sun and the Earth - In addition for
Saturn
: the details of the rings system Earth
&Moon
: all the coordinates, and many details about the MoonSun
: mean & true anomaly, coordinatesjuliandays
: creation, transformation, local mean sidereal time.cosmology
: the cosmology calculator from Ned Wright's, but re-implementeddistances
: all the conversions of distancesnutation
: in longitude, for obliquity, true & mean obliquity of the eclipticprecession
: all the precession functions between epochs for coordinatessexagesimal
: utilities for manipulating sexagesimalstransits
: get rise, transit and set hours, dates, julian days, as well as altitude.
npm install aa-js
import { juliandays, Earth } from 'aa-js'
const jd = juliandays.getJulianDay(new Date())
const coords = Earth.Moon.getEquatorialCoordinates(jd)
Almost every method is documented (quite sparingly sometimes). A good knowledge of basic astronomy helps very much. A copy of the Astronomical Algorithms textbook, by Jean Meeus (amazon) would also help, since many methods refer to it.
We have some difficulties configuring both Typescript and Typedoc at the same time. Hence, the documentation is not published in GH pages. If anyone knows how to do it, please submit a PR.