A Java library of Astronomical Algorithms
This is a library of (hopefully) useful astronomical algorithms. This library
is based on a class-oriented C++ library I wrote. The C++ library, in turn,
was originally based on the C source code written by Bill Gray and available
at the Project Pluto
It has been "transmogrified" a bit since it's origins. I've changed some
things, reorganized some things, and added some things, using information
from Jean Meeus' excellent book
The biggest differences between this code and the Bill's original code are
- It's in Java (duh ;-), so everything is a class or part of a class.
- I added a lot of static constants to avoid "magic numbers" as much as
possible - there's plenty enough of those in the orbital elements and
- I used native types like
int whereever possible,
dropping Bill's original byte-frugal storage strategies. This eliminates
Bill's "wrong-endian" byte alignment worries. In addition, Java only
runs on 32-bit general-purpose platforms, so there's no need to fit
things in a 64K segment :-).
- I unwound some of Bill's clever algorithm implementations. I find
as I get older (and hopefully wiser) that performance can always be
tweaked if necessary, but code readability needs to be "baked in."
I formerly used this code to run astronomical servlets on the
DVAA web site, in particular, a lunar
phase display on the home page, and a Darkness Planner information
page. Unfortunately, our provider dropped java support(!), so these are
no longer available there. :-(
Questions are welcome.
Copyright Restrictions: In the spirit of Bill's original source,
you are free to use this for non-commercial purposes - but please give us
a mention if you do so! For commercial usage, please
contact me first.
Mark Huss - July 2011
- Version 1.0 - original release
- Version 1.1 - rationalized the code a bit, added Exceptions, added a load
of javadoc documentation/comments, and switched from Make to
Ant for the build.
- Version 1.1.1 - fixed LunarCalc.Lunation() and bug in Lunar( time )
- Version 1.1.2 - fixed LunarCalc.summary() and RiseSet.getTimes() functions.
- Version 1.1.3 - fixed a couple of bugs in Lunar() and one in DateOps.
(Thank you to Tom Fly for spotting these.)
- Added optional Calendar parameter to TimeOps.tzOffset() functions,
so non-local TZ calcs could be performed.
- Version 1.1.4 - added XYZ to LocationElements.
- Added RightAscention and Declination to PlanetData
(Thanks again to Tom Fly).
- Made sure all dependent Util classes are included!
- Version 1.1.4a - changed PlanetData.getPolar* to getHeliocentric* to
make clear what coordinates are stored there.
- Version 1.1.5ws - bug fixes and modest additions contributed by
Dr. Wolfgang Strickling