AstroLib is a Java library for astro charting calculations. There are house system and planet position calculation methods together with date/time and location conversion routines. For a given time the positions of the planets in the zodiac are calculated. It is based on my Zodiac Watch, an astro-chart real-time watch applet. After putting the applet on my homepage, I got a lot of requests regarding its Java source. So I removed all painting and user interface routines to create a library.
Note that there is no code for graphical representations or drawing a chart. The library contains just methods for calculating the data needed to build a chart. Some methods were simply taken from Astrolog and converted to Java. Part of the code is commented in German, but the variables' and methods' names are all English.
To install AstroLib, simply extract the astrolib-*.zip and add astrolib.jar to your classpath. AstroLib is JDK 1.1 compliant and does not depend on any other libraries.
The library is used as shown in the Demo
class' main
method:
// get a horoscop instance final TextHoroscop horoscop = new TextHoroscop(); // set your desired planet position calculation algorithm horoscop.setPlanet(new PlanetAA0()); // set your desired house system calculation algorithm // may be anything from the at.kugel.zodiac.house package. horoscop.setHouse(new HousePlacidus()); // set your user data time value horoscop.setTime(1, 12, 1953, 20); // set your user data location value horoscop.setLocationDegree(-16 - 17.0 / 60, 48 + 4.0 / 60); // calculate the values horoscop.calcValues(); // do something with the data or output raw data System.out.println(horoscop.toString());
In case you want to add or change something, there are the following packages:
at.kugel.zodiac.util
contains some independent calculation utility
functions and classes.at.kugel.zodiac.planet
contains the different planet position
calculation algorithms. This package is only dependent on the util package.
All planet position algorithms are subclasses of PlanetBasic
which itself implements PlanetInt
. New and more accurate
planet position algorithms must implement PlanetInt
and
may wish to extend PlanetBasic
to inherit common
functionality, but are not forced to do so. There is only PlanetAA0
available at the moment, which is not very accurate.at.kugel.zodiac.house
contains the different house systems.
All house system calculation algorithms are subclasses of HouseBasic
which itself implements HouseInt
.at.kugel.zodiac
is the main package and contains the
TextHoroscop
class, which uses the house house system and planet
calculation classes to calculate the astro-chart data.test
contains just debug stuff.AstroLib is Open Source under the GPL license.