swe-glib/params.json

1 line
5.7 KiB
JSON
Raw Normal View History

2013-10-01 11:07:30 +00:00
{"name":"SWE-GLib","tagline":"A GLib style wrapper library around Swiss Ephemeris","body":"# SWE-GLib\r\n\r\nSWE-GLib is a GLib style wrapper library around Astrodienst's [Swiss Ephemeris library](http://www.astro.com/swisseph/).\r\n\r\nThe source tree contains Astrodienst's ephemeride files, as requested by Alois Treindl of Astrodienst in a mail written to me on 24 July, 2013.\r\n\r\n## GTK-Doc\r\n\r\nThe project utilizes [GTK-Doc](http://www.gtk.org/gtk-doc/), requiring version 1.19 or later. Although the generated documentation is a bit messy (not everything is documented, and there are some unresolved variables, like [SERVER] on the generated index page.\r\n\r\nStill, the documentation generates well, and at least gives a clue about object usage.\r\n\r\n## Bindings\r\n\r\nSWE-GLib utilizes [GObject Introspection](https://wiki.gnome.org/GObjectIntrospection), which means it is available for many languages. Check out the [examples](examples) directory for some sample code!\r\n\r\n## Usage\r\n\r\nMany functions return non-opaque C structs; their documentation can be found inline, and in the generated GTK-Doc. Unless otherwise stated, the returned values should never be freed.\r\n\r\n### Creating the required objects\r\n\r\nThen you need to create a `GsweTimestamp` object:\r\n\r\n```c\r\nGsweTimestamp *timestamp = gswe_timestamp_new_from_gregorian_full(1983, 3, 7, 11, 54, 45, 0, 1.0);\r\n```\r\n\r\nThe `GsweTimetamp` object is used to convert dates between the Gregorian calendar dates and Julian Day values (not to be confused with Julian calendar dates).\r\n\r\nNext, you have to create a `GsweMoment` object:\r\n\r\n```c\r\nGsweMoment *moment = gswe_moment_new_full(timestamp, 19.081599, 47.462485, 300.0, GSWE_HOUSE_PLACIDUS);\r\n```\r\n\r\nThe `GsweMoment` object holds information of a given moment at a given place on earth. `gswe_moment_new_full()` requires a `GsweTimestamp` object, some geographical coordinates (in degrees) together with altitude above sea level (in meters), and a house system to use.\r\n\r\n### Adding planets\r\n\r\nAfter that you have to add some planets you want to do calculations on.\r\n\r\n```c\r\ngswe_moment_add_planet(moment, GSWE_PLANET_SUN);\r\n```\r\n\r\nAlternatively, you can add every planets known by SWE-GLib with\r\n\r\n```c\r\ngswe_moment_add_all_planets(moment);\r\n```\r\n\r\n### Getting planet positions and such\r\n\r\nThen, you can get the planet data with\r\n\r\n```c\r\nGswePlanetData *sun_data = gswe_moment_get_planet(moment, GSWE_PLANET_SUN);\r\n```\r\n\r\n### Getting aspects and antiscia\r\n\r\nSWE-GLib is also able to calculate aspects and antiscia. This functionality does not exist in the Swiss Ephemeris library, though. For this, of course, you have to add multiple planets (at least two) to your `GsweMoment`. After that, you can call `gswe_moment_get_planet_aspects()` and `gswe_moment_get_planet_antiscia()`.\r\n\r\n```c\r\nGList *sun_aspects = gswe_moment_get_planet_aspects(moment, GSWE_PLANET_SUN);\r\nGList *sun_antiscia = gswe_moment_get_planet_antiscia(moment, GSWE_PLANET_SUN);\r\n```\r\n\r\nThe returned GList objects hold zero or more `GsweAspectData` or `GsweAntiscionData` objects, respectively.\r\n\r\n### Getting the Moon phase\r\n\r\nLast, but not least, SWE-GLib can calculate Moon's phase at the given moment. For that, you have to call `gswe_moment_get_moon_phase()`:\r\n\r\n```c\r\nGsweMoonPhaseData *moon_phase = gswe_moment_get_moon_phase(moment);\r\n```\r\n\r\n### About altitude\r\n\r\nThe Swiss Ephemeris library requires the altitude value to be specified for several calculations. It also notifies how important it is:\r\n\r\n> the altitude above sea must be in meters. Neglecting the altitude can result in an error of about 2 arc seconds with the moon and at an altitude 3000m.\r\n\r\n2 arc seconds is about 0.000555 degrees of error, which is, well, kind of small. Of course, if you need very precise horoscopes or need planetary positions for a totally different thing, you should really provide a (close to) exact value; otherwise, it is safe to pass any value (well, whi