AstroLib

A Java library of Astronomical Algorithms

com.mhuss.AstroLib

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 website.

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 Astronomical Algorithms.

The biggest differences between this code and the Bill's original code are

  1. It's in Java (duh ;-), so everything is a class or part of a class.
  2. 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 formulas!
  3. 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 :-).
  4. 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
 


History