Update Swiss Ephemeris to 2.0

This commit is contained in:
Gergely Polonkai 2014-05-21 17:04:54 +02:00
parent 26dcd74338
commit 45833584b7
29 changed files with 31105 additions and 31926 deletions

View File

@ -3,6 +3,9 @@ m4_define([swe_glib_minor_version], [0])
m4_define([swe_glib_micro_version], [3]) m4_define([swe_glib_micro_version], [3])
m4_define([swe_glib_version], [swe_glib_major_version.swe_glib_minor_version.swe_glib_micro_version]) m4_define([swe_glib_version], [swe_glib_major_version.swe_glib_minor_version.swe_glib_micro_version])
m4_define([swe_glib_api_version], [swe_glib_major_version.0]) m4_define([swe_glib_api_version], [swe_glib_major_version.0])
m4_define([swe_major_version], [2])
m4_define([swe_minor_version], [0])
m4_define([swe_version], [swe_major_version.swe_minor_version])
AC_INIT([SWE-GLib], [swe_glib_version], [gergely@polonkai.eu], [swe-glib]) AC_INIT([SWE-GLib], [swe_glib_version], [gergely@polonkai.eu], [swe-glib])
AM_INIT_AUTOMAKE([-Wall foreign]) AM_INIT_AUTOMAKE([-Wall foreign])
@ -26,6 +29,7 @@ AC_SUBST([SWE_GLIB_MICRO_VERSION], [swe_glib_micro_version])
AC_SUBST([SWE_GLIB_VERSION], [swe_glib_version]) AC_SUBST([SWE_GLIB_VERSION], [swe_glib_version])
AC_SUBST([SWE_GLIB_API_VERSION], [swe_glib_api_version]) AC_SUBST([SWE_GLIB_API_VERSION], [swe_glib_api_version])
AC_SUBST([SWE_GLIB_API_VERSION_U], [AS_TR_SH([swe_glib_api_version])]) AC_SUBST([SWE_GLIB_API_VERSION_U], [AS_TR_SH([swe_glib_api_version])])
AC_SUBST([SWE_VERSION], [swe_version])
AC_PROG_CC AC_PROG_CC
AM_PROG_CC_C_O AM_PROG_CC_C_O
@ -68,7 +72,7 @@ PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.32.0])
PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.32.0]) PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.32.0])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
LIBSWE_LIBS='$(top_builddir)/swe/src/libswe-1.76.la' LIBSWE_LIBS='$(top_builddir)/swe/src/libswe-$(SWE_VERSION).la'
AC_SUBST(LIBSWE_LIBS) AC_SUBST(LIBSWE_LIBS)
LIBSWE_GLIB_LIBS='$(top_builddir)/src/libswe-glib-$(SWE_GLIB_API_VERSION).la' LIBSWE_GLIB_LIBS='$(top_builddir)/src/libswe-glib-$(SWE_GLIB_API_VERSION).la'

View File

@ -70,7 +70,7 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/locale/hu/LC_MESSAGES/swe-glib.mo
%files %files
%doc ChangeLog %doc ChangeLog
%{_libdir}/libswe-1.76.so.* %{_libdir}/libswe-@SWE_VERSION@.so.*
%{_libdir}/libswe-glib-@SWE_GLIB_API_VERSION@.so.* %{_libdir}/libswe-glib-@SWE_GLIB_API_VERSION@.so.*
%{_libdir}/girepository-1.0/SweGlib-@SWE_GLIB_API_VERSION@.typelib %{_libdir}/girepository-1.0/SweGlib-@SWE_GLIB_API_VERSION@.typelib
@ -84,7 +84,7 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/locale/hu/LC_MESSAGES/swe-glib.mo
%{_includedir}/* %{_includedir}/*
%{_libdir}/pkgconfig/* %{_libdir}/pkgconfig/*
%{_datadir}/gir-1.0/SweGlib-@SWE_GLIB_API_VERSION@.gir %{_datadir}/gir-1.0/SweGlib-@SWE_GLIB_API_VERSION@.gir
%{_libdir}/libswe-1.76.so %{_libdir}/libswe-@SWE_VERSION@.so
%{_libdir}/libswe-glib-@SWE_GLIB_API_VERSION@.so %{_libdir}/libswe-glib-@SWE_GLIB_API_VERSION@.so
%{_datadir}/vala/vapi/SweGlib-@SWE_GLIB_API_VERSION@.vapi %{_datadir}/vala/vapi/SweGlib-@SWE_GLIB_API_VERSION@.vapi

View File

@ -1,6 +1,5 @@
This directory contains version 1.76 of the Swiss Ephemeris programming This directory contains version 2.0 of the Swiss Ephemeris programming library
library in a reduced form, so it can be used in an Autotools project like in a reduced form, so it can be used in an Autotools project like Astrognome.
Astrognome.
If you need the full version, you can download it from If you need the full version, you can download it from
ftp://ftp.astro.com/pub/swisseph/ (as of July, 2013) ftp://ftp.astro.com/pub/swisseph/ (as of July, 2013)

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,7 @@
lib_LTLIBRARIES = libswe-1.76.la lib_LTLIBRARIES = libswe-2.0.la
libswe_1_76_la_SOURCES = swedate.c swehouse.c swejpl.c swemmoon.c swemplan.c swepcalc.c sweph.c swepdate.c swephlib.c swecl.c swehel.c libswe_2_0_la_SOURCES = swedate.c swehouse.c swejpl.c swemmoon.c swemplan.c swepcalc.c sweph.c swepdate.c swephlib.c swecl.c swehel.c
libswe_1_76_la_CFLAGS = $(CFLAGS) -Wall libswe_2_0_la_CFLAGS = $(CFLAGS) -Wall
libswe_1_76_la_LIBADD = $(LIBS) libswe_2_0_la_LIBADD = $(LIBS)
EXTRA_DIST = \ EXTRA_DIST = \
LICENSE \ LICENSE \

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,3 @@
/********************************************************* /*********************************************************
$Header: /home/dieter/sweph/RCS/swedate.c,v 1.75 2009/04/08 07:17:29 dieter Exp $ $Header: /home/dieter/sweph/RCS/swedate.c,v 1.75 2009/04/08 07:17:29 dieter Exp $
version 15-feb-89 16:30 version 15-feb-89 16:30
@ -8,7 +7,6 @@
swe_julday() swe_julday()
************************************************************/ ************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved. /* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions License conditions
@ -91,8 +89,9 @@
static AS_BOOL init_leapseconds_done = FALSE; static AS_BOOL init_leapseconds_done = FALSE;
int FAR PASCAL_CONV int FAR PASCAL_CONV swe_date_conversion(int y,
swe_date_conversion(int y, int m, int d, /* day, month, year */ int m,
int d, /* day, month, year */
double uttime, /* UT in hours (decimal) */ double uttime, /* UT in hours (decimal) */
char c, /* calendar g[regorian]|j[ulian] */ char c, /* calendar g[regorian]|j[ulian] */
double *tjd) double *tjd)
@ -108,8 +107,7 @@ swe_date_conversion(int y, int m, int d, /* day, month, year */
*tjd = jd; *tjd = jd;
if (rmon == m && rday == d && ryear == y) { if (rmon == m && rday == d && ryear == y) {
return OK; return OK;
} } else {
else {
return ERR; return ERR;
} }
} /* end date_conversion */ } /* end date_conversion */
@ -163,28 +161,23 @@ swe_date_conversion(int y, int m, int d, /* day, month, year */
and notifies errors like 32 January. and notifies errors like 32 January.
****************************************************************/ ****************************************************************/
double FAR PASCAL_CONV double FAR PASCAL_CONV swe_julday(int year, int month, int day, double hour, int gregflag)
swe_julday(int year, int month, int day, double hour, int gregflag)
{ {
double jd; double jd;
double u,u0,u1,u2; double u,u0,u1,u2;
u = year; u = year;
if (month < 3) if (month < 3) u -=1;
u -= 1;
u0 = u + 4712.0; u0 = u + 4712.0;
u1 = month + 1.0; u1 = month + 1.0;
if (u1 < 4) if (u1 < 4) u1 += 12.0;
u1 += 12.0;
jd = floor(u0*365.25) jd = floor(u0*365.25)
+ floor(30.6*u1+0.000001) + floor(30.6*u1+0.000001)
+ day + hour/24.0 - 63.5; + day + hour/24.0 - 63.5;
if (gregflag == SE_GREG_CAL) { if (gregflag == SE_GREG_CAL) {
u2 = floor(fabs(u) / 100) - floor(fabs(u) / 400); u2 = floor(fabs(u) / 100) - floor(fabs(u) / 400);
if (u < 0.0) if (u < 0.0) u2 = -u2;
u2 = -u2;
jd = jd - u2 + 2; jd = jd - u2 + 2;
if ((u < 0.0) && (u / 100 == floor(u / 100)) if ((u < 0.0) && (u/100 == floor(u/100)) && (u/400 != floor(u/400)))
&& (u / 400 != floor(u / 400)))
jd -=1; jd -=1;
} }
return jd; return jd;
@ -209,24 +202,21 @@ swe_julday(int year, int month, int day, double hour, int gregflag)
Original author Mark Pottenger, Los Angeles. Original author Mark Pottenger, Los Angeles.
with bug fix for year < -4711 16-aug-88 Alois Treindl with bug fix for year < -4711 16-aug-88 Alois Treindl
*************************************************************************/ *************************************************************************/
void FAR PASCAL_CONV void FAR PASCAL_CONV swe_revjul (double jd, int gregflag,
swe_revjul(double jd, int gregflag, int *jyear, int *jmon, int *jday, int *jyear, int *jmon, int *jday, double *jut)
double *jut)
{ {
double u0,u1,u2,u3,u4; double u0,u1,u2,u3,u4;
u0 = jd + 32082.5; u0 = jd + 32082.5;
if (gregflag == SE_GREG_CAL) { if (gregflag == SE_GREG_CAL) {
u1 = u0 + floor (u0/36525.0) - floor (u0/146100.0) - 38.0; u1 = u0 + floor (u0/36525.0) - floor (u0/146100.0) - 38.0;
if (jd >= 1830691.5) if (jd >= 1830691.5) u1 +=1;
u1 += 1;
u0 = u0 + floor (u1/36525.0) - floor (u1/146100.0) - 38.0; u0 = u0 + floor (u1/36525.0) - floor (u1/146100.0) - 38.0;
} }
u2 = floor (u0 + 123.0); u2 = floor (u0 + 123.0);
u3 = floor ( (u2 - 122.2) / 365.25); u3 = floor ( (u2 - 122.2) / 365.25);
u4 = floor ( (u2 - floor (365.25 * u3) ) / 30.6001); u4 = floor ( (u2 - floor (365.25 * u3) ) / 30.6001);
*jmon = (int) (u4 - 1.0); *jmon = (int) (u4 - 1.0);
if (*jmon > 12) if (*jmon > 12) *jmon -= 12;
*jmon -= 12;
*jday = (int) (u2 - floor (365.25 * u3) - floor (30.6001 * u4)); *jday = (int) (u2 - floor (365.25 * u3) - floor (30.6001 * u4));
*jyear = (int) (u3 + floor ( (u4 - 2.0) / 12.0) - 4800); *jyear = (int) (u3 + floor ( (u4 - 2.0) / 12.0) - 4800);
*jut = (jd - floor (jd + 0.5) + 0.5) * 24.0; *jut = (jd - floor (jd + 0.5) + 0.5) * 24.0;
@ -246,11 +236,13 @@ swe_revjul(double jd, int gregflag, int *jyear, int *jmon, int *jday,
* For conversion from local time to utc, use +d_timezone. * For conversion from local time to utc, use +d_timezone.
* For conversion from utc to local time, use -d_timezone. * For conversion from utc to local time, use -d_timezone.
*/ */
void FAR PASCAL_CONV void FAR PASCAL_CONV swe_utc_time_zone(
swe_utc_time_zone(int32 iyear, int32 imonth, int32 iday, int32 ihour, int32 iyear, int32 imonth, int32 iday,
int32 imin, double dsec, double d_timezone, int32 ihour, int32 imin, double dsec,
double d_timezone,
int32 *iyear_out, int32 *imonth_out, int32 *iday_out, int32 *iyear_out, int32 *imonth_out, int32 *iday_out,
int32 * ihour_out, int32 * imin_out, double *dsec_out) int32 *ihour_out, int32 *imin_out, double *dsec_out
)
{ {
double tjd, d; double tjd, d;
AS_BOOL have_leapsec = FALSE; AS_BOOL have_leapsec = FALSE;
@ -313,14 +305,12 @@ static int leap_seconds[NLEAP_SECONDS_SPACE] = {
20081231, 20081231,
0 /* keep this 0 as end mark */ 0 /* keep this 0 as end mark */
}; };
#define J1972 2441317.5 #define J1972 2441317.5
#define NLEAP_INIT 10 #define NLEAP_INIT 10
/* Read additional leap second dates from external file, if given. /* Read additional leap second dates from external file, if given.
*/ */
static int static int init_leapsec(void)
init_leapsec(void)
{ {
FILE *fp; FILE *fp;
int ndat, ndat_last; int ndat, ndat_last;
@ -333,13 +323,11 @@ init_leapsec(void)
tabsiz = NLEAP_SECONDS; tabsiz = NLEAP_SECONDS;
ndat_last = leap_seconds[NLEAP_SECONDS - 1]; ndat_last = leap_seconds[NLEAP_SECONDS - 1];
/* no error message if file is missing */ /* no error message if file is missing */
if ((fp = if ((fp = swi_fopen(-1, "seleapsec.txt", swed.ephepath, NULL)) == NULL)
swi_fopen(-1, "seleapsec.txt", swed.ephepath, NULL)) == NULL)
return NLEAP_SECONDS; return NLEAP_SECONDS;
while(fgets(s, AS_MAXCH, fp) != NULL) { while(fgets(s, AS_MAXCH, fp) != NULL) {
sp = s; sp = s;
while (*sp == ' ' || *sp == '\t') while (*sp == ' ' || *sp == '\t') sp++;
sp++;
sp++; sp++;
if (*sp == '#' || *sp == '\n') if (*sp == '#' || *sp == '\n')
continue; continue;
@ -352,8 +340,7 @@ init_leapsec(void)
leap_seconds[tabsiz] = ndat; leap_seconds[tabsiz] = ndat;
tabsiz++; tabsiz++;
} }
if (tabsiz > NLEAP_SECONDS) if (tabsiz > NLEAP_SECONDS) leap_seconds[tabsiz] = 0; /* end mark */
leap_seconds[tabsiz] = 0; /* end mark */
fclose(fp); fclose(fp);
return tabsiz; return tabsiz;
} }
@ -387,9 +374,7 @@ init_leapsec(void)
* the leap seconds table (or the Swiss Ephemeris version) is not updated * the leap seconds table (or the Swiss Ephemeris version) is not updated
* for a long time. * for a long time.
*/ */
int32 FAR PASCAL_CONV int32 FAR PASCAL_CONV swe_utc_to_jd(int32 iyear, int32 imonth, int32 iday, int32 ihour, int32 imin, double dsec, int32 gregflag, double *dret, char *serr)
swe_utc_to_jd(int32 iyear, int32 imonth, int32 iday, int32 ihour, int32 imin,
double dsec, int32 gregflag, double *dret, char *serr)
{ {
double tjd_ut1, tjd_et, tjd_et_1972, dhour, d; double tjd_ut1, tjd_et, tjd_et_1972, dhour, d;
int iyear2, imonth2, iday2; int iyear2, imonth2, iday2;
@ -401,13 +386,13 @@ swe_utc_to_jd(int32 iyear, int32 imonth, int32 iday, int32 ihour, int32 imin,
swe_revjul(tjd_ut1, gregflag, &iyear2, &imonth2, &iday2, &d); swe_revjul(tjd_ut1, gregflag, &iyear2, &imonth2, &iday2, &d);
if (iyear != iyear2 || imonth != imonth2 || iday != iday2) { if (iyear != iyear2 || imonth != imonth2 || iday != iday2) {
if (serr != NULL) if (serr != NULL)
sprintf(serr, "invalid date: year = %d, month = %d, day = %d", sprintf(serr, "invalid date: year = %d, month = %d, day = %d", iyear, imonth, iday);
iyear, imonth, iday);
return ERR; return ERR;
} }
if (ihour < 0 || ihour > 23 || imin < 0 || imin > 59 || dsec < 0 if (ihour < 0 || ihour > 23
|| dsec >= 61 || (dsec >= 60 || imin < 0 || imin > 59
&& (imin < 59 || ihour < 23 || tjd_ut1 < J1972))) { || dsec < 0 || dsec >= 61
|| (dsec >= 60 && (imin < 59 || ihour < 23 || tjd_ut1 < J1972))) {
if (serr != NULL) if (serr != NULL)
sprintf(serr, "invalid time: %d:%d:%.2f", ihour, imin, dsec); sprintf(serr, "invalid time: %d:%d:%.2f", ihour, imin, dsec);
return ERR; return ERR;
@ -464,8 +449,7 @@ swe_utc_to_jd(int32 iyear, int32 imonth, int32 iday, int32 ihour, int32 imin,
} }
if (j != 1) { if (j != 1) {
if (serr != NULL) if (serr != NULL)
sprintf(serr, "invalid time (no leap second!): %d:%d:%.2f", sprintf(serr, "invalid time (no leap second!): %d:%d:%.2f", ihour, imin, dsec);
ihour, imin, dsec);
return ERR; return ERR;
} }
} }
@ -500,9 +484,7 @@ swe_utc_to_jd(int32 iyear, int32 imonth, int32 iday, int32 ihour, int32 imin,
* the leap seconds table (or the Swiss Ephemeris version) has not been * the leap seconds table (or the Swiss Ephemeris version) has not been
* updated for a long time. * updated for a long time.
*/ */
void FAR PASCAL_CONV void FAR PASCAL_CONV swe_jdet_to_utc(double tjd_et, int32 gregflag, int32 *iyear, int32 *imonth, int32 *iday, int32 *ihour, int32 *imin, double *dsec)
swe_jdet_to_utc(double tjd_et, int32 gregflag, int32 * iyear, int32 * imonth,
int32 * iday, int32 * ihour, int32 * imin, double *dsec)
{ {
int i; int i;
int second_60 = 0; int second_60 = 0;
@ -544,22 +526,18 @@ swe_jdet_to_utc(double tjd_et, int32 gregflag, int32 * iyear, int32 * imonth,
iday2 = i % 100; iday2 = i % 100;
tjd = swe_julday(iyear2, imonth2, iday2, 0, SE_GREG_CAL); tjd = swe_julday(iyear2, imonth2, iday2, 0, SE_GREG_CAL);
swe_revjul(tjd+1, SE_GREG_CAL, &iyear2, &imonth2, &iday2, &d); swe_revjul(tjd+1, SE_GREG_CAL, &iyear2, &imonth2, &iday2, &d);
swe_utc_to_jd(iyear2, imonth2, iday2, 0, 0, 0, SE_GREG_CAL, dret, swe_utc_to_jd(iyear2,imonth2,iday2, 0, 0, 0, SE_GREG_CAL, dret, NULL);
NULL);
d = tjd_et - dret[0]; d = tjd_et - dret[0];
if (d >= 0) { if (d >= 0) {
nleap++; nleap++;
} } else if (d < 0 && d > -1.0/86400.0) {
else if (d < 0 && d > -1.0 / 86400.0) {
second_60 = 1; second_60 = 1;
} }
} }
/* /*
* UTC, still unsure about one leap second * UTC, still unsure about one leap second
*/ */
tjd = tjd = J1972 + (tjd_et - tjd_et_1972) - ((double) nleap + second_60) / 86400.0;
J1972 + (tjd_et - tjd_et_1972) - ((double)nleap +
second_60) / 86400.0;
swe_revjul(tjd, SE_GREG_CAL, iyear, imonth, iday, &d); swe_revjul(tjd, SE_GREG_CAL, iyear, imonth, iday, &d);
*ihour = (int32) d; *ihour = (int32) d;
d -= (double) *ihour; d -= (double) *ihour;
@ -602,9 +580,7 @@ swe_jdet_to_utc(double tjd_et, int32 gregflag, int32 * iyear, int32 * imonth,
* the leap seconds table (or the Swiss Ephemeris version) has not been * the leap seconds table (or the Swiss Ephemeris version) has not been
* updated for a long time. * updated for a long time.
*/ */
void FAR PASCAL_CONV void FAR PASCAL_CONV swe_jdut1_to_utc(double tjd_ut, int32 gregflag, int32 *iyear, int32 *imonth, int32 *iday, int32 *ihour, int32 *imin, double *dsec)
swe_jdut1_to_utc(double tjd_ut, int32 gregflag, int32 * iyear, int32 * imonth,
int32 * iday, int32 * ihour, int32 * imin, double *dsec)
{ {
double tjd_et = tjd_ut + swe_deltat(tjd_ut); double tjd_et = tjd_ut + swe_deltat(tjd_ut);
swe_jdet_to_utc(tjd_et, gregflag, iyear, imonth, iday, ihour, imin, dsec); swe_jdet_to_utc(tjd_et, gregflag, iyear, imonth, iday, ihour, imin, dsec);

View File

@ -1,4 +1,3 @@
/********************************************************* /*********************************************************
$Header: /home/dieter/sweph/RCS/swedate.h,v 1.74 2008/06/16 10:07:20 dieter Exp $ $Header: /home/dieter/sweph/RCS/swedate.h,v 1.74 2008/06/16 10:07:20 dieter Exp $
version 15-feb-89 16:30 version 15-feb-89 16:30
@ -59,26 +58,24 @@
*/ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C" {
{
#endif #endif
#ifndef _SWEDLL_H #ifndef _SWEDLL_H
extern EXP32 int FAR PASCAL_CONV EXP16 swe_date_conversion(int y, int m, int d, /* year, month, day */ extern EXP32 int FAR PASCAL_CONV EXP16 swe_date_conversion (
int y , int m , int d , /* year, month, day */
double utime, /* universal time in hours (decimal) */ double utime, /* universal time in hours (decimal) */
char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */ char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */
double *tgmt); double *tgmt);
extern EXP32 double *FAR PASCAL_CONV EXP16 swe_julday(int year, int month, extern EXP32 double *FAR PASCAL_CONV EXP16 swe_julday(
int day, int year, int month, int day, double hour,
double hour,
int gregflag); int gregflag);
extern EXP32 void FAR PASCAL_CONV EXP16 swe_revjul(double jd, extern EXP32 void FAR PASCAL_CONV EXP16 swe_revjul (
double jd,
int gregflag, int gregflag,
int *jyear, int *jmon, int *jyear, int *jmon, int *jday, double *jut);
int *jday,
double *jut);
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
} /* extern C */ } /* extern C */

View File

@ -1,4 +1,3 @@
/* SWISSEPH /* SWISSEPH
* $Header: /home/dieter/sweph/RCS/swedll.h,v 1.75 2009/04/08 07:19:08 dieter Exp $ * $Header: /home/dieter/sweph/RCS/swedll.h,v 1.75 2009/04/08 07:19:08 dieter Exp $
* *
@ -6,7 +5,6 @@
* *
**************************************************************/ **************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved. /* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions License conditions
@ -61,358 +59,280 @@
for promoting such software, products or services. for promoting such software, products or services.
*/ */
/* $Id: swedll.h,v 1.75 2009/04/08 07:19:08 dieter Exp $ */ /* $Id: swedll.h,v 1.75 2009/04/08 07:19:08 dieter Exp $ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C" {
{ #endif
#endif /* */
#ifndef _SWEDLL_H #ifndef _SWEDLL_H
#define _SWEDLL_H #define _SWEDLL_H
#ifndef _SWEPHEXP_INCLUDED #ifndef _SWEPHEXP_INCLUDED
#include "swephexp.h" #include "swephexp.h"
#endif /* */ #endif
#ifdef USE_DLL16 /* 16bit DLL */ #ifdef USE_DLL16 /* 16bit DLL */
#define DllImport extern #define DllImport extern
#else /* */ #else
# ifdef __cplusplus # ifdef __cplusplus
#define DllImport extern "C" __declspec( dllimport ) #define DllImport extern "C" __declspec( dllimport )
#else /* */ # else
#define DllImport __declspec( dllimport ) #define DllImport __declspec( dllimport )
#endif /* */ # endif
#endif /* */ #endif
DllImport int32 FAR PASCAL swe_heliacal_ut(double JDNDaysUTStart,
double *geopos, double *datm,
double *dobs,
char *ObjectName,
int32 TypeEvent, int32 iflag,
double *dret, char *serr);
DllImport int32 FAR PASCAL swe_heliacal_pheno_ut(double JDNDaysUT,
double *geopos,
double *datm,
double *dobs,
char *ObjectName,
int32 TypeEvent,
int32 helflag,
double *darr,
char *serr);
DllImport int32 FAR PASCAL swe_vis_limit_mag(double tjdut,
double *geopos,
double *datm, double *dobs,
char *ObjectName,
int32 helflag,
double *dret, char *serr);
DllImport int32 FAR PASCAL swe_heliacal_ut(double JDNDaysUTStart, double *geopos, double *datm, double *dobs, char *ObjectName, int32 TypeEvent, int32 iflag, double *dret, char *serr);
DllImport int32 FAR PASCAL swe_heliacal_pheno_ut(double JDNDaysUT, double *geopos, double *datm, double *dobs, char *ObjectName, int32 TypeEvent, int32 helflag, double *darr, char *serr);
DllImport int32 FAR PASCAL swe_vis_limit_mag(double tjdut, double *geopos, double *datm, double *dobs, char *ObjectName, int32 helflag, double *dret, char *serr);
/* the following are secret, for Victor Reijs' */ /* the following are secret, for Victor Reijs' */
DllImport int32 FAR PASCAL swe_heliacal_angle(double tjdut, DllImport int32 FAR PASCAL swe_heliacal_angle(double tjdut, double *dgeo, double *datm, double *dobs, int32 helflag, double mag, double azi_obj, double azi_sun, double azi_moon, double alt_moon, double *dret, char *serr);
double *dgeo, DllImport int32 FAR PASCAL swe_topo_arcus_visionis(double tjdut, double *dgeo, double *datm, double *dobs, int32 helflag, double mag, double azi_obj, double alt_obj, double azi_sun, double azi_moon, double alt_moon, double *dret, char *serr);
double *datm,
double *dobs,
int32 helflag, double mag,
double azi_obj,
double azi_sun,
double azi_moon,
double alt_moon,
double *dret, char *serr);
DllImport int32 FAR PASCAL swe_topo_arcus_visionis(double tjdut,
double *dgeo,
double *datm,
double *dobs,
int32 helflag,
double mag,
double azi_obj,
double alt_obj,
double azi_sun,
double azi_moon,
double alt_moon,
double *dret,
char *serr);
DllImport double FAR PASCAL swe_degnorm(double deg); DllImport double FAR PASCAL swe_degnorm(double deg);
DllImport char * FAR PASCAL swe_version(char *); DllImport char * FAR PASCAL swe_version(char *);
DllImport int32 FAR PASCAL swe_calc( double tjd, int ipl, int32 iflag,
double *xx, char *serr); DllImport int32 FAR PASCAL swe_calc(
DllImport int32 FAR PASCAL swe_calc_ut( double tjd_ut, int32 ipl, double tjd, int ipl, int32 iflag,
int32 iflag, double *xx, double *xx,
char *serr); char *serr);
DllImport int32 FAR PASCAL swe_fixstar( char *star, double tjd,
int32 iflag, double *xx, DllImport int32 FAR PASCAL swe_calc_ut(
double tjd_ut, int32 ipl, int32 iflag,
double *xx,
char *serr); char *serr);
DllImport int32 FAR PASCAL swe_fixstar_ut( char *star, double tjd_ut,
int32 iflag, double *xx, DllImport int32 FAR PASCAL swe_fixstar(
char *star, double tjd, int32 iflag,
double *xx,
char *serr); char *serr);
DllImport int32 FAR PASCAL swe_fixstar_mag( char *star, double *xx,
DllImport int32 FAR PASCAL swe_fixstar_ut(
char *star, double tjd_ut, int32 iflag,
double *xx,
char *serr); char *serr);
DllImport double FAR PASCAL swe_sidtime0(double tjd_ut, double ecl,
double nut); DllImport int32 FAR PASCAL swe_fixstar_mag(
char *star, double *xx, char *serr);
DllImport double FAR PASCAL swe_sidtime0(double tjd_ut, double ecl, double nut);
DllImport double FAR PASCAL swe_sidtime(double tjd_ut); DllImport double FAR PASCAL swe_sidtime(double tjd_ut);
DllImport double FAR PASCAL swe_deltat(double tjd); DllImport double FAR PASCAL swe_deltat(double tjd);
DllImport int FAR PASCAL swe_houses( double tjd_ut, double geolat,
double geolon, int hsys, DllImport int FAR PASCAL swe_houses(
double tjd_ut, double geolat, double geolon, int hsys,
double *hcusps, double *ascmc); double *hcusps, double *ascmc);
DllImport int FAR PASCAL swe_houses_ex( double tjd_ut, int32 iflag,
double geolat, double geolon, DllImport int FAR PASCAL swe_houses_ex(
int hsys, double *hcusps, double tjd_ut, int32 iflag, double geolat, double geolon, int hsys,
double *ascmc); double *hcusps, double *ascmc);
DllImport int FAR PASCAL swe_houses_armc( double armc, double geolat,
double eps, int hsys, DllImport int FAR PASCAL swe_houses_armc(
double *hcusps, double armc, double geolat, double eps, int hsys,
double *ascmc); double *hcusps, double *ascmc);
DllImport double FAR PASCAL swe_house_pos( double armc, double geolon,
double eps, int hsys, DllImport double FAR PASCAL swe_house_pos(
double *xpin, char *serr); double armc, double geolon, double eps, int hsys, double *xpin, char *serr);
DllImport int32 FAR PASCAL swe_gauquelin_sector( double t_ut, int32 ipl,
char *starname, DllImport char * FAR PASCAL swe_house_name(int hsys);
int32 iflag,
int32 imeth, DllImport int32 FAR PASCAL swe_gauquelin_sector(
double *geopos, double t_ut, int32 ipl, char *starname, int32 iflag, int32 imeth, double *geopos, double atpress, double attemp, double *dgsect, char *serr);
double atpress,
double attemp, DllImport void FAR PASCAL swe_set_sid_mode(
double *dgsect, int32 sid_mode, double t0, double ayan_t0);
char *serr);
DllImport void FAR PASCAL swe_set_sid_mode( int32 sid_mode, double t0,
double ayan_t0);
DllImport double FAR PASCAL swe_get_ayanamsa(double tjd_et); DllImport double FAR PASCAL swe_get_ayanamsa(double tjd_et);
DllImport double FAR PASCAL swe_get_ayanamsa_ut(double tjd_ut); DllImport double FAR PASCAL swe_get_ayanamsa_ut(double tjd_ut);
DllImport char *FAR PASCAL swe_get_ayanamsa_name(int32 isidmode); DllImport char *FAR PASCAL swe_get_ayanamsa_name(int32 isidmode);
DllImport int FAR PASCAL swe_date_conversion( int y, int m, int d, /* year, month, day */
DllImport int FAR PASCAL swe_date_conversion(
int y , int m , int d , /* year, month, day */
double utime, /* universal time in hours (decimal) */ double utime, /* universal time in hours (decimal) */
char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */ char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */
double *tjd); double *tjd);
DllImport double FAR PASCAL swe_julday( int year, int mon, int mday,
double hour, int gregflag); DllImport double FAR PASCAL swe_julday(
DllImport void FAR PASCAL swe_revjul( double jd, int gregflag, int year, int mon, int mday,
double hour,
int gregflag);
DllImport void FAR PASCAL swe_revjul(
double jd, int gregflag,
int *year, int *mon, int *mday, int *year, int *mon, int *mday,
double *hour); double *hour);
DllImport void FAR PASCAL swe_utc_time_zone( int32 iyear, int32 imonth,
int32 iday, int32 ihour, DllImport void FAR PASCAL swe_utc_time_zone(
int32 imin, double dsec, int32 iyear, int32 imonth, int32 iday,
int32 ihour, int32 imin, double dsec,
double d_timezone, double d_timezone,
int32 * iyear_out, int32 *iyear_out, int32 *imonth_out, int32 *iday_out,
int32 * imonth_out, int32 *ihour_out, int32 *imin_out, double *dsec_out);
int32 * iday_out,
int32 * ihour_out, DllImport int32 FAR PASCAL swe_utc_to_jd(
int32 * imin_out, int32 iyear, int32 imonth, int32 iday,
double *dsec_out); int32 ihour, int32 imin, double dsec,
DllImport int32 FAR PASCAL swe_utc_to_jd( int32 iyear, int32 imonth, int32 gregflag, double *dret, char *serr);
int32 iday, int32 ihour,
int32 imin, double dsec, DllImport void FAR PASCAL swe_jdet_to_utc(
int32 gregflag, double *dret, double tjd_et, int32 gregflag,
char *serr); int32 *iyear, int32 *imonth, int32 *iday,
DllImport void FAR PASCAL swe_jdet_to_utc( double tjd_et, int32 *ihour, int32 *imin, double *dsec);
int32 gregflag,
int32 * iyear, DllImport void FAR PASCAL swe_jdut1_to_utc(
int32 * imonth, int32 * iday, double tjd_ut, int32 gregflag,
int32 * ihour, int32 * imin, int32 *iyear, int32 *imonth, int32 *iday,
double *dsec); int32 *ihour, int32 *imin, double *dsec);
DllImport void FAR PASCAL swe_jdut1_to_utc( double tjd_ut,
int32 gregflag, DllImport int FAR PASCAL swe_time_equ(
int32 * iyear, double tjd, double *e, char *serr);
int32 * imonth, int32 * iday, DllImport int FAR PASCAL swe_lmt_to_lat(double tjd_lmt, double geolon, double *tjd_lat, char *serr);
int32 * ihour, int32 * imin, DllImport int FAR PASCAL swe_lat_to_lmt(double tjd_lat, double geolon, double *tjd_lmt, char *serr);
double *dsec);
DllImport int FAR PASCAL swe_time_equ( double tjd, double *e,
char *serr);
DllImport double FAR PASCAL swe_get_tid_acc(void); DllImport double FAR PASCAL swe_get_tid_acc(void);
DllImport void FAR PASCAL swe_set_tid_acc(double tidacc); DllImport void FAR PASCAL swe_set_tid_acc(double tidacc);
DllImport void FAR PASCAL swe_set_ephe_path(char *path); DllImport void FAR PASCAL swe_set_ephe_path(char *path);
DllImport void FAR PASCAL swe_set_jpl_file(char *fname); DllImport void FAR PASCAL swe_set_jpl_file(char *fname);
DllImport void FAR PASCAL swe_close(void); DllImport void FAR PASCAL swe_close(void);
DllImport char *FAR PASCAL swe_get_planet_name(int ipl, char *spname); DllImport char *FAR PASCAL swe_get_planet_name(int ipl, char *spname);
DllImport void FAR PASCAL swe_cotrans(double *xpo, double *xpn, DllImport void FAR PASCAL swe_cotrans(double *xpo, double *xpn, double eps);
double eps); DllImport void FAR PASCAL swe_cotrans_sp(double *xpo, double *xpn, double eps);
DllImport void FAR PASCAL swe_cotrans_sp(double *xpo, double *xpn,
double eps);
DllImport void FAR PASCAL swe_set_topo(double geolon, double geolat,
double height);
DllImport void FAR PASCAL swe_set_topo(double geolon, double geolat, double height);
/**************************** /****************************
* from swecl.c * from swecl.c
****************************/ ****************************/
/* computes geographic location and attributes of solar /* computes geographic location and attributes of solar
* eclipse at a given tjd */ * eclipse at a given tjd */
DllImport int32 FAR PASCAL swe_sol_eclipse_where(double tjd, int32 ifl, DllImport int32 FAR PASCAL swe_sol_eclipse_where(double tjd, int32 ifl, double *geopos, double *attr, char *serr);
double *geopos,
double *attr,
char *serr);
DllImport int32 FAR PASCAL swe_lun_occult_where(double tjd, int32 ipl,
char *starname,
int32 ifl,
double *geopos,
double *attr,
char *serr);
DllImport int32 FAR PASCAL swe_lun_occult_where(double tjd, int32 ipl, char *starname, int32 ifl, double *geopos, double *attr, char *serr);
/* computes attributes of a solar eclipse for given tjd, geolon, geolat */ /* computes attributes of a solar eclipse for given tjd, geolon, geolat */
DllImport int32 FAR PASCAL swe_sol_eclipse_how(double tjd, int32 ifl, DllImport int32 FAR PASCAL swe_sol_eclipse_how(double tjd, int32 ifl, double *geopos, double *attr, char *serr);
double *geopos,
double *attr,
char *serr);
/* finds time of next local eclipse */ /* finds time of next local eclipse */
DllImport int32 FAR PASCAL swe_sol_eclipse_when_loc(double tjd_start, DllImport int32 FAR PASCAL swe_sol_eclipse_when_loc(double tjd_start, int32 ifl, double *geopos, double *tret, double *attr, int32 backward, char *serr);
int32 ifl,
double *geopos,
double *tret,
double *attr,
int32 backward,
char *serr);
DllImport int32 FAR PASCAL swe_lun_occult_when_loc(double tjd_start,
int32 ipl,
char *starname,
int32 ifl,
double *geopos,
double *tret,
double *attr,
int32 backward,
char *serr);
DllImport int32 FAR PASCAL swe_lun_occult_when_loc(double tjd_start, int32 ipl, char *starname, int32 ifl, double *geopos, double *tret, double *attr, int32 backward, char *serr);
/* finds time of next eclipse globally */ /* finds time of next eclipse globally */
DllImport int32 FAR PASCAL swe_sol_eclipse_when_glob(double tjd_start, DllImport int32 FAR PASCAL swe_sol_eclipse_when_glob(double tjd_start, int32 ifl, int32 ifltype, double *tret, int32 backward, char *serr);
int32 ifl,
int32 ifltype,
double *tret,
int32 backward,
char *serr);
/* finds time of next occultation globally */ /* finds time of next occultation globally */
DllImport int32 FAR PASCAL swe_lun_occult_when_glob(double tjd_start, DllImport int32 FAR PASCAL swe_lun_occult_when_glob(double tjd_start, int32 ipl, char *starname, int32 ifl, int32 ifltype, double *tret, int32 backward, char *serr);
int32 ipl,
char *starname,
int32 ifl,
int32 ifltype,
double *tret,
int32 backward,
char *serr);
/* computes attributes of a lunar eclipse for given tjd */ /* computes attributes of a lunar eclipse for given tjd */
DllImport int32 FAR PASCAL swe_lun_eclipse_how( double tjd_ut, DllImport int32 FAR PASCAL swe_lun_eclipse_how(
double tjd_ut,
int32 ifl, int32 ifl,
double *geopos, double *geopos,
double *attr, double *attr,
char *serr); char *serr);
DllImport int32 FAR PASCAL swe_lun_eclipse_when(double tjd_start, DllImport int32 FAR PASCAL swe_lun_eclipse_when(double tjd_start, int32 ifl, int32 ifltype, double *tret, int32 backward, char *serr);
int32 ifl, DllImport int32 FAR PASCAL swe_lun_eclipse_when_loc(double tjd_start, int32 ifl, double *geopos, double *tret, double *attr, int32 backward, char *serr);
int32 ifltype,
double *tret,
int32 backward,
char *serr);
/* planetary phenomena */ /* planetary phenomena */
DllImport int32 FAR PASCAL swe_pheno(double tjd, int32 ipl, int32 iflag, DllImport int32 FAR PASCAL swe_pheno(double tjd, int32 ipl, int32 iflag, double *attr, char *serr);
double *attr, char *serr);
DllImport int32 FAR PASCAL swe_pheno_ut(double tjd_ut, int32 ipl, DllImport int32 FAR PASCAL swe_pheno_ut(double tjd_ut, int32 ipl, int32 iflag, double *attr, char *serr);
int32 iflag, double *attr,
char *serr); DllImport double FAR PASCAL swe_refrac(double inalt, double atpress, double attemp, int32 calc_flag);
DllImport double FAR PASCAL swe_refrac(double inalt, double atpress, DllImport double FAR PASCAL swe_refrac_extended(double inalt, double geoalt, double atpress, double attemp, double lapse_rate, int32 calc_flag, double *dret);
double attemp, int32 calc_flag); DllImport void FAR PASCAL swe_set_lapse_rate(double lapse_rate);
DllImport double FAR PASCAL swe_refrac_extended(double inalt,
double geoalt, DllImport void FAR PASCAL swe_azalt(
double tjd_ut,
int32 calc_flag,
double *geopos,
double atpress, double atpress,
double attemp, double attemp,
double lapse_rate, double *xin,
int32 calc_flag,
double *dret);
DllImport void FAR PASCAL swe_set_lapse_rate(double lapse_rate);
DllImport void FAR PASCAL swe_azalt( double tjd_ut, int32 calc_flag,
double *geopos, double atpress,
double attemp, double *xin,
double *xaz); double *xaz);
DllImport void FAR PASCAL swe_azalt_rev( double tjd_ut,
DllImport void FAR PASCAL swe_azalt_rev(
double tjd_ut,
int32 calc_flag, int32 calc_flag,
double *geopos, double *xin, double *geopos,
double *xin,
double *xout); double *xout);
DllImport int32 FAR PASCAL swe_rise_trans( double tjd_ut, int32 ipl,
char *starname, DllImport int32 FAR PASCAL swe_rise_trans(
double tjd_ut, int32 ipl, char *starname,
int32 epheflag, int32 rsmi, int32 epheflag, int32 rsmi,
double *geopos, double *geopos,
double atpress, double atpress, double attemp,
double attemp, double *tret, double *tret,
char *serr); char *serr);
DllImport int32 FAR PASCAL swe_rise_trans_true_hor( double tjd_ut,
int32 ipl, DllImport int32 FAR PASCAL swe_rise_trans_true_hor(
char *starname, double tjd_ut, int32 ipl, char *starname,
int32 epheflag, int32 epheflag, int32 rsmi,
int32 rsmi,
double *geopos, double *geopos,
double atpress, double atpress, double attemp,
double attemp,
double horhgt, double horhgt,
double *tret, double *tret,
char *serr); char *serr);
DllImport int32 FAR PASCAL swe_nod_aps(double tjd_et, int32 ipl,
int32 iflag, int32 method, DllImport int32 FAR PASCAL swe_nod_aps(double tjd_et, int32 ipl, int32 iflag,
double *xnasc, double *xndsc, int32 method,
double *xperi, double *xaphe,
char *serr);
DllImport int32 FAR PASCAL swe_nod_aps_ut(double tjd_ut, int32 ipl,
int32 iflag, int32 method,
double *xnasc, double *xndsc, double *xnasc, double *xndsc,
double *xperi, double *xaphe, double *xperi, double *xaphe,
char *serr); char *serr);
DllImport int32 FAR PASCAL swe_nod_aps_ut(double tjd_ut, int32 ipl, int32 iflag,
int32 method,
double *xnasc, double *xndsc,
double *xperi, double *xaphe,
char *serr);
/*DllImport int32 FAR PASCAL HeliacalAngle(double Magn, double Age, int SN, double AziO, double AltM, double AziM, double JDNDaysUT, double AziS, double Lat, double HeightEye, double Temperature, double Pressure, double RH, double VR, double *dangret, char *serr); /*DllImport int32 FAR PASCAL HeliacalAngle(double Magn, double Age, int SN, double AziO, double AltM, double AziM, double JDNDaysUT, double AziS, double Lat, double HeightEye, double Temperature, double Pressure, double RH, double VR, double *dangret, char *serr);
DllImport int32 FAR PASCAL HeliacalJDut(double JDNDaysUTStart, double Age, int SN, double Lat, double Longitude, double HeightEye, double Temperature, double Pressure, double RH, double VR, char *ObjectName, int TypeEvent, char *AVkind, double *dret, char *serr);*/ DllImport int32 FAR PASCAL HeliacalJDut(double JDNDaysUTStart, double Age, int SN, double Lat, double Longitude, double HeightEye, double Temperature, double Pressure, double RH, double VR, char *ObjectName, int TypeEvent, char *AVkind, double *dret, char *serr);*/
/******************************************************* /*******************************************************
* other functions from swephlib.c; * other functions from swephlib.c;
* they are not needed for Swiss Ephemeris, * they are not needed for Swiss Ephemeris,
* but may be useful to former Placalc users. * but may be useful to former Placalc users.
********************************************************/ ********************************************************/
/* normalize argument into interval [0..DEG360] */ /* normalize argument into interval [0..DEG360] */
DllImport centisec FAR PASCAL swe_csnorm(centisec p); DllImport centisec FAR PASCAL swe_csnorm(centisec p);
/* distance in centisecs p1 - p2 normalized to [0..360[ */ /* distance in centisecs p1 - p2 normalized to [0..360[ */
DllImport centisec FAR PASCAL swe_difcsn (centisec p1, centisec p2); DllImport centisec FAR PASCAL swe_difcsn (centisec p1, centisec p2);
DllImport double FAR PASCAL swe_difdegn(double p1, double p2);
DllImport double FAR PASCAL swe_difdegn (double p1, double p2);
/* distance in centisecs p1 - p2 normalized to [-180..180[ */ /* distance in centisecs p1 - p2 normalized to [-180..180[ */
DllImport centisec FAR PASCAL swe_difcs2n(centisec p1, centisec p2); DllImport centisec FAR PASCAL swe_difcs2n(centisec p1, centisec p2);
DllImport double FAR PASCAL swe_difdeg2n(double p1, double p2); DllImport double FAR PASCAL swe_difdeg2n(double p1, double p2);
DllImport double FAR PASCAL swe_difdeg2n(double p1, double p2); DllImport double FAR PASCAL swe_difdeg2n(double p1, double p2);
DllImport double FAR PASCAL swe_difrad2n(double p1, double p2); DllImport double FAR PASCAL swe_difrad2n(double p1, double p2);
DllImport double FAR PASCAL swe_rad_midp(double x1, double x0); DllImport double FAR PASCAL swe_rad_midp(double x1, double x0);
DllImport double FAR PASCAL swe_deg_midp(double x1, double x0); DllImport double FAR PASCAL swe_deg_midp(double x1, double x0);
/* round second, but at 29.5959 always down */ /* round second, but at 29.5959 always down */
DllImport centisec FAR PASCAL swe_csroundsec(centisec x); DllImport centisec FAR PASCAL swe_csroundsec(centisec x);
/* double to int32 with rounding, no overflow check */ /* double to int32 with rounding, no overflow check */
DllImport int32 FAR PASCAL swe_d2l(double x); DllImport int32 FAR PASCAL swe_d2l(double x);
DllImport void FAR PASCAL swe_split_deg(double ddeg, int32 roundflag,
int32 * ideg, int32 * imin,
int32 * isec, double *dsecfr,
int32 * isgn);
DllImport void FAR PASCAL swe_split_deg(double ddeg, int32 roundflag, int32 *ideg, int32 *imin, int32 *isec, double *dsecfr, int32 *isgn);
/* monday = 0, ... sunday = 6 */ /* monday = 0, ... sunday = 6 */
DllImport int FAR PASCAL swe_day_of_week(double jd); DllImport int FAR PASCAL swe_day_of_week(double jd);
DllImport char *FAR PASCAL swe_cs2timestr(CSEC t, int sep,
AS_BOOL suppressZero, DllImport char *FAR PASCAL swe_cs2timestr(CSEC t, int sep, AS_BOOL suppressZero, char *a);
char *a);
DllImport char *FAR PASCAL swe_cs2lonlatstr(CSEC t, char pchar, DllImport char *FAR PASCAL swe_cs2lonlatstr(CSEC t, char pchar, char mchar, char *s);
char mchar, char *s);
DllImport char *FAR PASCAL swe_cs2degstr(CSEC t, char *a); DllImport char *FAR PASCAL swe_cs2degstr(CSEC t, char *a);
@ -421,198 +341,188 @@ DllImport int32 FAR PASCAL HeliacalJDut(double JDNDaysUTStart, double Age, int S
* char -> char * * char -> char *
* void -> int * void -> int
*/ */
DllImport int32 FAR PASCAL swe_calc_d( double *tjd, int ipl,
int32 iflag, double *x, DllImport int32 FAR PASCAL swe_calc_d(
double *tjd, int ipl, int32 iflag,
double *x,
char *serr); char *serr);
DllImport int32 FAR PASCAL swe_calc_ut_d( double *tjd, int16 ipl,
int32 iflag, double *x, DllImport int32 FAR PASCAL swe_calc_ut_d(
double *tjd, int16 ipl, int32 iflag,
double *x,
char *serr); char *serr);
DllImport int32 FAR PASCAL swe_fixstar_d( char *star, double *tjd,
int32 iflag, double *x, DllImport int32 FAR PASCAL swe_fixstar_d(
char *star, double *tjd, int32 iflag,
double *x,
char *serr); char *serr);
DllImport int32 FAR PASCAL swe_fixstar_ut_d( char *star, double *tjd,
int32 iflag, double *x, DllImport int32 FAR PASCAL swe_fixstar_ut_d(
char *star, double *tjd, int32 iflag,
double *x,
char *serr); char *serr);
DllImport int FAR PASCAL swe_close_d(int ivoid); DllImport int FAR PASCAL swe_close_d(int ivoid);
DllImport int FAR PASCAL swe_set_ephe_path_d(char *path); DllImport int FAR PASCAL swe_set_ephe_path_d(char *path);
DllImport int FAR PASCAL swe_set_jpl_file_d(char *fname); DllImport int FAR PASCAL swe_set_jpl_file_d(char *fname);
DllImport char *FAR PASCAL swe_get_planet_name_d(int ipl, char *spname); DllImport char *FAR PASCAL swe_get_planet_name_d(int ipl, char *spname);
DllImport int FAR PASCAL swe_deltat_d(double *tjd, double *deltat); DllImport int FAR PASCAL swe_deltat_d(double *tjd, double *deltat);
DllImport int FAR PASCAL swe_sidtime0_d(double *tjd_ut, double *eps, DllImport int FAR PASCAL swe_sidtime0_d(double *tjd_ut, double *eps,
double *nut, double *sidt); double *nut, double *sidt);
DllImport int FAR PASCAL swe_sidtime_d(double *tjd_ut, double *sidt); DllImport int FAR PASCAL swe_sidtime_d(double *tjd_ut, double *sidt);
DllImport int FAR PASCAL swe_set_sid_mode_d( int32 sid_mode, double *t0,
double *ayan_t0); DllImport int FAR PASCAL swe_set_sid_mode_d(
DllImport int FAR PASCAL swe_get_ayanamsa_d(double *tjd_et, int32 sid_mode, double *t0, double *ayan_t0);
double *ayan);
DllImport int FAR PASCAL swe_get_ayanamsa_ut_d(double *tjd_et, DllImport int FAR PASCAL swe_get_ayanamsa_d(double *tjd_et, double *ayan);
double *ayan); DllImport int FAR PASCAL swe_get_ayanamsa_ut_d(double *tjd_et, double *ayan);
DllImport int FAR PASCAL swe_cotrans_d(double *xpo, double *xpn,
double *eps); DllImport int FAR PASCAL swe_cotrans_d(double *xpo, double *xpn, double *eps);
DllImport int FAR PASCAL swe_cotrans_sp_d(double *xpo, double *xpn, DllImport int FAR PASCAL swe_cotrans_sp_d(double *xpo, double *xpn, double *eps);
double *eps);
DllImport int FAR PASCAL swe_set_topo_d(double *geolon, double *geolat, DllImport int FAR PASCAL swe_set_topo_d(double *geolon, double *geolat, double *height);
double *height);
DllImport int FAR PASCAL swe_get_tid_acc_d(double *t_acc); DllImport int FAR PASCAL swe_get_tid_acc_d(double *t_acc);
DllImport int FAR PASCAL swe_set_tid_acc_d(double *t_acc); DllImport int FAR PASCAL swe_set_tid_acc_d(double *t_acc);
DllImport int FAR PASCAL swe_degnorm_d(double *x); DllImport int FAR PASCAL swe_degnorm_d(double *x);
DllImport int FAR PASCAL swe_date_conversion_d( int y, int m, int d, /* year, month, day */
DllImport int FAR PASCAL swe_date_conversion_d(
int y , int m , int d , /* year, month, day */
double *utime, /* universal time in hours (decimal) */ double *utime, /* universal time in hours (decimal) */
char *c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */ char *c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */
double *tjd); double *tjd);
DllImport int FAR PASCAL swe_julday_d( int year, int month, int day,
double *hour, int gregflag,
double *tjd);
DllImport int FAR PASCAL swe_revjul_d( double *tjd, int gregflag,
int *jyear, int *jmon, int *jday,
double *jut);
DllImport int FAR PASCAL swe_houses_d( double *tjd, double *geolat,
double *geolon, int hsys,
double *hcusps, double *ascmc);
DllImport int FAR PASCAL swe_houses_ex_d( double *tjd_ut, int32 iflag,
double *geolat, double *geolon,
int hsys, double *hcusps,
double *ascmc);
DllImport int FAR PASCAL swe_houses_armc_d( double *armc,
double *geolat, double *eps,
int hsys, double *hcusps,
double *ascmc);
DllImport int FAR PASCAL swe_house_pos_d( double *armc, double *geolon,
double *eps, int hsys,
double *xpin, double *hpos,
char *serr);
DllImport int FAR PASCAL swe_julday_d(
int year, int month, int day, double *hour,
int gregflag, double *tjd);
DllImport int FAR PASCAL swe_revjul_d(
double *tjd,
int gregflag,
int *jyear, int *jmon, int *jday, double *jut);
DllImport int FAR PASCAL swe_houses_d(
double *tjd, double *geolat, double *geolon, int hsys,
double *hcusps, double *ascmc);
DllImport int FAR PASCAL swe_houses_ex_d(
double *tjd_ut, int32 iflag, double *geolat, double *geolon, int hsys,
double *hcusps, double *ascmc);
DllImport int FAR PASCAL swe_houses_armc_d(
double *armc, double *geolat, double *eps, int hsys,
double *hcusps, double *ascmc);
DllImport int FAR PASCAL swe_house_pos_d(
double *armc, double *geolon, double *eps, int hsys, double *xpin, double *hpos, char *serr);
/* normalize argument into interval [0..DEG360] */ /* normalize argument into interval [0..DEG360] */
DllImport centisec FAR PASCAL swe_csnorm_d(centisec p); DllImport centisec FAR PASCAL swe_csnorm_d(centisec p);
/* distance in centisecs p1 - p2 normalized to [0..360[ */ /* distance in centisecs p1 - p2 normalized to [0..360[ */
DllImport centisec FAR PASCAL swe_difcsn_d(centisec p1, centisec p2); DllImport centisec FAR PASCAL swe_difcsn_d(centisec p1, centisec p2);
DllImport int FAR PASCAL swe_difdegn_d(double *p1, double *p2,
double *diff);
DllImport int FAR PASCAL swe_difdegn_d(double *p1, double *p2, double *diff);
/* distance in centisecs p1 - p2 normalized to [-180..180[ */ /* distance in centisecs p1 - p2 normalized to [-180..180[ */
DllImport centisec FAR PASCAL swe_difcs2n_d(centisec p1, centisec p2); DllImport centisec FAR PASCAL swe_difcs2n_d(centisec p1, centisec p2);
DllImport int FAR PASCAL swe_difdeg2n_d(double *p1, double *p2,
double *diff);
DllImport int FAR PASCAL swe_difdeg2n_d(double *p1, double *p2, double *diff);
/* round second, but at 29.5959 always down */ /* round second, but at 29.5959 always down */
DllImport centisec FAR PASCAL swe_csroundsec_d(centisec x); DllImport centisec FAR PASCAL swe_csroundsec_d(centisec x);
/* double to int32 with rounding, no overflow check */ /* double to int32 with rounding, no overflow check */
DllImport int32 FAR PASCAL swe_d2l_d(double *x); DllImport int32 FAR PASCAL swe_d2l_d(double *x);
DllImport int FAR PASCAL swe_split_deg_d(double *ddeg, int32 roundflag,
int32 * ideg, int32 * imin,
int32 * isec, double *dsecfr,
int32 * isgn);
DllImport int FAR PASCAL swe_split_deg_d(double *ddeg, int32 roundflag, int32 *ideg, int32 *imin, int32 *isec, double *dsecfr, int32 *isgn);
/* monday = 0, ... sunday = 6 */ /* monday = 0, ... sunday = 6 */
DllImport int FAR PASCAL swe_day_of_week_d(double *jd); DllImport int FAR PASCAL swe_day_of_week_d(double *jd);
DllImport char *FAR PASCAL swe_cs2timestr_d(CSEC t, int sep,
AS_BOOL suppressZero,
char *a);
DllImport char *FAR PASCAL swe_cs2lonlatstr_d(CSEC t, char *pchar,
char *mchar, char *s);
DllImport char *FAR PASCAL swe_cs2degstr_d(CSEC t, char *a);
DllImport char *FAR PASCAL swe_cs2timestr_d(CSEC t, int sep, AS_BOOL suppressZero, char *a);
DllImport char *FAR PASCAL swe_cs2lonlatstr_d(CSEC t, char *pchar, char *mchar, char *s);
DllImport char *FAR PASCAL swe_cs2degstr_d(CSEC t, char *a);
/**************************** /****************************
* from swecl.c * from swecl.c
****************************/ ****************************/
/* computes geographic location and attributes of solar /* computes geographic location and attributes of solar
* eclipse at a given tjd */ * eclipse at a given tjd */
DllImport int32 FAR PASCAL swe_sol_eclipse_where_d(double *tjd_ut, DllImport int32 FAR PASCAL swe_sol_eclipse_where_d(double *tjd_ut, int32 ifl, double *geopos, double *attr, char *serr);
int32 ifl,
double *geopos,
double *attr,
char *serr);
/* computes attributes of a solar eclipse for given tjd, geolon, geolat */ /* computes attributes of a solar eclipse for given tjd, geolon, geolat */
DllImport int32 FAR PASCAL swe_sol_eclipse_how_d(double *tjd_ut, DllImport int32 FAR PASCAL swe_sol_eclipse_how_d(double *tjd_ut, int32 ifl, double geolon, double geolat, double geohgt, double *attr, char *serr);
int32 ifl,
double geolon,
double geolat,
double geohgt,
double *attr,
char *serr);
/* finds time of next local eclipse */ /* finds time of next local eclipse */
DllImport int32 FAR PASCAL swe_sol_eclipse_when_loc_d(double *tjd_start, DllImport int32 FAR PASCAL swe_sol_eclipse_when_loc_d(double *tjd_start, int32 ifl, double *geopos, double *tret, double *attr, AS_BOOL backward, char *serr);
int32 ifl,
double *geopos,
double *tret,
double *attr,
AS_BOOL backward,
char *serr);
/* finds time of next eclipse globally */ /* finds time of next eclipse globally */
DllImport int32 FAR PASCAL swe_sol_eclipse_when_glob_d(double DllImport int32 FAR PASCAL swe_sol_eclipse_when_glob_d(double *tjd_start, int32 ifl, int32 ifltype,
*tjd_start, double *tret, AS_BOOL backward, char *serr);
int32 ifl,
int32 ifltype,
double *tret,
AS_BOOL backward,
char *serr);
/* computes attributes of a lunar eclipse for given tjd */ /* computes attributes of a lunar eclipse for given tjd */
DllImport int32 FAR PASCAL swe_lun_eclipse_how_d( double *tjd_ut, DllImport int32 FAR PASCAL swe_lun_eclipse_how_d(
double *tjd_ut,
int32 ifl, int32 ifl,
double *attr, double *attr,
char *serr); char *serr);
DllImport int32 FAR PASCAL swe_lun_eclipse_when_d(double *tjd_start, DllImport int32 FAR PASCAL swe_lun_eclipse_when_d(double *tjd_start, int32 ifl, int32 ifltype,
int32 ifl, double *tret, AS_BOOL backward, char *serr);
int32 ifltype,
double *tret, DllImport int32 FAR PASCAL swe_pheno_d(double *tjd, int32 ipl, int32 iflag,
AS_BOOL backward, double *attr, char *serr);
char *serr);
DllImport int32 FAR PASCAL swe_pheno_d(double *tjd, int32 ipl, DllImport int32 FAR PASCAL swe_pheno_ut_d(double *tjd_ut, int32 ipl, int32 iflag, double *attr, char *serr);
int32 iflag, double *attr,
char *serr); DllImport int FAR PASCAL swe_refrac_d(double *inalt, double *atpress, double *attemp, int32 calc_flag, double *retalt);
DllImport int32 FAR PASCAL swe_pheno_ut_d(double *tjd_ut, int32 ipl,
int32 iflag, double *attr, DllImport int FAR PASCAL swe_azalt_d(
char *serr); double *tjd_ut,
DllImport int FAR PASCAL swe_refrac_d(double *inalt, double *atpress,
double *attemp, int32 calc_flag,
double *retalt);
DllImport int FAR PASCAL swe_azalt_d( double *tjd_ut, int32 calc_flag,
double *geopos, double *atpress,
double *attemp, double *xin,
double *xaz);
DllImport int FAR PASCAL swe_azalt_rev_d( double *tjd_ut,
int32 calc_flag, int32 calc_flag,
double *geopos, double *xin,
double *xout);
DllImport int32 FAR PASCAL swe_rise_trans_d( double *tjd_ut, int32 ipl,
char *starname,
int32 epheflag, int32 rsmi,
double *geopos, double *geopos,
double *atpress, double *atpress,
double *attemp, double *attemp,
double *tret, char *serr); double *xin,
DllImport int32 FAR PASCAL swe_nod_aps_d(double *tjd_et, int32 ipl, double *xaz);
int32 iflag, int32 method,
DllImport int FAR PASCAL swe_azalt_rev_d(
double *tjd_ut,
int32 calc_flag,
double *geopos,
double *xin,
double *xout);
DllImport int32 FAR PASCAL swe_rise_trans_d(
double *tjd_ut, int32 ipl, char *starname,
int32 epheflag, int32 rsmi,
double *geopos,
double *atpress, double *attemp,
double *tret,
char *serr);
DllImport int32 FAR PASCAL swe_nod_aps_d(double *tjd_et, int32 ipl, int32 iflag,
int32 method,
double *xnasc, double *xndsc,
double *xperi, double *xaphe,
char *serr);
DllImport int32 FAR PASCAL swe_nod_aps_ut_d(double *tjd_ut, int32 ipl, int32 iflag,
int32 method,
double *xnasc, double *xndsc, double *xnasc, double *xndsc,
double *xperi, double *xaphe, double *xperi, double *xaphe,
char *serr); char *serr);
DllImport int32 FAR PASCAL swe_nod_aps_ut_d(double *tjd_ut, int32 ipl,
int32 iflag, int32 method,
double *xnasc,
double *xndsc,
double *xperi,
double *xaphe, char *serr);
#endif /* !_SWEDLL_H */ #endif /* !_SWEDLL_H */
#ifdef __cplusplus #ifdef __cplusplus
} /* extern C */ } /* extern C */
#endif /* */ #endif

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,6 @@ module swehouse.c
house and (simple) aspect calculation house and (simple) aspect calculation
************************************************************/ ************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved. /* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions License conditions
@ -71,17 +70,33 @@ house and (simple) aspect calculation
static double Asc1(double, double, double, double); static double Asc1(double, double, double, double);
static double Asc2(double, double, double, double); static double Asc2(double, double, double, double);
static int CalcH(double th, double fi, double ekl, char hsy, static int CalcH(
double th, double fi, double ekl, char hsy,
int iteration_count, struct houses *hsp ); int iteration_count, struct houses *hsp );
static int sidereal_houses_ecl_t0(double tjde, double armc, double eps, static int sidereal_houses_ecl_t0(double tjde,
double *nutlo, double lat, int hsys, double armc,
double *cusp, double *ascmc); double eps,
static int sidereal_houses_trad(double tjde, double armc, double eps, double *nutlo,
double nutl, double lat, int hsys, double lat,
double *cusp, double *ascmc); int hsys,
static int sidereal_houses_ssypl(double tjde, double armc, double eps, double *cusp,
double *nutlo, double lat, int hsys, double *ascmc);
double *cusp, double *ascmc); static int sidereal_houses_trad(double tjde,
double armc,
double eps,
double nutl,
double lat,
int hsys,
double *cusp,
double *ascmc);
static int sidereal_houses_ssypl(double tjde,
double armc,
double eps,
double *nutlo,
double lat,
int hsys,
double *cusp,
double *ascmc);
/* housasp.c /* housasp.c
* cusps are returned in double cusp[13], * cusps are returned in double cusp[13],
@ -97,20 +112,21 @@ static int sidereal_houses_ssypl(double tjde, double armc, double eps,
* ascmc[6] = coasc2 * "co-ascendant" (M. Munkasey) * * ascmc[6] = coasc2 * "co-ascendant" (M. Munkasey) *
* ascmc[7] = polasc * "polar ascendant" (M. Munkasey) * * ascmc[7] = polasc * "polar ascendant" (M. Munkasey) *
*/ */
int FAR PASCAL_CONV int FAR PASCAL_CONV swe_houses(double tjd_ut,
swe_houses(double tjd_ut, double geolat, double geolon, int hsys, double geolat,
double *cusp, double *ascmc) double geolon,
int hsys,
double *cusp,
double *ascmc)
{ {
int i, retc = 0; int i, retc = 0;
double armc, eps, nutlo[2]; double armc, eps, nutlo[2];
double tjde = tjd_ut + swe_deltat(tjd_ut); double tjde = tjd_ut + swe_deltat(tjd_ut);
eps = swi_epsiln(tjde) * RADTODEG; eps = swi_epsiln(tjde, 0) * RADTODEG;
swi_nutation(tjde, nutlo); swi_nutation(tjde, 0, nutlo);
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
nutlo[i] *= RADTODEG; nutlo[i] *= RADTODEG;
armc = armc = swe_degnorm(swe_sidtime0(tjd_ut, eps + nutlo[1], nutlo[0]) * 15 + geolon);
swe_degnorm(swe_sidtime0(tjd_ut, eps + nutlo[1], nutlo[0]) * 15 +
geolon);
#ifdef TRACE #ifdef TRACE
swi_open_trace(NULL); swi_open_trace(NULL);
if (swi_trace_count <= TRACE_COUNT_MAX) { if (swi_trace_count <= TRACE_COUNT_MAX) {
@ -121,10 +137,8 @@ swe_houses(double tjd_ut, double geolat, double geolon, int hsys,
fprintf(swi_fp_trace_c, " geolon = %.9f;", geolon); fprintf(swi_fp_trace_c, " geolon = %.9f;", geolon);
fprintf(swi_fp_trace_c, " geolat = %.9f;", geolat); fprintf(swi_fp_trace_c, " geolat = %.9f;", geolat);
fprintf(swi_fp_trace_c, " hsys = %d;\n", hsys); fprintf(swi_fp_trace_c, " hsys = %d;\n", hsys);
fprintf(swi_fp_trace_c, fprintf(swi_fp_trace_c, " retc = swe_houses(tjd, geolat, geolon, hsys, cusp, ascmc);\n");
" retc = swe_houses(tjd, geolat, geolon, hsys, cusp, ascmc);\n"); fprintf(swi_fp_trace_c, " /* swe_houses calls swe_houses_armc as follows: */\n");
fprintf(swi_fp_trace_c,
" /* swe_houses calls swe_houses_armc as follows: */\n");
fprintf(swi_fp_trace_c, "#endif\n"); fprintf(swi_fp_trace_c, "#endif\n");
fflush(swi_fp_trace_c); fflush(swi_fp_trace_c);
} }
@ -148,9 +162,13 @@ swe_houses(double tjd_ut, double geolat, double geolon, int hsys,
* ascmc[6] = coasc2 * "co-ascendant" (M. Munkasey) * * ascmc[6] = coasc2 * "co-ascendant" (M. Munkasey) *
* ascmc[7] = polasc * "polar ascendant" (M. Munkasey) * * ascmc[7] = polasc * "polar ascendant" (M. Munkasey) *
*/ */
int FAR PASCAL_CONV int FAR PASCAL_CONV swe_houses_ex(double tjd_ut,
swe_houses_ex(double tjd_ut, int32 iflag, double geolat, double geolon, int32 iflag,
int hsys, double *cusp, double *ascmc) double geolat,
double geolon,
int hsys,
double *cusp,
double *ascmc)
{ {
int i, retc = 0; int i, retc = 0;
double armc, eps_mean, nutlo[2]; double armc, eps_mean, nutlo[2];
@ -163,8 +181,8 @@ swe_houses_ex(double tjd_ut, int32 iflag, double geolat, double geolon,
ito = 12; ito = 12;
if ((iflag & SEFLG_SIDEREAL) && !swed.ayana_is_set) if ((iflag & SEFLG_SIDEREAL) && !swed.ayana_is_set)
swe_set_sid_mode(SE_SIDM_FAGAN_BRADLEY, 0, 0); swe_set_sid_mode(SE_SIDM_FAGAN_BRADLEY, 0, 0);
eps_mean = swi_epsiln(tjde) * RADTODEG; eps_mean = swi_epsiln(tjde, 0) * RADTODEG;
swi_nutation(tjde, nutlo); swi_nutation(tjde, 0, nutlo);
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
nutlo[i] *= RADTODEG; nutlo[i] *= RADTODEG;
#ifdef TRACE #ifdef TRACE
@ -178,37 +196,24 @@ swe_houses_ex(double tjd_ut, int32 iflag, double geolat, double geolon,
fprintf(swi_fp_trace_c, " geolon = %.9f;", geolon); fprintf(swi_fp_trace_c, " geolon = %.9f;", geolon);
fprintf(swi_fp_trace_c, " geolat = %.9f;", geolat); fprintf(swi_fp_trace_c, " geolat = %.9f;", geolat);
fprintf(swi_fp_trace_c, " hsys = %d;\n", hsys); fprintf(swi_fp_trace_c, " hsys = %d;\n", hsys);
fprintf(swi_fp_trace_c, fprintf(swi_fp_trace_c, " retc = swe_houses_ex(tjd, iflag, geolat, geolon, hsys, cusp, ascmc);\n");
" retc = swe_houses_ex(tjd, iflag, geolat, geolon, hsys, cusp, ascmc);\n"); fprintf(swi_fp_trace_c, " /* swe_houses calls swe_houses_armc as follows: */\n");
fprintf(swi_fp_trace_c,
" /* swe_houses calls swe_houses_armc as follows: */\n");
fprintf(swi_fp_trace_c, "#endif\n"); fprintf(swi_fp_trace_c, "#endif\n");
fflush(swi_fp_trace_c); fflush(swi_fp_trace_c);
} }
} }
#endif #endif
/*houses_to_sidereal(tjde, geolat, hsys, eps, cusp, ascmc, iflag);*/ /*houses_to_sidereal(tjde, geolat, hsys, eps, cusp, ascmc, iflag);*/
armc = armc = swe_degnorm(swe_sidtime0(tjd_ut, eps_mean + nutlo[1], nutlo[0]) * 15 + geolon);
swe_degnorm(swe_sidtime0(tjd_ut, eps_mean + nutlo[1], nutlo[0]) * 15 +
geolon);
if (iflag & SEFLG_SIDEREAL) { if (iflag & SEFLG_SIDEREAL) {
if (sip->sid_mode & SE_SIDBIT_ECL_T0) if (sip->sid_mode & SE_SIDBIT_ECL_T0)
retc = retc = sidereal_houses_ecl_t0(tjde, armc, eps_mean + nutlo[1], nutlo, geolat, hsys, cusp, ascmc);
sidereal_houses_ecl_t0(tjde, armc, eps_mean + nutlo[1], nutlo,
geolat, hsys, cusp, ascmc);
else if (sip->sid_mode & SE_SIDBIT_SSY_PLANE) else if (sip->sid_mode & SE_SIDBIT_SSY_PLANE)
retc = retc = sidereal_houses_ssypl(tjde, armc, eps_mean + nutlo[1], nutlo, geolat, hsys, cusp, ascmc);
sidereal_houses_ssypl(tjde, armc, eps_mean + nutlo[1], nutlo,
geolat, hsys, cusp, ascmc);
else else
retc = retc = sidereal_houses_trad(tjde, armc, eps_mean + nutlo[1], nutlo[0], geolat, hsys, cusp, ascmc);
sidereal_houses_trad(tjde, armc, eps_mean + nutlo[1], } else {
nutlo[0], geolat, hsys, cusp, ascmc); retc = swe_houses_armc(armc, geolat, eps_mean + nutlo[1], hsys, cusp, ascmc);
}
else {
retc =
swe_houses_armc(armc, geolat, eps_mean + nutlo[1], hsys, cusp,
ascmc);
} }
if (iflag & SEFLG_RADIANS) { if (iflag & SEFLG_RADIANS) {
for (i = 1; i <= ito; i++) for (i = 1; i <= ito; i++)
@ -245,9 +250,14 @@ swe_houses_ex(double tjd_ut, int32 iflag, double geolat, double geolon,
* 6. subtract this distance from all house cusps. * 6. subtract this distance from all house cusps.
* 7. subtract ayanamsa_t0 from all house cusps. * 7. subtract ayanamsa_t0 from all house cusps.
*/ */
static int static int sidereal_houses_ecl_t0(double tjde,
sidereal_houses_ecl_t0(double tjde, double armc, double eps, double *nutlo, double armc,
double lat, int hsys, double *cusp, double *ascmc) double eps,
double *nutlo,
double lat,
int hsys,
double *cusp,
double *ascmc)
{ {
int i, j, retc = OK; int i, j, retc = OK;
double x[6], xvpx[6], x2[6], epst0, xnorm[6]; double x[6], xvpx[6], x2[6], epst0, xnorm[6];
@ -260,7 +270,7 @@ sidereal_houses_ecl_t0(double tjde, double armc, double eps, double *nutlo,
else else
ito = 12; ito = 12;
/* epsilon at t0 */ /* epsilon at t0 */
epst0 = swi_epsiln(sip->t0); epst0 = swi_epsiln(sip->t0, 0);
/* cartesian coordinates of an imaginary moving body on the /* cartesian coordinates of an imaginary moving body on the
* the mean ecliptic of t0; we take the vernal point: */ * the mean ecliptic of t0; we take the vernal point: */
x[0] = x[4] = 1; x[0] = x[4] = 1;
@ -269,10 +279,10 @@ sidereal_houses_ecl_t0(double tjde, double armc, double eps, double *nutlo,
swi_coortrf(x, x, -epst0); swi_coortrf(x, x, -epst0);
swi_coortrf(x+3, x+3, -epst0); swi_coortrf(x+3, x+3, -epst0);
/* to tjd_et */ /* to tjd_et */
swi_precess(x, sip->t0, J_TO_J2000); swi_precess(x, sip->t0, 0, J_TO_J2000);
swi_precess(x, tjde, J2000_TO_J); swi_precess(x, tjde, 0, J2000_TO_J);
swi_precess(x + 3, sip->t0, J_TO_J2000); swi_precess(x+3, sip->t0, 0, J_TO_J2000);
swi_precess(x + 3, tjde, J2000_TO_J); swi_precess(x+3, tjde, 0, J2000_TO_J);
/* to true equator of tjd_et */ /* to true equator of tjd_et */
swi_coortrf(x, x, (eps - nutlo[1]) * DEGTORAD); swi_coortrf(x, x, (eps - nutlo[1]) * DEGTORAD);
swi_coortrf(x+3, x+3, (eps - nutlo[1]) * DEGTORAD); swi_coortrf(x+3, x+3, (eps - nutlo[1]) * DEGTORAD);
@ -336,9 +346,14 @@ sidereal_houses_ecl_t0(double tjde, double armc, double eps, double *nutlo,
* 8. subtract ayanamsa_t0 from all house cusps. * 8. subtract ayanamsa_t0 from all house cusps.
* 9. subtract ayanamsa_2000 from all house cusps. * 9. subtract ayanamsa_2000 from all house cusps.
*/ */
static int static int sidereal_houses_ssypl(double tjde,
sidereal_houses_ssypl(double tjde, double armc, double eps, double *nutlo, double armc,
double lat, int hsys, double *cusp, double *ascmc) double eps,
double *nutlo,
double lat,
int hsys,
double *cusp,
double *ascmc)
{ {
int i, j, retc = OK; int i, j, retc = OK;
double x[6], x0[6], xvpx[6], x2[6], xnorm[6]; double x[6], x0[6], xvpx[6], x2[6], xnorm[6];
@ -350,7 +365,7 @@ sidereal_houses_ssypl(double tjde, double armc, double eps, double *nutlo,
ito = 36; ito = 36;
else else
ito = 12; ito = 12;
eps2000 = swi_epsiln(J2000); eps2000 = swi_epsiln(J2000, 0);
/* cartesian coordinates of the zero point on the /* cartesian coordinates of the zero point on the
* the solar system rotation plane */ * the solar system rotation plane */
x[0] = x[4] = 1; x[0] = x[4] = 1;
@ -365,8 +380,8 @@ sidereal_houses_ssypl(double tjde, double armc, double eps, double *nutlo,
swi_coortrf(x, x, -eps2000); swi_coortrf(x, x, -eps2000);
swi_coortrf(x+3, x+3, -eps2000); swi_coortrf(x+3, x+3, -eps2000);
/* to mean equator of t */ /* to mean equator of t */
swi_precess(x, tjde, J2000_TO_J); swi_precess(x, tjde, 0, J2000_TO_J);
swi_precess(x + 3, tjde, J2000_TO_J); swi_precess(x+3, tjde, 0, J2000_TO_J);
/* to true equator of t */ /* to true equator of t */
swi_coortrf(x, x, (eps - nutlo[1]) * DEGTORAD); swi_coortrf(x, x, (eps - nutlo[1]) * DEGTORAD);
swi_coortrf(x+3, x+3, (eps - nutlo[1]) * DEGTORAD); swi_coortrf(x+3, x+3, (eps - nutlo[1]) * DEGTORAD);
@ -411,7 +426,7 @@ sidereal_houses_ssypl(double tjde, double armc, double eps, double *nutlo,
x0[1] = x0[2] = 0; x0[1] = x0[2] = 0;
/* zero point of t0 in J2000 system */ /* zero point of t0 in J2000 system */
if (sip->t0 != J2000) if (sip->t0 != J2000)
swi_precess(x0, sip->t0, J_TO_J2000); swi_precess(x0, sip->t0, 0, J_TO_J2000);
/* zero point to ecliptic 2000 */ /* zero point to ecliptic 2000 */
swi_coortrf(x0, x0, eps2000); swi_coortrf(x0, x0, eps2000);
/* to solar system plane */ /* to solar system plane */
@ -430,9 +445,14 @@ sidereal_houses_ssypl(double tjde, double armc, double eps, double *nutlo,
} }
/* common simplified procedure */ /* common simplified procedure */
static int static int sidereal_houses_trad(double tjde,
sidereal_houses_trad(double tjde, double armc, double eps, double nutl, double armc,
double lat, int hsys, double *cusp, double *ascmc) double eps,
double nutl,
double lat,
int hsys,
double *cusp,
double *ascmc)
{ {
int i, retc = OK; int i, retc = OK;
double ay; double ay;
@ -477,9 +497,13 @@ sidereal_houses_trad(double tjde, double armc, double eps, double nutl,
* ascmc[6] = coasc2 * "co-ascendant" (M. Munkasey) * * ascmc[6] = coasc2 * "co-ascendant" (M. Munkasey) *
* ascmc[7] = polasc * "polar ascendant" (M. Munkasey) * * ascmc[7] = polasc * "polar ascendant" (M. Munkasey) *
*/ */
int FAR PASCAL_CONV int FAR PASCAL_CONV swe_houses_armc(
swe_houses_armc(double armc, double geolat, double eps, int hsys, double armc,
double *cusp, double *ascmc) double geolat,
double eps,
int hsys,
double *cusp,
double *ascmc)
{ {
struct houses h; struct houses h;
int i, retc = 0; int i, retc = 0;
@ -489,7 +513,10 @@ swe_houses_armc(double armc, double geolat, double eps, int hsys,
else else
ito = 12; ito = 12;
armc = swe_degnorm(armc); armc = swe_degnorm(armc);
retc = CalcH(armc, geolat, eps, (char)hsys, 2, &h); retc = CalcH(armc,
geolat,
eps,
(char)hsys, 2, &h);
cusp[0] = 0; cusp[0] = 0;
for (i = 1; i <= ito; i++) { for (i = 1; i <= ito; i++) {
cusp[i] = h.cusp[i]; cusp[i] = h.cusp[i];
@ -513,25 +540,20 @@ swe_houses_armc(double armc, double geolat, double eps, int hsys,
fprintf(swi_fp_trace_c, " geolat = %.9f;", geolat); fprintf(swi_fp_trace_c, " geolat = %.9f;", geolat);
fprintf(swi_fp_trace_c, " eps = %.9f;", eps); fprintf(swi_fp_trace_c, " eps = %.9f;", eps);
fprintf(swi_fp_trace_c, " hsys = %d;\n", hsys); fprintf(swi_fp_trace_c, " hsys = %d;\n", hsys);
fprintf(swi_fp_trace_c, fprintf(swi_fp_trace_c, " retc = swe_houses_armc(armc, geolat, eps, hsys, cusp, ascmc);\n");
" retc = swe_houses_armc(armc, geolat, eps, hsys, cusp, ascmc);\n"); fputs(" printf(\"swe_houses_armc: %f\\t%f\\t%f\\t%c\\t\\n\", ", swi_fp_trace_c);
fputs(" printf(\"swe_houses_armc: %f\\t%f\\t%f\\t%c\\t\\n\", ",
swi_fp_trace_c);
fputs(" armc, geolat, eps, hsys);\n", swi_fp_trace_c); fputs(" armc, geolat, eps, hsys);\n", swi_fp_trace_c);
fputs(" printf(\"retc = %d\\n\", retc);\n", swi_fp_trace_c); fputs(" printf(\"retc = %d\\n\", retc);\n", swi_fp_trace_c);
fputs(" printf(\"cusp:\\n\");\n", swi_fp_trace_c); fputs(" printf(\"cusp:\\n\");\n", swi_fp_trace_c);
fputs(" for (i = 0; i < 12; i++)\n", swi_fp_trace_c); fputs(" for (i = 0; i < 12; i++)\n", swi_fp_trace_c);
fputs(" printf(\" %d\\t%f\\n\", i, cusp[i]);\n", fputs(" printf(\" %d\\t%f\\n\", i, cusp[i]);\n", swi_fp_trace_c);
swi_fp_trace_c);
fputs(" printf(\"ascmc:\\n\");\n", swi_fp_trace_c); fputs(" printf(\"ascmc:\\n\");\n", swi_fp_trace_c);
fputs(" for (i = 0; i < 10; i++)\n", swi_fp_trace_c); fputs(" for (i = 0; i < 10; i++)\n", swi_fp_trace_c);
fputs(" printf(\" %d\\t%f\\n\", i, ascmc[i]);\n", fputs(" printf(\" %d\\t%f\\n\", i, ascmc[i]);\n", swi_fp_trace_c);
swi_fp_trace_c);
fflush(swi_fp_trace_c); fflush(swi_fp_trace_c);
} }
if (swi_fp_trace_out != NULL) { if (swi_fp_trace_out != NULL) {
fprintf(swi_fp_trace_out, "swe_houses_armc: %f\t%f\t%f\t%c\t\n", fprintf(swi_fp_trace_out, "swe_houses_armc: %f\t%f\t%f\t%c\t\n", armc, geolat, eps, hsys);
armc, geolat, eps, hsys);
fprintf(swi_fp_trace_out, "retc = %d\n", retc); fprintf(swi_fp_trace_out, "retc = %d\n", retc);
fputs("cusp:\n", swi_fp_trace_out); fputs("cusp:\n", swi_fp_trace_out);
for (i = 0; i < 12; i++) for (i = 0; i < 12; i++)
@ -544,24 +566,83 @@ swe_houses_armc(double armc, double geolat, double eps, int hsys,
} }
#endif #endif
#if 0 #if 0
/* for test of swe_house_pos(). /* for test of swe_house_pos().
* 1st house will be 0, second 30, etc. */ * 1st house will be 0, second 30, etc. */
for (i = 1; i <=12; i++) { for (i = 1; i <=12; i++) {
double x[6]; double x[6];
x[0] = cusp[i]; x[0] = cusp[i]; x[1] = 0; x[2] = 1;
x[1] = 0;
x[2] = 1;
cusp[i] = (swe_house_pos(armc, geolat, eps, hsys, x, NULL) - 1) * 30; cusp[i] = (swe_house_pos(armc, geolat, eps, hsys, x, NULL) - 1) * 30;
} }
#endif #endif
return retc; return retc;
} }
static int /* for APC houses */
CalcH(double th, double fi, double ekl, char hsy, int iteration_count, /* n number of house
struct houses *hsp) * ph geographic latitude
* e ecliptic obliquity
* az armc
*/
static double apc_sector(int n, double ph, double e, double az)
{
int k, is_below_hor = 0;
double dasc, kv, a, dret;
/* ascensional difference of the ascendant */
kv = atan(tan(ph) * tan(e) * cos(az)/(1 + tan(ph) * tan(e) * sin(az)));
/* declination of the ascendant */
dasc = atan(sin(kv) / tan(ph));
/* note, at polar circles, when the mc sinks below the horizon,
* kv and dasc change sign in the above formulae.
* this is what we need, because the ascendand jumps by 180 deg */
/* printf("%f, %f\n", kv*RADTODEG, dasc*RADTODEG); */
if (n < 8) {
is_below_hor = 1; /* 1 and 7 are included here */
k = n - 1;
} else {
k = n - 13;
}
/* az + PI/2 + kv = armc + 90 + asc. diff. = right ascension of ascendant
* PI/2 +- kv = semi-diurnal or seminocturnal arc of ascendant
* a = right ascension of house cusp on apc circle (ascendant-parallel
* circle), with declination dasc */
if (is_below_hor) {
a = kv + az + PI/2 + k * (PI/2 - kv) / 3;
} else {
a = kv + az + PI/2 + k * (PI/2 + kv) / 3;
}
a = swe_radnorm(a);
dret = atan2(tan(dasc) * tan(ph) * sin(az) + sin(a),
cos(e) * (tan(dasc) * tan(ph) * cos(az) + cos(a)) + sin(e) * tan(ph) * sin(az - a));
dret = swe_degnorm(dret * RADTODEG);
return dret;
}
char *FAR PASCAL_CONV swe_house_name(int hsys)
{
switch (toupper(hsys)) {
case 'A': return "equal";
case 'E': return "equal";
case 'B': return "Alcabitius";
case 'C': return "Campanus";
case 'G': return "Gauquelin sectors";
case 'H': return "horizon/azimut";
case 'K': return "Koch";
case 'M': return "Morinus";
case 'O': return "Porphyry";
case 'R': return "Regiomontanus";
case 'T': return "Polich/Page";
case 'U': return "Krusinski-Pisa-Goelzer";
case 'V': return "equal/Vehlow";
case 'W': return "equal/ whole sign";
case 'X': return "axial rotation system/Meridian houses";
case 'Y': return "APC houses";
default: return "Placidus";
}
}
static int CalcH(
double th, double fi, double ekl, char hsy,
int iteration_count, struct houses *hsp )
/* ********************************************************* /* *********************************************************
* Arguments: th = sidereal time (angle 0..360 degrees * Arguments: th = sidereal time (angle 0..360 degrees
* hsy = letter code for house system; * hsy = letter code for house system;
@ -577,10 +658,11 @@ CalcH(double th, double fi, double ekl, char hsy, int iteration_count,
* P Placidus * P Placidus
* R Regiomontanus * R Regiomontanus
* T Polich/Page ("topocentric") * T Polich/Page ("topocentric")
* U Krusinski-Pisa-Goelzer
* V equal Vehlow * V equal Vehlow
* W equal, whole sign * W equal, whole sign
* X axial rotation system/ Meridian houses * X axial rotation system/ Meridian houses
* U Krusinski-Pisa-Goelzer * Y APC houses
* fi = geographic latitude * fi = geographic latitude
* ekl = obliquity of the ecliptic * ekl = obliquity of the ecliptic
* iteration_count = number of iterations in * iteration_count = number of iterations in
@ -612,13 +694,13 @@ CalcH(double th, double fi, double ekl, char hsy, int iteration_count,
} }
tanfi = tand(fi); tanfi = tand(fi);
/* mc */ /* mc */
if (fabs(th - 90) > VERY_SMALL && fabs(th - 270) > VERY_SMALL) { if (fabs(th - 90) > VERY_SMALL
&& fabs(th - 270) > VERY_SMALL) {
tant = tand(th); tant = tand(th);
hsp->mc = atand(tant / cose); hsp->mc = atand(tant / cose);
if (th > 90 && th <= 270) if (th > 90 && th <= 270)
hsp->mc = swe_degnorm(hsp->mc + 180); hsp->mc = swe_degnorm(hsp->mc + 180);
} } else {
else {
if (fabs(th - 90) <= VERY_SMALL) if (fabs(th - 90) <= VERY_SMALL)
hsp->mc = 90; hsp->mc = 90;
else else
@ -629,8 +711,7 @@ CalcH(double th, double fi, double ekl, char hsy, int iteration_count,
hsp->ac = Asc1 (th + 90, fi, sine, cose); hsp->ac = Asc1 (th + 90, fi, sine, cose);
hsp->cusp[1] = hsp->ac; hsp->cusp[1] = hsp->ac;
hsp->cusp[10] = hsp->mc; hsp->cusp[10] = hsp->mc;
if (hsy > 95) if (hsy > 95) hsy = (char) (hsy - 32);/* translate into capital letter */
hsy = (char)(hsy - 32); /* translate into capital letter */
switch (hsy) { switch (hsy) {
case 'A': /* equal houses */ case 'A': /* equal houses */
case 'E': case 'E':
@ -669,8 +750,7 @@ CalcH(double th, double fi, double ekl, char hsy, int iteration_count,
xh1 = xh2 = 90; /* cosfi = VERY_SMALL; */ xh1 = xh2 = 90; /* cosfi = VERY_SMALL; */
else else
xh1 = xh2 = 270; /* cosfi = -VERY_SMALL; */ xh1 = xh2 = 270; /* cosfi = -VERY_SMALL; */
} } else {
else {
xh1 = atand(sqrt (3.0) / cosfi); xh1 = atand(sqrt (3.0) / cosfi);
xh2 = atand(1 / sqrt (3.0) / cosfi); xh2 = atand(1 / sqrt (3.0) / cosfi);
} }
@ -716,10 +796,8 @@ CalcH(double th, double fi, double ekl, char hsy, int iteration_count,
goto porphyry; goto porphyry;
} }
sina = sind(hsp->mc) * sine / cosd(fi); sina = sind(hsp->mc) * sine / cosd(fi);
if (sina > 1) if (sina > 1) sina = 1;
sina = 1; if (sina < -1) sina = -1;
if (sina < -1)
sina = -1;
cosa = sqrt(1 - sina * sina); /* always >> 0 */ cosa = sqrt(1 - sina * sina); /* always >> 0 */
c = atand(tanfi / cosa); c = atand(tanfi / cosa);
ad3 = asind(sind(c) * sina) / 3.0; ad3 = asind(sind(c) * sina) / 3.0;
@ -822,8 +900,7 @@ porphyry:
double a = th; double a = th;
for (i = 1; i <= 12; i++) { for (i = 1; i <= 12; i++) {
j = i + 10; j = i + 10;
if (j > 12) if (j > 12) j -= 12;
j -= 12;
a = swe_degnorm(a + 30); a = swe_degnorm(a + 30);
if (fabs(a - 90) > VERY_SMALL if (fabs(a - 90) > VERY_SMALL
&& fabs(a - 270) > VERY_SMALL) { && fabs(a - 270) > VERY_SMALL) {
@ -831,8 +908,7 @@ porphyry:
hsp->cusp[j] = atand(tant / cose); hsp->cusp[j] = atand(tant / cose);
if (a > 90 && a <= 270) if (a > 90 && a <= 270)
hsp->cusp[j] = swe_degnorm(hsp->cusp[j] + 180); hsp->cusp[j] = swe_degnorm(hsp->cusp[j] + 180);
} } else {
else {
if (fabs(a - 90) <= VERY_SMALL) if (fabs(a - 90) <= VERY_SMALL)
hsp->cusp[j] = 90; hsp->cusp[j] = 90;
else else
@ -844,8 +920,7 @@ porphyry:
if (acmc < 0) { if (acmc < 0) {
hsp->ac = swe_degnorm(hsp->ac + 180); hsp->ac = swe_degnorm(hsp->ac + 180);
} }
break; break; }
}
case 'M': { case 'M': {
/* /*
* Morinus * Morinus
@ -857,8 +932,7 @@ porphyry:
double x[3]; double x[3];
for (i = 1; i <= 12; i++) { for (i = 1; i <= 12; i++) {
j = i + 10; j = i + 10;
if (j > 12) if (j > 12) j -= 12;
j -= 12;
a = swe_degnorm(a + 30); a = swe_degnorm(a + 30);
x[0] = a; x[0] = a;
x[1] = 0; x[1] = 0;
@ -869,16 +943,15 @@ porphyry:
if (acmc < 0) { if (acmc < 0) {
hsp->ac = swe_degnorm(hsp->ac + 180); hsp->ac = swe_degnorm(hsp->ac + 180);
} }
break; break; }
}
case 'B': { /* Alcabitius */ case 'B': { /* Alcabitius */
/* created by Alois 17-sep-2000, followed example in Matrix /* created by Alois 17-sep-2000, followed example in Matrix
* electrical library. The code reproduces the example! electrical library. The code reproduces the example!
* See http://www.astro.com/cgi/adict.cgi query: alcabitius See http://www.astro.com/cgi/adict.cgi query: alcabitius
* in the resuotl page, see program code example. in the resuotl page, see program code example.
* I think the Alcabitius code in Walter Pullen's Astrolog 5.40 I think the Alcabitius code in Walter Pullen's Astrolog 5.40
* is wrong, because he remains in RA and forgets the transform to is wrong, because he remains in RA and forgets the transform to
* the ecliptic. */ the ecliptic. */
double dek, r, sna, sda, sn3, sd3; double dek, r, sna, sda, sn3, sd3;
#if FALSE #if FALSE
if (fabs(fi) >= 90 - ekl) { /* within polar circle */ if (fabs(fi) >= 90 - ekl) { /* within polar circle */
@ -905,7 +978,7 @@ porphyry:
sn3 = sna / 3; sn3 = sna / 3;
rectasc = swe_degnorm(th + sd3); /* cusp 11 */ rectasc = swe_degnorm(th + sd3); /* cusp 11 */
/* project rectasc onto eclipitic with pole height 0, i.e. along the /* project rectasc onto eclipitic with pole height 0, i.e. along the
* declination circle */ declination circle */
hsp->cusp [11] = Asc1 (rectasc, 0, sine, cose); hsp->cusp [11] = Asc1 (rectasc, 0, sine, cose);
rectasc = swe_degnorm(th + 2 * sd3); /* cusp 12 */ rectasc = swe_degnorm(th + 2 * sd3); /* cusp 12 */
hsp->cusp [12] = Asc1 (rectasc, 0, sine, cose); hsp->cusp [12] = Asc1 (rectasc, 0, sine, cose);
@ -923,7 +996,6 @@ porphyry:
retc = ERR; retc = ERR;
goto porphyry; goto porphyry;
} }
/*************** forth/second quarter ***************/ /*************** forth/second quarter ***************/
/* note: Gauquelin sectors are counted in clockwise direction */ /* note: Gauquelin sectors are counted in clockwise direction */
a = asind(tand(fi) * tane); a = asind(tand(fi) * tane);
@ -931,12 +1003,10 @@ porphyry:
ih2 = 10 - ih; ih2 = 10 - ih;
fh1 = atand(sind(a * ih2 / 9) / tane); fh1 = atand(sind(a * ih2 / 9) / tane);
rectasc = swe_degnorm((90 / 9) * ih2 + th); rectasc = swe_degnorm((90 / 9) * ih2 + th);
tant = tant = tand(asind(sine * sind(Asc1 (rectasc, fh1, sine, cose))));
tand(asind(sine * sind(Asc1(rectasc, fh1, sine, cose))));
if (fabs(tant) < VERY_SMALL) { if (fabs(tant) < VERY_SMALL) {
hsp->cusp[ih] = rectasc; hsp->cusp[ih] = rectasc;
} } else {
else {
/* pole height */ /* pole height */
f = atand(sind(asind(tanfi * tant) * ih2 / 9) /tant); f = atand(sind(asind(tanfi * tant) * ih2 / 9) /tant);
hsp->cusp [ih] = Asc1 (rectasc, f, sine, cose); hsp->cusp [ih] = Asc1 (rectasc, f, sine, cose);
@ -953,18 +1023,15 @@ porphyry:
} }
hsp->cusp[ih+18] = swe_degnorm(hsp->cusp[ih] + 180); hsp->cusp[ih+18] = swe_degnorm(hsp->cusp[ih] + 180);
} }
/*************** first/third quarter ***************/ /*************** first/third quarter ***************/
for (ih = 29; ih <= 36; ih++) { for (ih = 29; ih <= 36; ih++) {
ih2 = ih - 28; ih2 = ih - 28;
fh1 = atand(sind(a * ih2 / 9) / tane); fh1 = atand(sind(a * ih2 / 9) / tane);
rectasc = swe_degnorm(180 - ih2 * 90 / 9 + th); rectasc = swe_degnorm(180 - ih2 * 90 / 9 + th);
tant = tant = tand(asind(sine * sind(Asc1 (rectasc, fh1, sine, cose))));
tand(asind(sine * sind(Asc1(rectasc, fh1, sine, cose))));
if (fabs(tant) < VERY_SMALL) { if (fabs(tant) < VERY_SMALL) {
hsp->cusp[ih] = rectasc; hsp->cusp[ih] = rectasc;
} } else {
else {
f = atand(sind(asind(tanfi * tant) * ih2 / 9) / tant); f = atand(sind(asind(tanfi * tant) * ih2 / 9) / tant);
/* pole height */ /* pole height */
hsp->cusp[ih] = Asc1 (rectasc, f, sine, cose); hsp->cusp[ih] = Asc1 (rectasc, f, sine, cose);
@ -1061,11 +1128,30 @@ porphyry:
hsp->cusp[i+7] = swe_degnorm(hsp->cusp[i+1]+180); hsp->cusp[i+7] = swe_degnorm(hsp->cusp[i+1]+180);
} }
break; break;
case 'Y': /* APC houses */
for (i = 1; i <= 12; i++) {
hsp->cusp[i] = apc_sector(i, fi * DEGTORAD, ekl * DEGTORAD, th * DEGTORAD);
}
hsp->ac = hsp->cusp[1];
hsp->mc = hsp->cusp[10];
/* within polar circle, when mc sinks below horizon and
* ascendant changes to western hemisphere, all cusps
* must be added 180 degrees.
* houses will be in clockwise direction */
if (fabs(fi) >= 90 - ekl) { /* within polar circle */
acmc = swe_difdeg2n(hsp->ac, hsp->mc);
if (acmc < 0) {
hsp->ac = swe_degnorm(hsp->ac + 180);
hsp->mc = swe_degnorm(hsp->mc + 180);
for (i = 1; i <= 12; i++)
hsp->cusp[i] = swe_degnorm(hsp->cusp[i] + 180);
}
}
break;
default: /* Placidus houses */ default: /* Placidus houses */
#ifndef _WINDOWS #ifndef _WINDOWS
if (hsy != 'P') if (hsy != 'P')
fprintf(stderr, "swe_houses: make Placidus, unknown key %c\n", fprintf (stderr, "swe_houses: make Placidus, unknown key %c\n", hsy);
hsy);
#endif #endif
if (fabs(fi) >= 90 - ekl) { /* within polar circle */ if (fabs(fi) >= 90 - ekl) { /* within polar circle */
retc = ERR; retc = ERR;
@ -1079,8 +1165,7 @@ porphyry:
tant = tand(asind(sine * sind(Asc1 (rectasc, fh1, sine, cose)))); tant = tand(asind(sine * sind(Asc1 (rectasc, fh1, sine, cose))));
if (fabs(tant) < VERY_SMALL) { if (fabs(tant) < VERY_SMALL) {
hsp->cusp [11] = rectasc; hsp->cusp [11] = rectasc;
} } else {
else {
/* pole height */ /* pole height */
f = atand(sind(asind(tanfi * tant) / 3) /tant); f = atand(sind(asind(tanfi * tant) / 3) /tant);
hsp->cusp [11] = Asc1 (rectasc, f, sine, cose); hsp->cusp [11] = Asc1 (rectasc, f, sine, cose);
@ -1100,8 +1185,7 @@ porphyry:
tant = tand(asind(sine*sind(Asc1 (rectasc, fh2, sine, cose)))); tant = tand(asind(sine*sind(Asc1 (rectasc, fh2, sine, cose))));
if (fabs(tant) < VERY_SMALL) { if (fabs(tant) < VERY_SMALL) {
hsp->cusp [12] = rectasc; hsp->cusp [12] = rectasc;
} } else {
else {
f = atand(sind(asind(tanfi * tant) / 1.5) / tant); f = atand(sind(asind(tanfi * tant) / 1.5) / tant);
/* pole height */ /* pole height */
hsp->cusp [12] = Asc1 (rectasc, f, sine, cose); hsp->cusp [12] = Asc1 (rectasc, f, sine, cose);
@ -1121,8 +1205,7 @@ porphyry:
tant = tand(asind(sine * sind(Asc1 (rectasc, fh2, sine, cose)))); tant = tand(asind(sine * sind(Asc1 (rectasc, fh2, sine, cose))));
if (fabs(tant) < VERY_SMALL) { if (fabs(tant) < VERY_SMALL) {
hsp->cusp [2] = rectasc; hsp->cusp [2] = rectasc;
} } else {
else {
f = atand(sind(asind(tanfi * tant) / 1.5) / tant); f = atand(sind(asind(tanfi * tant) / 1.5) / tant);
/* pole height */ /* pole height */
hsp->cusp [2] = Asc1 (rectasc, f, sine, cose); hsp->cusp [2] = Asc1 (rectasc, f, sine, cose);
@ -1142,8 +1225,7 @@ porphyry:
tant = tand(asind(sine * sind(Asc1 (rectasc, fh1, sine, cose)))); tant = tand(asind(sine * sind(Asc1 (rectasc, fh1, sine, cose))));
if (fabs(tant) < VERY_SMALL) { if (fabs(tant) < VERY_SMALL) {
hsp->cusp [3] = rectasc; hsp->cusp [3] = rectasc;
} } else {
else {
f = atand(sind(asind(tanfi * tant) / 3) / tant); f = atand(sind(asind(tanfi * tant) / 3) / tant);
/* pole height */ /* pole height */
hsp->cusp [3] = Asc1(rectasc, f, sine, cose); hsp->cusp [3] = Asc1(rectasc, f, sine, cose);
@ -1160,7 +1242,7 @@ porphyry:
} }
break; break;
} /* end switch */ } /* end switch */
if (hsy != 'G') { if (hsy != 'G' && hsy != 'Y') {
hsp->cusp [4] = swe_degnorm(hsp->cusp [10] + 180); hsp->cusp [4] = swe_degnorm(hsp->cusp [10] + 180);
hsp->cusp [5] = swe_degnorm(hsp->cusp [11] + 180); hsp->cusp [5] = swe_degnorm(hsp->cusp [11] + 180);
hsp->cusp [6] = swe_degnorm(hsp->cusp [12] + 180); hsp->cusp [6] = swe_degnorm(hsp->cusp [12] + 180);
@ -1187,13 +1269,13 @@ porphyry:
*/ */
/* equasc (equatorial ascendant) */ /* equasc (equatorial ascendant) */
th2 = swe_degnorm(th + 90); th2 = swe_degnorm(th + 90);
if (fabs(th2 - 90) > VERY_SMALL && fabs(th2 - 270) > VERY_SMALL) { if (fabs(th2 - 90) > VERY_SMALL
&& fabs(th2 - 270) > VERY_SMALL) {
tant = tand(th2); tant = tand(th2);
hsp->equasc = atand(tant / cose); hsp->equasc = atand(tant / cose);
if (th2 > 90 && th2 <= 270) if (th2 > 90 && th2 <= 270)
hsp->equasc = swe_degnorm(hsp->equasc + 180); hsp->equasc = swe_degnorm(hsp->equasc + 180);
} } else {
else {
if (fabs(th2 - 90) <= VERY_SMALL) if (fabs(th2 - 90) <= VERY_SMALL)
hsp->equasc = 90; hsp->equasc = 90;
else else
@ -1213,8 +1295,7 @@ porphyry:
} /* procedure houses */ } /* procedure houses */
/******************************/ /******************************/
static double static double Asc1 (double x1, double f, double sine, double cose)
Asc1(double x1, double f, double sine, double cose)
{ {
int n; int n;
double ass; double ass;
@ -1240,8 +1321,7 @@ Asc1(double x1, double f, double sine, double cose)
return ass; return ass;
} /* Asc1 */ } /* Asc1 */
static double static double Asc2 (double x, double f, double sine, double cose)
Asc2(double x, double f, double sine, double cose)
{ {
double ass, sinx; double ass, sinx;
ass = - tand(f) * sine + cose * cosd(x); ass = - tand(f) * sine + cose * cosd(x);
@ -1255,14 +1335,12 @@ Asc2(double x, double f, double sine, double cose)
ass = -VERY_SMALL; ass = -VERY_SMALL;
else else
ass = VERY_SMALL; ass = VERY_SMALL;
} } else if (ass == 0) {
else if (ass == 0) {
if (sinx < 0) if (sinx < 0)
ass = -90; ass = -90;
else else
ass = 90; ass = 90;
} } else {
else {
ass = atand(sinx / ass); ass = atand(sinx / ass);
} }
if (ass < 0) if (ass < 0)
@ -1298,9 +1376,8 @@ Asc2(double x, double f, double sine, double cose)
* equal, Porphyry, Alcabitius, Koch, Krusinski (all others should work). * equal, Porphyry, Alcabitius, Koch, Krusinski (all others should work).
* The Swiss Ephemeris currently does not handle these cases. * The Swiss Ephemeris currently does not handle these cases.
*/ */
double FAR PASCAL_CONV double FAR PASCAL_CONV swe_house_pos(
swe_house_pos(double armc, double geolat, double eps, int hsys, double *xpin, double armc, double geolat, double eps, int hsys, double *xpin, char *serr)
char *serr)
{ {
double xp[6], xeq[6], ra, de, mdd, mdn, sad, san; double xp[6], xeq[6], ra, de, mdd, mdn, sad, san;
double hpos, sinad, ad, a, admc, adp, samc, demc, asc, mc, acmc, tant; double hpos, sinad, ad, a, admc, adp, samc, demc, asc, mc, acmc, tant;
@ -1353,13 +1430,13 @@ swe_house_pos(double armc, double geolat, double eps, int hsys, double *xpin,
asc = Asc1 (swe_degnorm(armc + 90), geolat, sine, cose); asc = Asc1 (swe_degnorm(armc + 90), geolat, sine, cose);
demc = atand(sind(armc) * tand(eps)); demc = atand(sind(armc) * tand(eps));
/* mc */ /* mc */
if (fabs(armc - 90) > VERY_SMALL && fabs(armc - 270) > VERY_SMALL) { if (fabs(armc - 90) > VERY_SMALL
&& fabs(armc - 270) > VERY_SMALL) {
tant = tand(armc); tant = tand(armc);
mc = swe_degnorm(atand(tant / cose)); mc = swe_degnorm(atand(tant / cose));
if (armc > 90 && armc <= 270) if (armc > 90 && armc <= 270)
mc = swe_degnorm(mc + 180); mc = swe_degnorm(mc + 180);
} } else {
else {
if (fabs(armc - 90) <= VERY_SMALL) if (fabs(armc - 90) <= VERY_SMALL)
mc = 90; mc = 90;
else else
@ -1389,8 +1466,7 @@ swe_house_pos(double armc, double geolat, double eps, int hsys, double *xpin,
hpos += xp[0] * 3 / (180 - acmc); hpos += xp[0] * 3 / (180 - acmc);
else else
hpos += 3 + (xp[0] - 180 + acmc) * 3 / acmc; hpos += 3 + (xp[0] - 180 + acmc) * 3 / acmc;
} } else { /* Alcabitius */
else { /* Alcabitius */
double dek, r, sna, sda; double dek, r, sna, sda;
dek = asind(sind(asc) * sine); /* declination of Ascendant */ dek = asind(sind(asc) * sine); /* declination of Ascendant */
/* must treat the case fi == 90 or -90 */ /* must treat the case fi == 90 or -90 */
@ -1407,16 +1483,14 @@ swe_house_pos(double armc, double geolat, double eps, int hsys, double *xpin,
hpos = mdd * 90 / sda; hpos = mdd * 90 / sda;
else else
hpos = 90 + (mdd - sda) * 90 / sna; hpos = 90 + (mdd - sda) * 90 / sna;
} } else {
else {
if (mdd > -sna) if (mdd > -sna)
hpos = 360 + mdd * 90 / sna; hpos = 360 + mdd * 90 / sna;
else else
hpos = 270 + (mdd + sna) * 90 / sda; hpos = 270 + (mdd + sna) * 90 / sda;
} }
hpos = swe_degnorm(hpos - 90) / 30.0 + 1.0; hpos = swe_degnorm(hpos - 90) / 30.0 + 1.0;
if (hpos >= 13.0) if (hpos >= 13.0) hpos -= 12;
hpos -= 12;
} }
break; break;
case 'X': /* Merdidian or axial rotation system */ case 'X': /* Merdidian or axial rotation system */
@ -1424,13 +1498,13 @@ swe_house_pos(double armc, double geolat, double eps, int hsys, double *xpin,
break; break;
case 'M': { /* Morinus */ case 'M': { /* Morinus */
double a = xpin[0]; double a = xpin[0];
if (fabs(a - 90) > VERY_SMALL && fabs(a - 270) > VERY_SMALL) { if (fabs(a - 90) > VERY_SMALL
&& fabs(a - 270) > VERY_SMALL) {
tant = tand(a); tant = tand(a);
hpos = atand(tant / cose); hpos = atand(tant / cose);
if (a > 90 && a <= 270) if (a > 90 && a <= 270)
hpos = swe_degnorm(hpos + 180); hpos = swe_degnorm(hpos + 180);
} } else {
else {
if (fabs(a - 90) <= VERY_SMALL) if (fabs(a - 90) <= VERY_SMALL)
hpos = 90; hpos = 90;
else else
@ -1447,29 +1521,22 @@ swe_house_pos(double armc, double geolat, double eps, int hsys, double *xpin,
/* if body is within circumpolar region, error */ /* if body is within circumpolar region, error */
if (90 - fabs(geolat) <= fabs(de)) { if (90 - fabs(geolat) <= fabs(de)) {
if (serr != NULL) if (serr != NULL)
strcpy(serr, strcpy(serr, "no Koch house position, because planet is circumpolar.");
"no Koch house position, because planet is circumpolar.");
xp[0] = 0; xp[0] = 0;
hpos = 0; /* Error */ hpos = 0; /* Error */
} } else if (90 - fabs(geolat) <= fabs(demc)) {
else if (90 - fabs(geolat) <= fabs(demc)) {
if (serr != NULL) if (serr != NULL)
strcpy(serr, strcpy(serr, "no Koch house position, because mc is circumpolar.");
"no Koch house position, because mc is circumpolar.");
xp[0] = 0; xp[0] = 0;
hpos = 0; /* Error */ hpos = 0; /* Error */
} } else {
else {
admc = asind(tand(eps) * tand(geolat) * sind(armc)); admc = asind(tand(eps) * tand(geolat) * sind(armc));
adp = asind(tand(geolat) * tand(de)); adp = asind(tand(geolat) * tand(de));
samc = 90 + admc; samc = 90 + admc;
if (mdd >= 0) { /* east */ if (mdd >= 0) { /* east */
xp[0] = swe_degnorm(((mdd - adp + admc) / samc - 1) * 90); xp[0] = swe_degnorm(((mdd - adp + admc) / samc - 1) * 90);
} } else {
else { xp[0] = swe_degnorm(((mdd + 180 + adp + admc) / samc + 1) * 90);
xp[0] =
swe_degnorm(((mdd + 180 + adp + admc) / samc +
1) * 90);
} }
/* to make sure that a call with a house cusp position returns /* to make sure that a call with a house cusp position returns
* a value within the house, 0.001" is added */ * a value within the house, 0.001" is added */
@ -1527,8 +1594,7 @@ swe_house_pos(double armc, double geolat, double eps, int hsys, double *xpin,
/* eastern object has longer SA than midheaven */ /* eastern object has longer SA than midheaven */
if (dfac > 2 || dfac < 0) if (dfac > 2 || dfac < 0)
is_invalid = TRUE; /* if this is omitted, funny things happen */ is_invalid = TRUE; /* if this is omitted, funny things happen */
} } else {
else {
dfac = (mdd + 180 + adp + admc) / samc; dfac = (mdd + 180 + adp + admc) / samc;
xp[0] = swe_degnorm((dfac + 1) * 90); xp[0] = swe_degnorm((dfac + 1) * 90);
xp[0] = swe_degnorm(xp[0] + MILLIARCSEC); xp[0] = swe_degnorm(xp[0] + MILLIARCSEC);
@ -1541,14 +1607,12 @@ swe_house_pos(double armc, double geolat, double eps, int hsys, double *xpin,
xp[0] = 0; xp[0] = 0;
hpos = 0; hpos = 0;
if (serr != NULL) if (serr != NULL)
strcpy(serr, strcpy(serr, "Koch house position failed in circumpolar area");
"Koch house position failed in circumpolar area");
break; break;
} }
if (is_circumpolar) { if (is_circumpolar) {
if (serr != NULL) if (serr != NULL)
strcpy(serr, strcpy(serr, "Koch house position, doubtful result in circumpolar area");
"Koch house position, doubtful result in circumpolar area");
} }
/* to make sure that a call with a house cusp position returns /* to make sure that a call with a house cusp position returns
* a value within the house, 0.001" is added */ * a value within the house, 0.001" is added */
@ -1586,9 +1650,7 @@ swe_house_pos(double armc, double geolat, double eps, int hsys, double *xpin,
/* I. find plane of 'asc-zenith' great circle relative to equator: /* I. find plane of 'asc-zenith' great circle relative to equator:
* solve spherical triangle 'EP-asc-intersection of house circle with equator' */ * solve spherical triangle 'EP-asc-intersection of house circle with equator' */
/* Ia. Find intersection of house plane with equator: */ /* Ia. Find intersection of house plane with equator: */
x[0] = asc; x[0] = asc; x[1] = 0.0; x[2] = 1.0; /* 1. Start with ascendent on ecliptic */
x[1] = 0.0;
x[2] = 1.0; /* 1. Start with ascendent on ecliptic */
swe_cotrans(x, x, -eps); /* 2. Transform asc into equatorial coords */ swe_cotrans(x, x, -eps); /* 2. Transform asc into equatorial coords */
raep = swe_degnorm(armc + 90); /* 3. RA of east point */ raep = swe_degnorm(armc + 90); /* 3. RA of east point */
x[0] = swe_degnorm(raep - x[0]); /* 4. Rotation - found arc raas-raep */ x[0] = swe_degnorm(raep - x[0]); /* 4. Rotation - found arc raas-raep */
@ -1599,8 +1661,7 @@ swe_house_pos(double armc, double geolat, double eps, int hsys, double *xpin,
x[0] = swe_degnorm(xtemp); x[0] = swe_degnorm(xtemp);
raaz = swe_degnorm(raep - x[0]); /* result: RA of intersection 'asc-zenith' great circle with equator */ raaz = swe_degnorm(raep - x[0]); /* result: RA of intersection 'asc-zenith' great circle with equator */
/* Ib. Find obliquity to equator of 'asc-zenith' house plane: */ /* Ib. Find obliquity to equator of 'asc-zenith' house plane: */
x[0] = raaz; x[0] = raaz; x[1] = 0.0;
x[1] = 0.0;
x[0] = swe_degnorm(raep - x[0]); /* 1. Rotate start point relative to EP */ x[0] = swe_degnorm(raep - x[0]); /* 1. Rotate start point relative to EP */
swe_cotrans(x, x, -(90-geolat)); /* 2. Transform into horizontal coords */ swe_cotrans(x, x, -(90-geolat)); /* 2. Transform into horizontal coords */
x[1] = x[1] + 90; /* 3. Add 90 deg do decl - so get the point on house plane most distant from equ. */ x[1] = x[1] + 90; /* 3. Add 90 deg do decl - so get the point on house plane most distant from equ. */
@ -1611,9 +1672,7 @@ swe_house_pos(double armc, double geolat, double eps, int hsys, double *xpin,
* coords beginning. */ * coords beginning. */
/* IIa. Asc on house plane relative to intersection /* IIa. Asc on house plane relative to intersection
* of equator with 'asc-zenith' plane. */ * of equator with 'asc-zenith' plane. */
xasc[0] = asc; xasc[0] = asc; xasc[1] = 0.0; xasc[2] = 1.0;
xasc[1] = 0.0;
xasc[2] = 1.0;
swe_cotrans(xasc, xasc, -eps); swe_cotrans(xasc, xasc, -eps);
xasc[0] = swe_degnorm(xasc[0] - raaz); xasc[0] = swe_degnorm(xasc[0] - raaz);
xtemp = atand(tand(xasc[0])/cosd(oblaz)); xtemp = atand(tand(xasc[0])/cosd(oblaz));
@ -1708,8 +1767,7 @@ swe_house_pos(double armc, double geolat, double eps, int hsys, double *xpin,
if (xp[1] > 0) { if (xp[1] > 0) {
fh = atand(tand(fh) - tanfi / fac); fh = atand(tand(fh) - tanfi / fac);
ra0 -= 90 / fac; ra0 -= 90 / fac;
} } else {
else {
fh = atand(tand(fh) + tanfi / fac); fh = atand(tand(fh) + tanfi / fac);
ra0 += 90 / fac; ra0 += 90 / fac;
} }
@ -1736,10 +1794,8 @@ swe_house_pos(double armc, double geolat, double eps, int hsys, double *xpin,
else else
xp[0] = swe_degnorm(270 + mdd / 2); xp[0] = swe_degnorm(270 + mdd / 2);
if (serr != NULL) if (serr != NULL)
strcpy(serr, strcpy(serr, "Otto Ludwig procedure within circumpolar regions.");
"Otto Ludwig procedure within circumpolar regions."); } else {
}
else {
sinad = tand(de) * tand(geolat); sinad = tand(de) * tand(geolat);
ad = asind(sinad); ad = asind(sinad);
a = sinad + cosd(mdd); a = sinad + cosd(mdd);
@ -1758,8 +1814,7 @@ swe_house_pos(double armc, double geolat, double eps, int hsys, double *xpin,
if (hsys == 'G') { if (hsys == 'G') {
xp[0] = 360 - xp[0]; /* Gauquelin sectors are in clockwise direction */ xp[0] = 360 - xp[0]; /* Gauquelin sectors are in clockwise direction */
hpos = xp[0] / 10.0 + 1; hpos = xp[0] / 10.0 + 1;
} } else {
else {
hpos = xp[0] / 30.0 + 1; hpos = xp[0] / 30.0 + 1;
} }
break; break;

View File

@ -1,4 +1,3 @@
/******************************************************* /*******************************************************
$Header: /home/dieter/sweph/RCS/swehouse.h,v 1.74 2008/06/16 10:07:20 dieter Exp $ $Header: /home/dieter/sweph/RCS/swehouse.h,v 1.74 2008/06/16 10:07:20 dieter Exp $
module swehouse.h module swehouse.h
@ -60,8 +59,7 @@ house and (simple) aspect calculation
for promoting such software, products or services. for promoting such software, products or services.
*/ */
struct houses struct houses {
{
double cusp[37]; double cusp[37];
double ac; double ac;
double mc; double mc;

View File

@ -12,7 +12,6 @@
Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich
************************************************************/ ************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved. /* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions License conditions
@ -73,15 +72,25 @@
#include "sweph.h" #include "sweph.h"
#include "swejpl.h" #include "swejpl.h"
#if MSDOS
extern __int64 __cdecl _ftelli64(FILE *);
extern int __cdecl _fseeki64(FILE *, __int64, int);
typedef __int64 off_t;
#define FSEEK _fseeki64
#define FTELL _ftelli64
#else
#define _FILE_OFFSET_BITS 64
#define FSEEK fseeko
#define FTELL ftello
#endif
#define DEBUG_DO_SHOW FALSE #define DEBUG_DO_SHOW FALSE
#ifndef NO_JPL #ifndef NO_JPL
/* /*
* local globals * local globals
*/ */
struct jpl_save struct jpl_save {
{
char *jplfname; char *jplfname;
char *jplfpath; char *jplfpath;
FILE *jplfptr; FILE *jplfptr;
@ -99,8 +108,8 @@ struct jpl_save
static struct jpl_save *FAR js; static struct jpl_save *FAR js;
static int state(double et, int32 * list, int do_bary, double *pv, static int state (double et, int32 *list, int do_bary,
double *pvsun, double *nut, char *serr); double *pv, double *pvsun, double *nut, char *serr);
static int interp(double FAR *buf, double t, double intv, int32 ncfin, static int interp(double FAR *buf, double t, double intv, int32 ncfin,
int32 ncmin, int32 nain, int32 ifl, double *pv); int32 ncmin, int32 nain, int32 ifl, double *pv);
static int32 fsizer(char *serr); static int32 fsizer(char *serr);
@ -173,8 +182,7 @@ DE200 DE102 DE403
* set to a fixed value depending as in previous releases. The caller of * set to a fixed value depending as in previous releases. The caller of
* fsizer() will verify by data comparison whether it computed correctly. * fsizer() will verify by data comparison whether it computed correctly.
*/ */
static int32 static int32 fsizer(char *serr)
fsizer(char *serr)
{ {
/* Local variables */ /* Local variables */
int32 ncon; int32 ncon;
@ -184,9 +192,7 @@ fsizer(char *serr)
int i, kmx, khi, nd; int i, kmx, khi, nd;
int32 ksize, lpt[3]; int32 ksize, lpt[3];
char ttl[6*14*3]; char ttl[6*14*3];
if ((js->jplfptr = if ((js->jplfptr = swi_fopen(SEI_FILE_PLANET, js->jplfname, js->jplfpath, serr)) == NULL) {
swi_fopen(SEI_FILE_PLANET, js->jplfname, js->jplfpath,
serr)) == NULL) {
return NOT_AVAILABLE; return NOT_AVAILABLE;
} }
/* ttl = ephemeris title, e.g. /* ttl = ephemeris title, e.g.
@ -211,11 +217,13 @@ fsizer(char *serr)
reorder((char *) &js->eh_ss[0], sizeof(double), 3); reorder((char *) &js->eh_ss[0], sizeof(double), 3);
/* plausibility test of these constants. Start and end date must be /* plausibility test of these constants. Start and end date must be
* between -20000 and +20000, segment size >= 1 and <= 200 */ * between -20000 and +20000, segment size >= 1 and <= 200 */
if (js->eh_ss[0] < -5583942 || js->eh_ss[1] > 9025909 || js->eh_ss[2] < 1 if (js->eh_ss[0] < -5583942 || js->eh_ss[1] > 9025909 || js->eh_ss[2] < 1 || js->eh_ss[2] > 200) {
|| js->eh_ss[2] > 200) { if (serr != NULL) {
if (serr != NULL) strcpy(serr, "alleged ephemeris file has invalid format.");
sprintf(serr, "alleged ephemeris file (%s) has invalid format.", if (strlen(serr) + strlen(js->jplfname) + 3 < AS_MAXCH) {
js->jplfname); sprintf(serr, "alleged ephemeris file (%s) has invalid format.", js->jplfname);
}
}
return(NOT_AVAILABLE); return(NOT_AVAILABLE);
} }
/* ncon = number of constants */ /* ncon = number of constants */
@ -262,9 +270,7 @@ fsizer(char *serr)
nd = 2; nd = 2;
else else
nd = 3; nd = 3;
ksize = ksize = (js->eh_ipt[khi * 3 - 3] + nd * js->eh_ipt[khi * 3 - 2] * js->eh_ipt[khi * 3 - 1] - 1L) * 2L;
(js->eh_ipt[khi * 3 - 3] +
nd * js->eh_ipt[khi * 3 - 2] * js->eh_ipt[khi * 3 - 1] - 1L) * 2L;
/* /*
* de102 files give wrong ksize, because they contain 424 empty bytes * de102 files give wrong ksize, because they contain 424 empty bytes
* per record. Fixed by hand! * per record. Fixed by hand!
@ -272,7 +278,7 @@ fsizer(char *serr)
if (ksize == 1546) if (ksize == 1546)
ksize = 1652; ksize = 1652;
#if 0 /* we prefer to compute ksize to be comaptible #if 0 /* we prefer to compute ksize to be comaptible
* with new DE releases */ with new DE releases */
switch (numde) { switch (numde) {
case 403: case 403:
case 405: case 405:
@ -301,10 +307,8 @@ fsizer(char *serr)
#endif #endif
if (ksize < 1000 || ksize > 5000) { if (ksize < 1000 || ksize > 5000) {
if (serr != NULL) if (serr != NULL)
sprintf(serr, sprintf(serr, "JPL ephemeris file does not provide valid ksize (%d)", ksize);/**/
"JPL ephemeris file does not provide valid ksize (%d)", return NOT_AVAILABLE;
ksize);
/**/ return NOT_AVAILABLE;
} }
return ksize; return ksize;
} }
@ -341,8 +345,7 @@ fsizer(char *serr)
* The option is available to have the units in km and km/sec. * The option is available to have the units in km and km/sec.
* For this, set do_km=TRUE (default FALSE). * For this, set do_km=TRUE (default FALSE).
*/ */
int int swi_pleph(double et, int ntarg, int ncent, double *rrd, char *serr)
swi_pleph(double et, int ntarg, int ncent, double *rrd, char *serr)
{ {
int i, retc; int i, retc;
int32 list[12]; int32 list[12];
@ -359,8 +362,7 @@ swi_pleph(double et, int ntarg, int ncent, double *rrd, char *serr)
if (js->eh_ipt[34] > 0) { if (js->eh_ipt[34] > 0) {
list[10] = 2; list[10] = 2;
return(state(et, list, FALSE, pv, pvsun, rrd, serr)); return(state(et, list, FALSE, pv, pvsun, rrd, serr));
} } else {
else {
if (serr != NULL) if (serr != NULL)
sprintf(serr,"No nutations on the JPL ephemeris file;"); sprintf(serr,"No nutations on the JPL ephemeris file;");
return (NOT_AVAILABLE); return (NOT_AVAILABLE);
@ -374,8 +376,7 @@ swi_pleph(double et, int ntarg, int ncent, double *rrd, char *serr)
for (i = 0; i < 6; ++i) for (i = 0; i < 6; ++i)
rrd[i] = pv[i + 60]; rrd[i] = pv[i + 60];
return 0; return 0;
} } else {
else {
if (serr != NULL) if (serr != NULL)
sprintf(serr,"No librations on the ephemeris file;"); sprintf(serr,"No librations on the ephemeris file;");
return (NOT_AVAILABLE); return (NOT_AVAILABLE);
@ -413,17 +414,14 @@ swi_pleph(double et, int ntarg, int ncent, double *rrd, char *serr)
for (i = 0; i < 6; ++i) for (i = 0; i < 6; ++i)
pv[i + 6*J_EMB] = pv[i + 6*J_EARTH]; pv[i + 6*J_EMB] = pv[i + 6*J_EARTH];
} }
if ((ntarg == J_EARTH && ncent == J_MOON) if ((ntarg==J_EARTH && ncent==J_MOON) || (ntarg == J_MOON && ncent==J_EARTH)){
|| (ntarg == J_MOON && ncent == J_EARTH)) {
for (i = 0; i < 6; ++i) for (i = 0; i < 6; ++i)
pv[i + 6*J_EARTH] = 0.; pv[i + 6*J_EARTH] = 0.;
} } else {
else {
if (list[J_EARTH] == 2) { if (list[J_EARTH] == 2) {
for (i = 0; i < 6; ++i) for (i = 0; i < 6; ++i)
pv[i + 6 * J_EARTH] -= pv[i + 6*J_EARTH] -= pv[i + 6*J_MOON] / (js->eh_emrat + 1.);
pv[i + 6 * J_MOON] / (js->eh_emrat + 1.);
} }
if (list[J_MOON] == 2) { if (list[J_MOON] == 2) {
for (i = 0; i < 6; ++i) { for (i = 0; i < 6; ++i) {
@ -457,9 +455,8 @@ swi_pleph(double et, int ntarg, int ncent, double *rrd, char *serr)
* pv d.p. interpolated quantities requested. * pv d.p. interpolated quantities requested.
* assumed dimension is pv(ncm,fl). * assumed dimension is pv(ncm,fl).
*/ */
static int static int interp(double FAR *buf, double t, double intv, int32 ncfin,
interp(double FAR * buf, double t, double intv, int32 ncfin, int32 ncmin, int32 ncmin, int32 nain, int32 ifl, double *pv)
int32 nain, int32 ifl, double *pv)
{ {
/* Initialized data */ /* Initialized data */
static int FAR np, nv; static int FAR np, nv;
@ -480,8 +477,8 @@ interp(double FAR * buf, double t, double intv, int32 ncfin, int32 ncmin,
double dt1, bma; double dt1, bma;
double bma2, bma3; double bma2, bma3;
/* /*
* | get correct sub-interval number for this set of coefficients and then | get correct sub-interval number for this set of coefficients and then
* | get normalized chebyshev time within that subinterval. | get normalized chebyshev time within that subinterval.
*/ */
if (t >= 0) if (t >= 0)
dt1 = floor(t); dt1 = floor(t);
@ -638,12 +635,12 @@ interp(double FAR * buf, double t, double intv, int32 ncfin, int32 ncmin,
| default value = FALSE (km determines time unit | default value = FALSE (km determines time unit
| for nutations and librations. angle unit is always radians.) | for nutations and librations. angle unit is always radians.)
*/ */
static int static int state(double et, int32 *list, int do_bary,
state(double et, int32 * list, int do_bary, double *pv, double *pvsun, double *pv, double *pvsun, double *nut, char *serr)
double *nut, char *serr)
{ {
int i, j, k; int i, j, k;
int32 flen, nseg, nb; int32 nseg;
off_t flen, nb;
double FAR *buf = js->buf; double FAR *buf = js->buf;
double aufac, s, t, intv, ts[4]; double aufac, s, t, intv, ts[4];
int32 nrecl, ksize; int32 nrecl, ksize;
@ -699,41 +696,18 @@ state(double et, int32 * list, int do_bary, double *pv, double *pvsun,
if (js->do_reorder) if (js->do_reorder)
reorder((char *) &lpt[0], sizeof(int32), 3); reorder((char *) &lpt[0], sizeof(int32), 3);
/* cval[]: other constants in next record */ /* cval[]: other constants in next record */
fseek(js->jplfptr, 1L * irecsz, 0); FSEEK(js->jplfptr, (off_t) (1L * irecsz), 0);
fread((void *) &js->eh_cval[0], sizeof(double), 400, js->jplfptr); fread((void *) &js->eh_cval[0], sizeof(double), 400, js->jplfptr);
if (js->do_reorder) if (js->do_reorder)
reorder((char *) &js->eh_cval[0], sizeof(double), 400); reorder((char *) &js->eh_cval[0], sizeof(double), 400);
/* new 26-aug-2008: verify correct block size */ /* new 26-aug-2008: verify correct block size */
#if 0
sp = strstr(js->ch_cnam, "EMRAT ");
if (sp == NULL) {
if (serr != NULL)
sprintf(serr,
"JPL ephemeris file strange, constant name 'EMRAT' missing");
return ERR;
}
i = (sp - js->ch_cnam);
if (i % 6 != 0) {
if (serr != NULL)
sprintf(serr,
"JPL ephemeris file strange, constant name 'EMRAT' not at multiple of 6");
return ERR;
}
i = i / 6; /* position of EMRAT in constant array eh_cval */
if (js->eh_cval[i] != js->eh_emrat) {
if (serr != NULL)
sprintf(serr,
"JPL ephemeris file error, record size failed EMRAT check");
return ERR;
}
#endif
for (i = 0; i < 3; ++i) for (i = 0; i < 3; ++i)
ipt[i + 36] = lpt[i]; ipt[i + 36] = lpt[i];
nrl = 0; nrl = 0;
/* is file length correct? */ /* is file length correct? */
/* file length */ /* file length */
fseek(js->jplfptr, 0L, SEEK_END); FSEEK(js->jplfptr, (off_t) 0L, SEEK_END);
flen = ftell(js->jplfptr); flen = FTELL(js->jplfptr);
/* # of segments in file */ /* # of segments in file */
nseg = (int32) ((js->eh_ss[1] - js->eh_ss[0]) / js->eh_ss[2]); nseg = (int32) ((js->eh_ss[1] - js->eh_ss[0]) / js->eh_ss[2]);
/* sum of all cheby coeffs of all planets and segments */ /* sum of all cheby coeffs of all planets and segments */
@ -755,32 +729,29 @@ state(double et, int32 * list, int do_bary, double *pv, double *pvsun,
#endif #endif
if (flen != nb if (flen != nb
/* some of our files are one record too long */ /* some of our files are one record too long */
&& flen - nb != ksize * nrecl) { && flen - nb != ksize * nrecl
) {
if (serr != NULL) { if (serr != NULL) {
sprintf(serr, sprintf(serr, "JPL ephemeris file is mutilated; length = %d instead of %d.", (unsigned int) flen, (unsigned int) nb);
"JPL ephemeris file is mutilated; length = %d instead of %d.", if (strlen(serr) + strlen(js->jplfname) < AS_MAXCH - 1) {
flen, nb); sprintf(serr, "JPL ephemeris file %s is mutilated; length = %d instead of %d.", js->jplfname, (unsigned int) flen, (unsigned int) nb);
if (strlen(serr) + strlen(js->jplfname) < AS_MAXCH - 1) }
sprintf(serr,
"JPL ephemeris file %s is mutilated; length = %d instead of %d.",
js->jplfname, flen, nb);
} }
return(NOT_AVAILABLE); return(NOT_AVAILABLE);
} }
/* check if start and end dates in segments are the same as in /* check if start and end dates in segments are the same as in
* file header */ * file header */
fseek(js->jplfptr, 2L * irecsz, 0); FSEEK(js->jplfptr, (off_t) (2L * irecsz), 0);
fread((void *) &ts[0], sizeof(double), 2, js->jplfptr); fread((void *) &ts[0], sizeof(double), 2, js->jplfptr);
if (js->do_reorder) if (js->do_reorder)
reorder((char *) &ts[0], sizeof(double), 2); reorder((char *) &ts[0], sizeof(double), 2);
fseek(js->jplfptr, (nseg + 2 - 1) * irecsz, 0); FSEEK(js->jplfptr, (off_t) ((nseg + 2 - 1) * ((off_t) irecsz)), 0);
fread((void *) &ts[2], sizeof(double), 2, js->jplfptr); fread((void *) &ts[2], sizeof(double), 2, js->jplfptr);
if (js->do_reorder) if (js->do_reorder)
reorder((char *) &ts[2], sizeof(double), 2); reorder((char *) &ts[2], sizeof(double), 2);
if (ts[0] != js->eh_ss[0] || ts[3] != js->eh_ss[1]) { if (ts[0] != js->eh_ss[0] || ts[3] != js->eh_ss[1]) {
if (serr != NULL) if (serr != NULL)
strcpy(serr, sprintf(serr, "JPL ephemeris file is corrupt; start/end date check failed. %.1f != %.1f || %.1f != %.1f", ts[0],js->eh_ss[0],ts[3],js->eh_ss[1]);
"JPL ephemeris file is corrupt; start/end date check failed.");
return NOT_AVAILABLE; return NOT_AVAILABLE;
} }
} }
@ -793,27 +764,24 @@ state(double et, int32 * list, int do_bary, double *pv, double *pvsun,
/* error return for epoch out of range */ /* error return for epoch out of range */
if (et < js->eh_ss[0] || et > js->eh_ss[1]) { if (et < js->eh_ss[0] || et > js->eh_ss[1]) {
if (serr != NULL) if (serr != NULL)
sprintf(serr, "jd %f outside JPL eph. range %.2f .. %.2f;", et, sprintf(serr,"jd %f outside JPL eph. range %.2f .. %.2f;", et, js->eh_ss[0], js->eh_ss[1]);
js->eh_ss[0], js->eh_ss[1]);
return BEYOND_EPH_LIMITS; return BEYOND_EPH_LIMITS;
} }
/* calculate record # and relative time in interval */ /* calculate record # and relative time in interval */
nr = (int32) ((et_mn - js->eh_ss[0]) / js->eh_ss[2]) + 2; nr = (int32) ((et_mn - js->eh_ss[0]) / js->eh_ss[2]) + 2;
if (et_mn == js->eh_ss[1]) if (et_mn == js->eh_ss[1])
--nr; /* end point of ephemeris, use last record */ --nr; /* end point of ephemeris, use last record */
t = (et_mn - ((nr - 2) * js->eh_ss[2] + js->eh_ss[0]) + t = (et_mn - ((nr - 2) * js->eh_ss[2] + js->eh_ss[0]) + et_fr) / js->eh_ss[2];
et_fr) / js->eh_ss[2];
/* read correct record if not in core */ /* read correct record if not in core */
if (nr != nrl) { if (nr != nrl) {
nrl = nr; nrl = nr;
if (fseek(js->jplfptr, nr * irecsz, 0) != 0) { if (FSEEK(js->jplfptr, (off_t) (nr * ((off_t) irecsz)), 0) != 0) {
if (serr != NULL) if (serr != NULL)
sprintf(serr, "Read error in JPL eph. at %f\n", et); sprintf(serr, "Read error in JPL eph. at %f\n", et);
return NOT_AVAILABLE; return NOT_AVAILABLE;
} }
for (k = 1; k <= ncoeffs; ++k) { for (k = 1; k <= ncoeffs; ++k) {
if (fread((void *)&buf[k - 1], sizeof(double), 1, js->jplfptr) != if ( fread((void *) &buf[k - 1], sizeof(double), 1, js->jplfptr) != 1) {
1) {
if (serr != NULL) if (serr != NULL)
sprintf(serr, "Read error in JPL eph. at %f\n", et); sprintf(serr, "Read error in JPL eph. at %f\n", et);
return NOT_AVAILABLE; return NOT_AVAILABLE;
@ -825,8 +793,7 @@ state(double et, int32 * list, int do_bary, double *pv, double *pvsun,
if (js->do_km) { if (js->do_km) {
intv = js->eh_ss[2] * 86400.; intv = js->eh_ss[2] * 86400.;
aufac = 1.; aufac = 1.;
} } else {
else {
intv = js->eh_ss[2]; intv = js->eh_ss[2];
aufac = 1. / js->eh_au; aufac = 1. / js->eh_au;
} }
@ -843,8 +810,7 @@ state(double et, int32 * list, int do_bary, double *pv, double *pvsun,
for (j = 0; j < 6; ++j) { for (j = 0; j < 6; ++j) {
if (i < 9 && ! do_bary) { if (i < 9 && ! do_bary) {
pv[j + i * 6] = pv[j + i * 6] * aufac - pvsun[j]; pv[j + i * 6] = pv[j + i * 6] * aufac - pvsun[j];
} } else {
else {
pv[j + i * 6] *= aufac; pv[j + i * 6] *= aufac;
} }
} }
@ -867,8 +833,7 @@ state(double et, int32 * list, int do_bary, double *pv, double *pvsun,
* this entry obtains the constants from the ephemeris file * this entry obtains the constants from the ephemeris file
* call state to initialize the ephemeris and read in the constants * call state to initialize the ephemeris and read in the constants
*/ */
static int static int read_const_jpl(double *ss, char *serr)
read_const_jpl(double *ss, char *serr)
{ {
int i, retc; int i, retc;
retc = state(0.0, NULL, FALSE, NULL, NULL, NULL, serr); retc = state(0.0, NULL, FALSE, NULL, NULL, NULL, serr);
@ -880,25 +845,22 @@ read_const_jpl(double *ss, char *serr)
{ {
static char FAR *bname[] = { static char FAR *bname[] = {
"Mercury", "Venus", "EMB", "Mars", "Jupiter", "Saturn", "Mercury", "Venus", "EMB", "Mars", "Jupiter", "Saturn",
"Uranus", "Neptune", "Pluto", "Moon", "SunBary", "Nut", "Libr" "Uranus", "Neptune", "Pluto", "Moon", "SunBary", "Nut", "Libr"};
};
int j, k; int j, k;
int32 nb, nc; int32 nb, nc;
printf(" JPL TEST-EPHEMERIS program. Version October 1995.\n"); printf(" JPL TEST-EPHEMERIS program. Version October 1995.\n");
for (i = 0; i < 13; i++) { for (i = 0; i < 13; i++) {
j = i * 3; j = i * 3;
k = 3; k = 3;
if (i == 11) if (i == 11) k = 2;
k = 2;
nb = js->eh_ipt[j+1] * js->eh_ipt[j+2] * k; nb = js->eh_ipt[j+1] * js->eh_ipt[j+2] * k;
nc = (int32) (nb * 36525L / js->eh_ss[2] * 8L); nc = (int32) (nb * 36525L / js->eh_ss[2] * 8L);
printf("%s\t%d\tipt[%d]\t%3ld %2ld %2ld,\t", bname[i], i, j, printf("%s\t%d\tipt[%d]\t%3ld %2ld %2ld,\t",
js->eh_ipt[j], js->eh_ipt[j + 1], js->eh_ipt[j + 2]); bname[i], i, j, js->eh_ipt[j], js->eh_ipt[j+1], js->eh_ipt[j+2]);
printf("%3ld double, bytes per century = %6ld\n", nb, nc); printf("%3ld double, bytes per century = %6ld\n", nb, nc);
fflush(stdout); fflush(stdout);
} }
printf("%16.2f %16.2f %16.2f\n", js->eh_ss[0], js->eh_ss[1], printf("%16.2f %16.2f %16.2f\n", js->eh_ss[0], js->eh_ss[1], js->eh_ss[2]);
js->eh_ss[2]);
for (i = 0; i < js->eh_ncon; ++i) for (i = 0; i < js->eh_ncon; ++i)
printf("%.6s\t%24.16f\n", js->ch_cnam + i * 6, js->eh_cval[i]); printf("%.6s\t%24.16f\n", js->ch_cnam + i * 6, js->eh_cval[i]);
fflush(stdout); fflush(stdout);
@ -907,8 +869,7 @@ read_const_jpl(double *ss, char *serr)
return OK; return OK;
} }
static void static void reorder(char *x, int size, int number)
reorder(char *x, int size, int number)
{ {
int i, j; int i, j;
char s[8]; char s[8];
@ -923,8 +884,7 @@ reorder(char *x, int size, int number)
} }
} }
void void swi_close_jpl_file(void)
swi_close_jpl_file(void)
{ {
if (js != NULL) { if (js != NULL) {
if (js->jplfptr != NULL) if (js->jplfptr != NULL)
@ -938,8 +898,7 @@ swi_close_jpl_file(void)
} }
} }
int int swi_open_jpl_file(double *ss, char *fname, char *fpath, char *serr)
swi_open_jpl_file(double *ss, char *fname, char *fpath, char *serr)
{ {
int retc = OK; int retc = OK;
/* if open, return */ /* if open, return */
@ -947,7 +906,8 @@ swi_open_jpl_file(double *ss, char *fname, char *fpath, char *serr)
return OK; return OK;
if ((js = (struct jpl_save *) CALLOC(1, sizeof(struct jpl_save))) == NULL if ((js = (struct jpl_save *) CALLOC(1, sizeof(struct jpl_save))) == NULL
|| (js->jplfname = MALLOC(strlen(fname)+1)) == NULL || (js->jplfname = MALLOC(strlen(fname)+1)) == NULL
|| (js->jplfpath = MALLOC(strlen(fpath) + 1)) == NULL) { || (js->jplfpath = MALLOC(strlen(fpath)+1)) == NULL
) {
if (serr != NULL) if (serr != NULL)
strcpy(serr, "error in malloc() with JPL ephemeris."); strcpy(serr, "error in malloc() with JPL ephemeris.");
return ERR; return ERR;
@ -968,9 +928,9 @@ swi_open_jpl_file(double *ss, char *fname, char *fpath, char *serr)
return retc; return retc;
} }
int32 int32 swi_get_jpl_denum()
swi_get_jpl_denum()
{ {
return js->eh_denum; return js->eh_denum;
} }
#endif /* NO_JPL */ #endif /* NO_JPL */

View File

@ -1,17 +1,14 @@
/* /*
| $Header: /home/dieter/sweph/RCS/swejpl.h,v 1.74 2008/06/16 10:07:20 dieter Exp $ | $Header: /home/dieter/sweph/RCS/swejpl.h,v 1.74 2008/06/16 10:07:20 dieter Exp $
| |
| Subroutines for reading JPL ephemerides. | Subroutines for reading JPL ephemerides.
| derived from testeph.f as contained in DE403 distribution July 1995. | derived from testeph.f as contained in DE403 distribution July 1995.
| works with DE200, DE102, DE403, DE404, DE405, DE406 | works with DE200, DE102, DE403, DE404, DE405, DE406, DE431
| (attention, DE102 has 950 reference frame and also DE403 has slightly | (attention, these ephemerides do not have exactly the same reference frame)
| different reference frame from DE200).
Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich
**************************************************************/ **************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved. /* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions License conditions
@ -91,8 +88,7 @@
* ntarg can be all of the above, ncent all except J_NUT and J_LIB. * ntarg can be all of the above, ncent all except J_NUT and J_LIB.
* Librations and Nutations are not affected by ncent. * Librations and Nutations are not affected by ncent.
*/ */
extern int swi_pleph(double et, int ntarg, int ncent, double *rrd, extern int swi_pleph(double et, int ntarg, int ncent, double *rrd, char *serr);
char *serr);
/* /*
* read the ephemeris constants. ss[0..2] returns start, end and granule size. * read the ephemeris constants. ss[0..2] returns start, end and granule size.
@ -100,9 +96,9 @@ extern int swi_pleph(double et, int ntarg, int ncent, double *rrd,
*/ */
extern void swi_close_jpl_file(void); extern void swi_close_jpl_file(void);
extern int swi_open_jpl_file(double *ss, char *fname, char *fpath, extern int swi_open_jpl_file(double *ss, char *fname, char *fpath, char *serr);
char *serr);
extern int32 swi_get_jpl_denum(void); extern int32 swi_get_jpl_denum(void);
extern void swi_IERS_FK5(double *xin, double *xout, int dir); extern void swi_IERS_FK5(double *xin, double *xout, int dir);

View File

@ -1,11 +1,9 @@
/* SWISSEPH /* SWISSEPH
$Header: /home/dieter/sweph/RCS/swemmoon.c,v 1.74 2008/06/16 10:07:20 dieter Exp $ $Header: /home/dieter/sweph/RCS/swemmoon.c,v 1.74 2008/06/16 10:07:20 dieter Exp $
* *
* Steve Moshier's analytical lunar ephemeris * Steve Moshier's analytical lunar ephemeris
**************************************************************/ **************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved. /* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions License conditions
@ -189,8 +187,8 @@ static void mean_elements(void);
static void mean_elements_pl(void); static void mean_elements_pl(void);
static double mods3600(double x); static double mods3600(double x);
static void ecldat_equ2000(double tjd, double *xpm); static void ecldat_equ2000(double tjd, double *xpm);
static void chewm(short *pt, int nlines, int nangles, int typflg, static void chewm(short *pt, int nlines, int nangles,
double *ans); int typflg, double *ans );
static void sscc(int k, double arg, int n ); static void sscc(int k, double arg, int n );
static void moon1(void); static void moon1(void);
static void moon2(void); static void moon2(void);
@ -199,7 +197,6 @@ static void moon4(void);
#ifdef MOSH_MOON_200 #ifdef MOSH_MOON_200
/* The following coefficients were calculated by a simultaneous least /* The following coefficients were calculated by a simultaneous least
* squares fit between the analytical theory and the continued DE200 * squares fit between the analytical theory and the continued DE200
* numerically integrated ephemeris from 9000 BC to 13000 AD. * numerically integrated ephemeris from 9000 BC to 13000 AD.
@ -280,14 +277,12 @@ static double z[] = {
-1.238363006354e-002, /* t^3 sin(2D + 2l' - l) */ -1.238363006354e-002, /* t^3 sin(2D + 2l' - l) */
}; };
#else #else
/* The following coefficients were calculated by a simultaneous least /* The following coefficients were calculated by a simultaneous least
* squares fit between the analytical theory and DE404 on the finite * squares fit between the analytical theory and DE404 on the finite
* interval from -3000 to +3000. * interval from -3000 to +3000.
* The coefficients were estimated from 34,247 Lunar positions. * The coefficients were estimated from 34,247 Lunar positions.
*/ */
static double FAR z[] = { static double FAR z[] = {
/* The following are scaled in arc seconds, time in Julian centuries. /* The following are scaled in arc seconds, time in Julian centuries.
They replace the corresponding terms in the mean elements. */ They replace the corresponding terms in the mean elements. */
-1.312045233711e+01, /* F, t^2 */ -1.312045233711e+01, /* F, t^2 */
@ -302,7 +297,6 @@ static double FAR z[] = {
-5.663161722088e+00, /* L, t^2 */ -5.663161722088e+00, /* L, t^2 */
5.722859298199e-03, /* L, t^3 */ 5.722859298199e-03, /* L, t^3 */
-8.466472828815e-05, /* L, t^4 */ -8.466472828815e-05, /* L, t^4 */
/* The following longitude terms are in arc seconds times 10^5. */ /* The following longitude terms are in arc seconds times 10^5. */
-8.429817796435e+01, /* t^2 cos(18V - 16E - l) */ -8.429817796435e+01, /* t^2 cos(18V - 16E - l) */
-2.072552484689e+02, /* t^2 sin(18V - 16E - l) */ -2.072552484689e+02, /* t^2 sin(18V - 16E - l) */
@ -324,7 +318,6 @@ static double FAR z[] = {
*/ */
#define NLR 118 #define NLR 118
static short FAR LR[8*NLR] = { static short FAR LR[8*NLR] = {
/* /*
Longitude Radius Longitude Radius
D l' l F 1" .0001" 1km .0001km */ D l' l F 1" .0001" 1km .0001km */
@ -453,7 +446,6 @@ static short FAR LR[8 * NLR] = {
#ifdef MOSH_MOON_200 #ifdef MOSH_MOON_200
#define NMB 56 #define NMB 56
static short FAR MB[6*NMB] = { static short FAR MB[6*NMB] = {
/* /*
Latitude Latitude
D l' l F 1" .0001" */ D l' l F 1" .0001" */
@ -518,7 +510,6 @@ static short FAR MB[6 * NMB] = {
#else #else
#define NMB 77 #define NMB 77
static short FAR MB[6*NMB] = { static short FAR MB[6*NMB] = {
/* /*
Latitude Latitude
D l' l F 1" .0001" */ D l' l F 1" .0001" */
@ -605,7 +596,6 @@ static short FAR MB[6 * NMB] = {
#define NLRT 38 #define NLRT 38
static short FAR LRT[8*NLRT] = { static short FAR LRT[8*NLRT] = {
/* /*
Multiply by T Multiply by T
Longitude Radius Longitude Radius
@ -653,7 +643,6 @@ Multiply by T
#define NBT 16 #define NBT 16
static short FAR BT[5*NBT] = { static short FAR BT[5*NBT] = {
/* /*
Multiply by T Multiply by T
Latitude Latitude
@ -679,7 +668,6 @@ Multiply by T
#define NLRT2 25 #define NLRT2 25
static short FAR LRT2[6*NLRT2] = { static short FAR LRT2[6*NLRT2] = {
/* /*
Multiply by T^2 Multiply by T^2
Longitude Radius Longitude Radius
@ -714,7 +702,6 @@ Multiply by T^2
#define NBT2 12 #define NBT2 12
static short FAR BT2[5*NBT2] = { static short FAR BT2[5*NBT2] = {
/* /*
Multiply by T^2 Multiply by T^2
Latitiude Latitiude
@ -734,6 +721,90 @@ Multiply by T^2
2,-2, 0,-1, -2, 2,-2, 0,-1, -2,
}; };
/* corrections for mean lunar node in degrees, from -13100 to 17200,
* in 100-year steps. corrections are set to 0 between the years 0 and 3000 */
static double mean_node_corr[] = {
-2.56,
-2.473, -2.392347, -2.316425, -2.239639, -2.167764, -2.095100, -2.024810, -1.957622, -1.890097, -1.826389,
-1.763335, -1.701047, -1.643016, -1.584186, -1.527309, -1.473352, -1.418917, -1.367736, -1.317202, -1.267269,
-1.221121, -1.174218, -1.128862, -1.086214, -1.042998, -1.002491, -0.962635, -0.923176, -0.887191, -0.850403,
-0.814929, -0.782117, -0.748462, -0.717241, -0.686598, -0.656013, -0.628726, -0.600460, -0.573219, -0.548634,
-0.522931, -0.499285, -0.476273, -0.452978, -0.432663, -0.411386, -0.390788, -0.372825, -0.353681, -0.336230,
-0.319520, -0.302343, -0.287794, -0.272262, -0.257166, -0.244534, -0.230635, -0.218126, -0.206365, -0.194000,
-0.183876, -0.172782, -0.161877, -0.153254, -0.143371, -0.134501, -0.126552, -0.117932, -0.111199, -0.103716,
-0.096160, -0.090718, -0.084046, -0.078007, -0.072959, -0.067235, -0.062990, -0.058102, -0.053070, -0.049786,
-0.045381, -0.041317, -0.038165, -0.034501, -0.031871, -0.028844, -0.025701, -0.024018, -0.021427, -0.018881,
-0.017291, -0.015186, -0.013755, -0.012098, -0.010261, -0.009688, -0.008218, -0.006670, -0.005979, -0.004756,
-0.003991, -0.002996, -0.001974, -0.001975, -0.001213, -0.000377, -0.000356, 5.779e-05, 0.000378, 0.000710,
0.001092, 0.000767, 0.000985, 0.001443, 0.001069, 0.001141, 0.001321, 0.001462, 0.001695, 0.001319,
0.001567, 0.001873, 0.001376, 0.001336, 0.001347, 0.001330, 0.001256, 0.000813, 0.000946, 0.001079,
#if 0
0.000509, 0.000375, 0.000477, 0.000321, 0.000279, 5.998e-05, 0.000251, 0.000623, 0.000180, 0.000225,
0.000506, 0.000331, 0.000253, 4.156e-05, 0.000247, 0.000394, -9.294e-05, -2.738e-05, 0.000140, -6.193e-05,
-0.000232, -0.000361, -0.000152, -3.571e-05, -0.000395, -0.000218, 0.000127, -0.000125, -0.000254, -0.000339,
#endif
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
-0.000364, -0.000452, -0.001091, -0.001159, -0.001136, -0.001798, -0.002249, -0.002622, -0.002990, -0.003555,
-0.004425, -0.004758, -0.005134, -0.006065, -0.006839, -0.007474, -0.008283, -0.009411, -0.010786, -0.011810,
-0.012989, -0.014825, -0.016426, -0.017922, -0.019774, -0.021881, -0.024194, -0.026190, -0.028440, -0.031285,
-0.033817, -0.036318, -0.039212, -0.042456, -0.045799, -0.048994, -0.052710, -0.056948, -0.061017, -0.065181,
-0.069843, -0.074922, -0.079976, -0.085052, -0.090755, -0.096840, -0.102797, -0.108939, -0.115568, -0.122636,
-0.129593, -0.136683, -0.144641, -0.152825, -0.161044, -0.169758, -0.178916, -0.188712, -0.198401, -0.208312,
-0.219395, -0.230407, -0.241577, -0.253508, -0.265640, -0.278556, -0.291330, -0.304353, -0.318815, -0.332882,
-0.347316, -0.362895, -0.378421, -0.395061, -0.411748, -0.428666, -0.447477, -0.465636, -0.484277, -0.504600,
-0.524405, -0.545533, -0.567020, -0.588404, -0.612099, -0.634965, -0.658262, -0.683866, -0.708526, -0.734719,
-0.761800, -0.788562, -0.818092, -0.846885, -0.876177, -0.908385, -0.939371, -0.972027, -1.006149, -1.039634,
-1.076135, -1.112156, -1.148490, -1.188312, -1.226761, -1.266821, -1.309156, -1.350583, -1.395223, -1.440028,
-1.485047, -1.534104, -1.582023, -1.631506, -1.684031, -1.735687, -1.790421, -1.846039, -1.901951, -1.961872,
-2.021179, -2.081987, -2.146259, -2.210031, -2.276609, -2.344904, -2.413795, -2.486559, -2.559564, -2.634215,
-2.712692, -2.791289, -2.872533, -2.956217, -3.040965, -3.129234, -3.218545, -3.309805, -3.404827, -3.5008,
-3.601, -3.7, -3.8,
};
/* corrections for mean lunar apsides in degrees, from -13100 to 17200,
* in 100-year steps. corrections are set to 0 between the years 0 and 3000 */
static double mean_apsis_corr[] = {
7.525,
7.290, 7.057295, 6.830813, 6.611723, 6.396775, 6.189569, 5.985968, 5.788342, 5.597304, 5.410167,
5.229946, 5.053389, 4.882187, 4.716494, 4.553532, 4.396734, 4.243718, 4.094282, 3.950865, 3.810366,
3.674978, 3.543284, 3.414270, 3.290526, 3.168775, 3.050904, 2.937541, 2.826189, 2.719822, 2.616193,
2.515431, 2.419193, 2.323782, 2.232545, 2.143635, 2.056803, 1.974913, 1.893874, 1.816201, 1.741957,
1.668083, 1.598335, 1.529645, 1.463016, 1.399693, 1.336905, 1.278097, 1.220965, 1.165092, 1.113071,
1.060858, 1.011007, 0.963701, 0.916523, 0.872887, 0.829596, 0.788486, 0.750017, 0.711177, 0.675589,
0.640303, 0.605303, 0.573490, 0.541113, 0.511482, 0.483159, 0.455210, 0.430305, 0.404643, 0.380782,
0.358524, 0.335405, 0.315244, 0.295131, 0.275766, 0.259223, 0.241586, 0.225890, 0.210404, 0.194775,
0.181573, 0.167246, 0.154514, 0.143435, 0.131131, 0.121648, 0.111835, 0.102474, 0.094284, 0.085204,
0.078240, 0.070697, 0.063696, 0.058894, 0.052390, 0.047632, 0.043129, 0.037823, 0.034143, 0.029188,
0.025648, 0.021972, 0.018348, 0.017127, 0.013989, 0.011967, 0.011003, 0.007865, 0.007033, 0.005574,
0.004060, 0.003699, 0.002465, 0.002889, 0.002144, 0.001018, 0.001757, -9.67e-05, -0.000734, -0.000392,
-0.001546, -0.000863, -0.001266, -0.000933, -0.000503, -0.001304, 0.000238, -0.000507, -0.000897, 0.000647,
#if 0
-0.000247, 0.000938, 0.001373, 0.001159, 0.001644, 0.000691, 0.001454, 0.000532, -0.000249, 0.000871,
-0.000210, 0.000171, 0.000702, 0.000389, 0.000609, -0.000250, 0.000426, 0.000123, -0.000339, 0.001200,
0.000413, 0.000612, 0.001169, 0.000163, 0.000553, -0.000330, -0.000498, -0.000224, -0.000948, 0.000863,
#endif
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.000514, 0.000683, 0.002228, 0.001974, 0.003485, 0.004280, 0.005409, 0.007468, 0.007938, 0.011012,
0.012525, 0.013757, 0.016757, 0.017932, 0.020780, 0.023416, 0.026386, 0.030428, 0.033512, 0.038789,
0.043126, 0.047778, 0.054175, 0.058891, 0.065878, 0.072345, 0.079668, 0.088238, 0.095307, 0.104873,
0.113533, 0.122336, 0.133205, 0.142922, 0.154871, 0.166488, 0.179234, 0.193928, 0.207262, 0.223089,
0.238736, 0.254907, 0.273232, 0.291085, 0.311046, 0.331025, 0.351955, 0.374422, 0.396341, 0.420772,
0.444867, 0.469984, 0.497448, 0.524717, 0.554752, 0.584581, 0.616272, 0.649744, 0.682947, 0.719405,
0.755834, 0.793780, 0.833875, 0.873893, 0.917340, 0.960429, 1.005471, 1.052384, 1.099317, 1.149508,
1.200130, 1.253038, 1.307672, 1.363480, 1.422592, 1.481900, 1.544111, 1.607982, 1.672954, 1.741025,
1.809727, 1.882038, 1.955243, 2.029956, 2.108428, 2.186805, 2.268697, 2.352071, 2.437370, 2.525903,
2.615415, 2.709082, 2.804198, 2.901704, 3.002606, 3.104412, 3.210406, 3.317733, 3.428386, 3.541634,
3.656634, 3.775988, 3.896306, 4.020480, 4.146814, 4.275356, 4.408257, 4.542282, 4.681174, 4.822524,
4.966424, 5.114948, 5.264973, 5.419906, 5.577056, 5.737688, 5.902347, 6.069138, 6.241065, 6.415155,
6.593317, 6.774853, 6.959322, 7.148845, 7.340334, 7.537156, 7.737358, 7.940882, 8.149932, 8.361576,
8.579150, 8.799591, 9.024378, 9.254584, 9.487362, 9.726535, 9.968784, 10.216089, 10.467716, 10.725293,
10.986, 11.25, 11.52,
};
/* The following times are set up by update() and refer /* The following times are set up by update() and refer
* to the same instant. The distinction between them * to the same instant. The distinction between them
* is required by altaz(). * is required by altaz().
@ -775,8 +846,7 @@ static double l4;
/* Calculate geometric coordinates of Moon /* Calculate geometric coordinates of Moon
* without light time or nutation correction. * without light time or nutation correction.
*/ */
int int swi_moshmoon2(double J, double *pol)
swi_moshmoon2(double J, double *pol)
{ {
int i; int i;
T = (J-J2000)/36525.0; T = (J-J2000)/36525.0;
@ -797,8 +867,7 @@ swi_moshmoon2(double J, double *pol)
* xpm array of 6 doubles for moon's position and speed vectors * xpm array of 6 doubles for moon's position and speed vectors
* serr pointer to error string * serr pointer to error string
*/ */
int int swi_moshmoon(double tjd, AS_BOOL do_save, double *xpmret, char *serr)
swi_moshmoon(double tjd, AS_BOOL do_save, double *xpmret, char *serr)
{ {
int i; int i;
double a, b, x1[6], x2[6], t; double a, b, x1[6], x2[6], t;
@ -866,8 +935,7 @@ swi_moshmoon(double tjd, AS_BOOL do_save, double *xpmret, char *serr)
} }
#ifdef MOSH_MOON_200 #ifdef MOSH_MOON_200
static void static void moon1()
moon1()
{ {
double a; double a;
@ -1112,13 +1180,10 @@ moon1()
moonpol[2] *= a; moonpol[2] *= a;
} }
#else #else
static void static void moon1()
moon1()
{ {
double a; double a;
/* This code added by Bhanu Pinnamaneni, 17-aug-2009 */ /* This code added by Bhanu Pinnamaneni, 17-aug-2009 */
/* Note by Dieter: Bhanu noted that ss and cc are not sufficiently /* Note by Dieter: Bhanu noted that ss and cc are not sufficiently
* initialised and random values are used for the calculation. * initialised and random values are used for the calculation.
* However, this may be only part of the bug. * However, this may be only part of the bug.
@ -1133,7 +1198,6 @@ moon1()
cc[i][j] = 0; cc[i][j] = 0;
} }
} }
/* End of code addition */ /* End of code addition */
sscc( 0, STR*D, 6 ); sscc( 0, STR*D, 6 );
sscc( 1, STR*M, 4 ); sscc( 1, STR*M, 4 );
@ -1142,7 +1206,6 @@ moon1()
moonpol[0] = 0.0; moonpol[0] = 0.0;
moonpol[1] = 0.0; moonpol[1] = 0.0;
moonpol[2] = 0.0; moonpol[2] = 0.0;
/* terms in T^2, scale 1.0 = 10^-5" */ /* terms in T^2, scale 1.0 = 10^-5" */
chewm( LRT2, NLRT2, 4, 2, moonpol ); chewm( LRT2, NLRT2, 4, 2, moonpol );
chewm( BT2, NBT2, 4, 4, moonpol ); chewm( BT2, NBT2, 4, 4, moonpol );
@ -1199,10 +1262,8 @@ moon1()
sg = sin(g); sg = sin(g);
l += 0.000116 * cg + 7.063040 * sg; l += 0.000116 * cg + 7.063040 * sg;
l1 += 298.8 * sg; l1 += 298.8 * sg;
/* T^3 terms */ /* T^3 terms */
sg = sin( STR * M ); sg = sin( STR * M );
/* l3 += z[24] * sg; moshier! l3 not initialized! */ /* l3 += z[24] * sg; moshier! l3 not initialized! */
l3 = z[24] * sg; l3 = z[24] * sg;
l4 = 0; l4 = 0;
@ -1223,7 +1284,6 @@ moon1()
moonpol[2] += -0.1910 * cos( g ) * T; moonpol[2] += -0.1910 * cos( g ) * T;
moonpol[1] *= T; moonpol[1] *= T;
moonpol[2] *= T; moonpol[2] *= T;
/* terms in T */ /* terms in T */
moonpol[0] = 0.0; moonpol[0] = 0.0;
chewm( BT, NBT, 4, 4, moonpol ); chewm( BT, NBT, 4, 4, moonpol );
@ -1305,10 +1365,8 @@ moon1()
} }
#endif /* MOSH_MOON_200 */ #endif /* MOSH_MOON_200 */
static void static void moon2()
moon2()
{ {
/* terms in T^0 */ /* terms in T^0 */
g = STR*(2*(Ea-Ju+D)-MP+648431.172); g = STR*(2*(Ea-Ju+D)-MP+648431.172);
l += 1.14307 * sin(g); l += 1.14307 * sin(g);
@ -1384,10 +1442,8 @@ moon2()
B += 0.29855 * sin(g); B += 0.29855 * sin(g);
} }
static void static void moon3()
moon3()
{ {
/* terms in T^0 */ /* terms in T^0 */
moonpol[0] = 0.0; moonpol[0] = 0.0;
chewm( LR, NLR, 4, 1, moonpol ); chewm( LR, NLR, 4, 1, moonpol );
@ -1400,8 +1456,7 @@ moon3()
/* Compute final ecliptic polar coordinates /* Compute final ecliptic polar coordinates
*/ */
static void static void moon4()
moon4()
{ {
moonpol[2] /= AUNIT / 1000; moonpol[2] /= AUNIT / 1000;
moonpol[0] = STR * mods3600( moonpol[0] ); moonpol[0] = STR * mods3600( moonpol[0] );
@ -1409,18 +1464,40 @@ moon4()
B = moonpol[1]; B = moonpol[1];
} }
#define CORR_MNODE_JD_T0GREG -3063616.5 /* 1 jan -13100 greg. */
#define CORR_MNODE_JD_T1GREG 844477.5 /* 1 jan -2400 jul. */
#define CORR_MNODE_JD_T2GREG 2780263.5 /* 1 jan 2900 jul. */
#define CORR_MNODE_JD_T3GREG 7930182.5 /* 1 jan 17000 greg. */
static double corr_mean_node(double J)
{
double J0, dJ, dayscty, dcor, dcor0, dcor1, dfrac;
int i;
J0 = CORR_MNODE_JD_T0GREG; /* 1-jan--13000 greg */
dayscty = 36524.25; /* days per Gregorian century */
if (J < JPL_DE431_START) return 0;
if (J > JPL_DE431_END) return 0;
/*if (J > CORR_MNODE_JD_T1GREG && J < CORR_MNODE_JD_T2GREG) return 0;*/
dJ = J - J0;
i = (int) floor(dJ / dayscty); /* centuries = index of lower correction value */
dfrac = (dJ - i * dayscty) / dayscty;
dcor0 = mean_node_corr[i];
dcor1 = mean_node_corr[i + 1];
dcor = dcor0 + dfrac * (dcor1 - dcor0);
return dcor;
}
/* mean lunar node /* mean lunar node
* J julian day * J julian day
* pol return array for position and velocity * pol return array for position and velocity
* (polar coordinates of ecliptic of date) * (polar coordinates of ecliptic of date)
*/ */
int int swi_mean_node(double J, double *pol, char *serr)
swi_mean_node(double J, double *pol, char *serr)
{ {
#if 0 #if 0
double a, b, c; double a, b, c;
#endif #endif
char s[AS_MAXCH]; char s[AS_MAXCH];
double dcor;
T = (J-J2000)/36525.0; T = (J-J2000)/36525.0;
T2 = T*T; T2 = T*T;
T3 = T*T2; T3 = T*T2;
@ -1428,16 +1505,17 @@ swi_mean_node(double J, double *pol, char *serr)
/* with elements from swi_moshmoon2(), which are fitted to jpl-ephemeris */ /* with elements from swi_moshmoon2(), which are fitted to jpl-ephemeris */
if (J < MOSHNDEPH_START || J > MOSHNDEPH_END) { if (J < MOSHNDEPH_START || J > MOSHNDEPH_END) {
if (serr != NULL) { if (serr != NULL) {
sprintf(s, "jd %f outside mean node range %.2f .. %.2f ", J, sprintf(s, "jd %f outside mean node range %.2f .. %.2f ",
MOSHNDEPH_START, MOSHNDEPH_END); J, MOSHNDEPH_START, MOSHNDEPH_END);
if (strlen(serr) + strlen(s) < AS_MAXCH) if (strlen(serr) + strlen(s) < AS_MAXCH)
strcat(serr, s); strcat(serr, s);
} }
return ERR; return ERR;
} }
mean_elements(); mean_elements();
dcor = corr_mean_node(J) * 3600;
/* longitude */ /* longitude */
pol[0] = swi_mod2PI((SWELP - NF) * STR); pol[0] = swi_mod2PI((SWELP - NF - dcor) * STR);
/* latitude */ /* latitude */
pol[1] = 0.0; pol[1] = 0.0;
/* distance */ /* distance */
@ -1446,9 +1524,8 @@ swi_mean_node(double J, double *pol, char *serr)
#if 0 #if 0
a = pol[0]; a = pol[0];
/* Chapront, according to Meeus, German, p. 339 */ /* Chapront, according to Meeus, German, p. 339 */
pol[0] = pol[0] = 125.0445550 - 1934.1361849 * T + 0.0020762 * T2 +
125.0445550 - 1934.1361849 * T + 0.0020762 * T2 + T3 / 467410 - T3 / 467410 - T4 / 60616000;
T4 / 60616000;
pol[0] = swi_mod2PI(pol[0] * DEGTORAD); pol[0] = swi_mod2PI(pol[0] * DEGTORAD);
c = pol[0]; c = pol[0];
printf ("mean node\n"); printf ("mean node\n");
@ -1457,21 +1534,42 @@ swi_mean_node(double J, double *pol, char *serr)
return OK; return OK;
} }
#define CORR_MAPOG_JD_T0GREG -3063616.5 /* 1 jan -13100 greg. */
#define CORR_MAPOG_JD_T1GREG 1209720.5 /* 1 jan -1400 greg. */
#define CORR_MAPOG_JD_T2GREG 2780263.5 /* 1 jan 2900 greg. */
#define CORR_MAPOG_JD_T3GREG 7930182.5 /* 1 jan 17000 greg. */
static double corr_mean_apog(double J)
{
double J0, dJ, dayscty, dcor, dcor0, dcor1, dfrac;
int i;
J0 = CORR_MAPOG_JD_T0GREG; /* 1-jan--13000 greg */
dayscty = 36524.25; /* days per Gregorian century */
if (J < JPL_DE431_START) return 0;
if (J > JPL_DE431_END) return 0;
/*if (J > CORR_MAPOG_JD_T1GREG && J < CORR_MAPOG_JD_T2GREG) return 0;*/
dJ = J - J0;
i = (int) floor(dJ / dayscty); /* centuries = index of lower correction value */
dfrac = (dJ - i * dayscty) / dayscty;
dcor0 = mean_apsis_corr[i];
dcor1 = mean_apsis_corr[i + 1];
dcor = dcor0 + dfrac * (dcor1 - dcor0);
return dcor;
}
/* mean lunar apogee ('dark moon', 'lilith') /* mean lunar apogee ('dark moon', 'lilith')
* J julian day * J julian day
* pol return array for position * pol return array for position
* (polar coordinates of ecliptic of date) * (polar coordinates of ecliptic of date)
* serr error return string * serr error return string
*/ */
int int swi_mean_apog(double J, double *pol, char *serr)
swi_mean_apog(double J, double *pol, char *serr)
{ {
#if 0 #if 0
int i; int i;
double a, b; double a, b;
double x[3]; double x[3];
#endif #endif
double node; double node, dcor;
char s[AS_MAXCH]; char s[AS_MAXCH];
T = (J-J2000)/36525.0; T = (J-J2000)/36525.0;
T2 = T*T; T2 = T*T;
@ -1480,8 +1578,8 @@ swi_mean_apog(double J, double *pol, char *serr)
/* with elements from swi_moshmoon2(), which are fitted to jpl-ephemeris */ /* with elements from swi_moshmoon2(), which are fitted to jpl-ephemeris */
if (J < MOSHNDEPH_START || J > MOSHNDEPH_END) { if (J < MOSHNDEPH_START || J > MOSHNDEPH_END) {
if (serr != NULL) { if (serr != NULL) {
sprintf(s, "jd %f outside mean apogee range %.2f .. %.2f ", J, sprintf(s, "jd %f outside mean apogee range %.2f .. %.2f ",
MOSHNDEPH_START, MOSHNDEPH_END); J, MOSHNDEPH_START, MOSHNDEPH_END);
if (strlen(serr) + strlen(s) < AS_MAXCH) if (strlen(serr) + strlen(s) < AS_MAXCH)
strcat(serr, s); strcat(serr, s);
} }
@ -1489,22 +1587,8 @@ swi_mean_apog(double J, double *pol, char *serr)
} }
mean_elements(); mean_elements();
pol[0] = swi_mod2PI((SWELP - MP) * STR + PI); pol[0] = swi_mod2PI((SWELP - MP) * STR + PI);
#if 0
a = pol[0];
/* Chapront, according to Meeus, German, p. 339 */
pol[0] =
83.3532430 + 4069.0137111 * T - 0.0103238 * T2 - T3 / 80053 +
T4 / 18999000;
pol[0] = swi_mod2PI(pol[0] * DEGTORAD + PI);
b = pol[0];
printf("mean apogee\n");
printf("moshier de404 - chapront %f\"\n", (a - b) * RADTODEG * 3600);
#endif
pol[1] = 0; pol[1] = 0;
pol[2] = MOON_MEAN_DIST * (1 + MOON_MEAN_ECC) / AUNIT; /* apogee */ pol[2] = MOON_MEAN_DIST * (1 + MOON_MEAN_ECC) / AUNIT; /* apogee */
#if 0
pol[2] = 2 * MOON_MEAN_ECC * MOON_MEAN_DIST / AUNIT; /* 2nd focus */
#endif
/* Lilith or Dark Moon is either the empty focal point of the mean /* Lilith or Dark Moon is either the empty focal point of the mean
* lunar ellipse or, for some people, its apogee ("aphelion"). * lunar ellipse or, for some people, its apogee ("aphelion").
* This is 180 degrees from the perigee. * This is 180 degrees from the perigee.
@ -1526,39 +1610,23 @@ swi_mean_apog(double J, double *pol, char *serr)
* +/- 6 deg! * +/- 6 deg!
* We neglect this influence. * We neglect this influence.
*/ */
dcor = corr_mean_apog(J) * DEGTORAD;
pol[0] = swi_mod2PI(pol[0] - dcor);
/* apogee is now projected onto ecliptic */ /* apogee is now projected onto ecliptic */
node = (SWELP - NF) * STR; node = (SWELP - NF) * STR;
dcor = corr_mean_node(J) * DEGTORAD;
node = swi_mod2PI(node - dcor);
pol[0] = swi_mod2PI(pol[0] - node); pol[0] = swi_mod2PI(pol[0] - node);
swi_polcart(pol, pol); swi_polcart(pol, pol);
swi_coortrf(pol, pol, -MOON_MEAN_INCL * DEGTORAD); swi_coortrf(pol, pol, -MOON_MEAN_INCL * DEGTORAD);
swi_cartpol(pol, pol); swi_cartpol(pol, pol);
pol[0] = swi_mod2PI(pol[0] + node); pol[0] = swi_mod2PI(pol[0] + node);
#if 0
/* speed */
mean_elements(T - PLAN_SPEED_INTV, &SWELP, &MP, &NF, &M, &D);
pol[3] = swi_mod2PI((SWELP - MP) * STR + PI);
pol[4] = 0;
pol[5] = MOON_MEAN_DIST * (1 + MOON_MEAN_ECC) / AUNIT; /* apogee */
#if 0
pol[2] = 2 * MOON_MEAN_ECC * MOON_MEAN_DIST / AUNIT; /* 2nd focus */
#endif
node = (SWELP - NF) * STR;
pol[3] = swi_mod2PI(pol[3] - node);
swi_polcart(pol + 3, pol + 3);
swi_coortrf(pol + 3, pol + 3, -MOON_MEAN_INCL * DEGTORAD);
swi_cartpol(pol + 3, pol + 3);
pol[3] = swi_mod2PI(pol[3] + node);
for (i = 0; i <= 2; i++)
pol[3 + i] = pol[i] - pol[3 + i];
pol[3] = swi_mod2PI(pol[3]);
#endif
return OK; return OK;
} }
/* Program to step through the perturbation table /* Program to step through the perturbation table
*/ */
static void static void chewm(short *pt, int nlines, int nangles, int typflg, double *ans )
chewm(short *pt, int nlines, int nangles, int typflg, double *ans)
{ {
int i, j, k, k1, m; int i, j, k, k1, m;
double cu, su, cv, sv, ff; double cu, su, cv, sv, ff;
@ -1570,13 +1638,11 @@ chewm(short *pt, int nlines, int nangles, int typflg, double *ans)
j = *pt++; /* multiple angle factor */ j = *pt++; /* multiple angle factor */
if( j ) { if( j ) {
k = j; k = j;
if (j < 0) if( j < 0 ) k = -k; /* make angle factor > 0 */
k = -k; /* make angle factor > 0 */
/* sin, cos (k*angle) from lookup table */ /* sin, cos (k*angle) from lookup table */
su = ss[m][k-1]; su = ss[m][k-1];
cu = cc[m][k-1]; cu = cc[m][k-1];
if (j < 0) if( j < 0 ) su = -su; /* negative angle factor */
su = -su; /* negative angle factor */
if( k1 == 0 ) { if( k1 == 0 ) {
/* Set sin, cos of first angle. */ /* Set sin, cos of first angle. */
sv = su; sv = su;
@ -1601,8 +1667,7 @@ chewm(short *pt, int nlines, int nangles, int typflg, double *ans)
ans[0] += (10000.0 * j + k) * sv; ans[0] += (10000.0 * j + k) * sv;
j = *pt++; j = *pt++;
k = *pt++; k = *pt++;
if (k) if( k ) ans[2] += (10000.0 * j + k) * cv;
ans[2] += (10000.0 * j + k) * cv;
break; break;
/* longitude and radius */ /* longitude and radius */
case 2: case 2:
@ -1629,8 +1694,7 @@ chewm(short *pt, int nlines, int nangles, int typflg, double *ans)
/* Prepare lookup table of sin and cos ( i*Lj ) /* Prepare lookup table of sin and cos ( i*Lj )
* for required multiple angles * for required multiple angles
*/ */
static void static void sscc(int k, double arg, int n )
sscc(int k, double arg, int n)
{ {
double cu, su, cv, sv, s; double cu, su, cv, sv, s;
int i; int i;
@ -1656,22 +1720,19 @@ sscc(int k, double arg, int n)
* tjd date * tjd date
* x array of position * x array of position
*/ */
static void static void ecldat_equ2000(double tjd, double *xpm) {
ecldat_equ2000(double tjd, double *xpm)
{
/* cartesian */ /* cartesian */
swi_polcart(xpm, xpm); swi_polcart(xpm, xpm);
/* equatorial */ /* equatorial */
swi_coortrf2(xpm, xpm, -swed.oec.seps, swed.oec.ceps); swi_coortrf2(xpm, xpm, -swed.oec.seps, swed.oec.ceps);
/* j2000 */ /* j2000 */
swi_precess(xpm, tjd, J_TO_J2000); swi_precess(xpm, tjd, 0, J_TO_J2000);/**/
/**/} }
/* Reduce arc seconds modulo 360 degrees /* Reduce arc seconds modulo 360 degrees
* answer in arc seconds * answer in arc seconds
*/ */
static double static double mods3600(double x)
mods3600(double x)
{ {
double lx; double lx;
lx = x; lx = x;
@ -1679,10 +1740,11 @@ mods3600(double x)
return( lx ); return( lx );
} }
void void swi_mean_lunar_elements(double tjd,
swi_mean_lunar_elements(double tjd, double *node, double *dnode, double *peri, double *node, double *dnode,
double *dperi) double *peri, double *dperi)
{ {
double dcor;
T = (tjd - J2000) / 36525.0; T = (tjd - J2000) / 36525.0;
T2 = T*T; T2 = T*T;
mean_elements(); mean_elements();
@ -1693,81 +1755,61 @@ swi_mean_lunar_elements(double tjd, double *node, double *dnode, double *peri,
*dnode = swe_degnorm(*node - (SWELP - NF) * STR * RADTODEG); *dnode = swe_degnorm(*node - (SWELP - NF) * STR * RADTODEG);
*dnode -= 360; *dnode -= 360;
*dperi = swe_degnorm(*peri - (SWELP - MP) * STR * RADTODEG); *dperi = swe_degnorm(*peri - (SWELP - MP) * STR * RADTODEG);
dcor = corr_mean_node(tjd);
*node = swe_degnorm(*node - dcor);
dcor = corr_mean_apog(tjd);
*peri = swe_degnorm(*peri - dcor);
} }
static void static void mean_elements()
mean_elements()
{ {
double fracT = fmod(T, 1); double fracT = fmod(T, 1);
/* Mean anomaly of sun = l' (J. Laskar) */ /* Mean anomaly of sun = l' (J. Laskar) */
/*M = mods3600(129596581.038354 * T + 1287104.76154);*/ /*M = mods3600(129596581.038354 * T + 1287104.76154);*/
M = mods3600(129600000.0 * fracT - 3418.961646 * T + 1287104.76154); M = mods3600(129600000.0 * fracT - 3418.961646 * T + 1287104.76154);
M += ((((((((1.62e-20 * T - 1.0390e-17) * T - 3.83508e-15) * T + M += ((((((((
4.237343e-13) * T + 8.8555011e-11) * T - 4.77258489e-8) * T - 1.62e-20 * T
1.1297037031e-5) * T + 1.4732069041e-4) * T - - 1.0390e-17 ) * T
0.552891801772) * T2; - 3.83508e-15 ) * T
+ 4.237343e-13 ) * T
+ 8.8555011e-11 ) * T
- 4.77258489e-8 ) * T
- 1.1297037031e-5 ) * T
+ 1.4732069041e-4 ) * T
- 0.552891801772 ) * T2;
#ifdef MOSH_MOON_200 #ifdef MOSH_MOON_200
/* Mean distance of moon from its ascending node = F */ /* Mean distance of moon from its ascending node = F */
NF = mods3600( 1739527263.0983 * T + 335779.55755 ); NF = mods3600( 1739527263.0983 * T + 335779.55755 );
/* Mean anomaly of moon = l */ /* Mean anomaly of moon = l */
MP = mods3600( 1717915923.4728 * T + 485868.28096 ); MP = mods3600( 1717915923.4728 * T + 485868.28096 );
/* Mean elongation of moon = D */ /* Mean elongation of moon = D */
D = mods3600( 1602961601.4603 * T + 1072260.73512 ); D = mods3600( 1602961601.4603 * T + 1072260.73512 );
/* Mean longitude of moon */ /* Mean longitude of moon */
SWELP = mods3600( 1732564372.83264 * T + 785939.95571 ); SWELP = mods3600( 1732564372.83264 * T + 785939.95571 );
/* Higher degree secular terms found by least squares fit */ /* Higher degree secular terms found by least squares fit */
NF += NF += (((((z[5] *T+z[4] )*T + z[3] )*T + z[2] )*T + z[1] )*T + z[0] )*T2;
(((((z[5] * T + z[4]) * T + z[3]) * T + z[2]) * T + z[1]) * T + MP += (((((z[11]*T+z[10])*T + z[9] )*T + z[8] )*T + z[7] )*T + z[6] )*T2;
z[0]) * T2; D += (((((z[17]*T+z[16])*T + z[15])*T + z[14])*T + z[13])*T + z[12])*T2;
MP += SWELP += (((((z[23]*T+z[22])*T + z[21])*T + z[20])*T + z[19])*T + z[18])*T2;
(((((z[11] * T + z[10]) * T + z[9]) * T + z[8]) * T + z[7]) * T +
z[6]) * T2;
D += (((((z[17] * T + z[16]) * T + z[15]) * T + z[14]) * T + z[13]) * T +
z[12]) * T2;
SWELP +=
(((((z[23] * T + z[22]) * T + z[21]) * T + z[20]) * T + z[19]) * T +
z[18]) * T2;
#else #else
/* Mean distance of moon from its ascending node = F */ /* Mean distance of moon from its ascending node = F */
/*NF = mods3600((1739527263.0983 - 2.079419901760e-01) * T + 335779.55755);*/ /*NF = mods3600((1739527263.0983 - 2.079419901760e-01) * T + 335779.55755);*/
NF = mods3600(1739232000.0 * fracT + 295263.0983 * T - NF = mods3600(1739232000.0 * fracT + 295263.0983 * T - 2.079419901760e-01 * T + 335779.55755);
2.079419901760e-01 * T + 335779.55755);
/* Mean anomaly of moon = l */ /* Mean anomaly of moon = l */
/*MP = mods3600((1717915923.4728 - 2.035946368532e-01) * T + 485868.28096);*/ /*MP = mods3600((1717915923.4728 - 2.035946368532e-01) * T + 485868.28096);*/
MP = mods3600(1717200000.0 * fracT + 715923.4728 * T - MP = mods3600(1717200000.0 * fracT + 715923.4728 * T - 2.035946368532e-01 * T + 485868.28096);
2.035946368532e-01 * T + 485868.28096);
/* Mean elongation of moon = D */ /* Mean elongation of moon = D */
/*D = mods3600((1602961601.4603 + 3.962893294503e-01) * T + 1072260.73512);*/ /*D = mods3600((1602961601.4603 + 3.962893294503e-01) * T + 1072260.73512);*/
D = mods3600(1601856000.0 * fracT + 1105601.4603 * T + D = mods3600(1601856000.0 * fracT + 1105601.4603 * T + 3.962893294503e-01 * T + 1072260.73512);
3.962893294503e-01 * T + 1072260.73512);
/* Mean longitude of moon, referred to the mean ecliptic and equinox of date */ /* Mean longitude of moon, referred to the mean ecliptic and equinox of date */
/*SWELP = mods3600((1732564372.83264 - 6.784914260953e-01) * T + 785939.95571);*/ /*SWELP = mods3600((1732564372.83264 - 6.784914260953e-01) * T + 785939.95571);*/
SWELP = SWELP = mods3600(1731456000.0 * fracT + 1108372.83264 * T - 6.784914260953e-01 * T + 785939.95571);
mods3600(1731456000.0 * fracT + 1108372.83264 * T -
6.784914260953e-01 * T + 785939.95571);
/* Higher degree secular terms found by least squares fit */ /* Higher degree secular terms found by least squares fit */
NF += ((z[2]*T + z[1])*T + z[0])*T2; NF += ((z[2]*T + z[1])*T + z[0])*T2;
MP += ((z[5]*T + z[4])*T + z[3])*T2; MP += ((z[5]*T + z[4])*T + z[3])*T2;
D += ((z[8]*T + z[7])*T + z[6])*T2; D += ((z[8]*T + z[7])*T + z[6])*T2;
SWELP += ((z[11]*T + z[10])*T + z[9])*T2; SWELP += ((z[11]*T + z[10])*T + z[9])*T2;
#endif /* ! MOSH_MOON_200 */ #endif /* ! MOSH_MOON_200 */
/* sensitivity of mean elements /* sensitivity of mean elements
* delta argument = scale factor times delta amplitude (arcsec) * delta argument = scale factor times delta amplitude (arcsec)
* cos l 9.0019 = mean eccentricity * cos l 9.0019 = mean eccentricity
@ -1776,21 +1818,30 @@ mean_elements()
*/ */
} }
void void mean_elements_pl()
mean_elements_pl()
{ {
/* Mean longitudes of planets (Laskar, Bretagnon) */ /* Mean longitudes of planets (Laskar, Bretagnon) */
Ve = mods3600( 210664136.4335482 * T + 655127.283046 ); Ve = mods3600( 210664136.4335482 * T + 655127.283046 );
Ve += Ve += ((((((((
((((((((-9.36e-023 * T - 1.95e-20) * T + 6.097e-18) * T + -9.36e-023 * T
4.43201e-15) * T + 2.509418e-13) * T - 3.0622898e-10) * T - - 1.95e-20 ) * T
2.26602516e-9) * T - 1.4244812531e-5) * T + 0.005871373088) * T2; + 6.097e-18 ) * T
+ 4.43201e-15 ) * T
+ 2.509418e-13 ) * T
- 3.0622898e-10 ) * T
- 2.26602516e-9 ) * T
- 1.4244812531e-5 ) * T
+ 0.005871373088 ) * T2;
Ea = mods3600( 129597742.26669231 * T + 361679.214649 ); Ea = mods3600( 129597742.26669231 * T + 361679.214649 );
Ea += Ea += (((((((( -1.16e-22 * T
((((((((-1.16e-22 * T + 2.976e-19) * T + 2.8460e-17) * T - + 2.976e-19 ) * T
1.08402e-14) * T - 1.226182e-12) * T + 1.7228268e-10) * T + + 2.8460e-17 ) * T
1.515912254e-7) * T + 8.863982531e-6) * T - 2.0199859001e-2) * T2; - 1.08402e-14 ) * T
- 1.226182e-12 ) * T
+ 1.7228268e-10 ) * T
+ 1.515912254e-7 ) * T
+ 8.863982531e-6 ) * T
- 2.0199859001e-2 ) * T2;
Ma = mods3600( 68905077.59284 * T + 1279559.78866 ); Ma = mods3600( 68905077.59284 * T + 1279559.78866 );
Ma += (-1.043e-5*T + 9.38012e-3)*T2; Ma += (-1.043e-5*T + 9.38012e-3)*T2;
Ju = mods3600( 10925660.428608 * T + 123665.342120 ); Ju = mods3600( 10925660.428608 * T + 123665.342120 );
@ -1801,21 +1852,19 @@ mean_elements_pl()
/* Calculate geometric coordinates of true interpolated Moon apsides /* Calculate geometric coordinates of true interpolated Moon apsides
*/ */
int int swi_intp_apsides(double J, double *pol, int ipli)
swi_intp_apsides(double J, double *pol, int ipli)
{ {
double dd; double dd;
double rsv[3]; double rsv[3];
double sNF, sD, sLP, sMP, sM, sVe, sEa, sMa, sJu, sSa, fM, fVe, fEa, fMa, double sNF, sD, sLP, sMP, sM, sVe, sEa, sMa, sJu, sSa, fM, fVe, fEa, fMa, fJu, fSa, cMP, zMP, fNF, fD, fLP;
fJu, fSa, cMP, zMP, fNF, fD, fLP;
double dMP, mLP, mNF, mD, mMP; double dMP, mLP, mNF, mD, mMP;
int i, ii, iii, niter = 4; /* niter: silence compiler warning */ int i, ii, iii, niter = 4; /* niter: silence compiler warning */
ii=1; ii=1;
zMP=27.55454988; zMP=27.55454988;
fNF = 27.212220817 / zMP; fNF = 27.212220817/zMP;/**/
/**/ fD = 29.530588835 / zMP; fD = 29.530588835/zMP;/**/
/**/ fLP = 27.321582 / zMP; fLP = 27.321582/zMP;/**/
/**/ fM = 365.2596359 / zMP; fM = 365.2596359/zMP;
fVe = 224.7008001/zMP; fVe = 224.7008001/zMP;
fEa = 365.2563629/zMP; fEa = 365.2563629/zMP;
fMa = 686.9798519/zMP; fMa = 686.9798519/zMP;
@ -1840,25 +1889,19 @@ swi_intp_apsides(double J, double *pol, int ipli)
sD = mods3600(D); sD = mods3600(D);
sLP = mods3600(SWELP); sLP = mods3600(SWELP);
sMP = mods3600(MP); sMP = mods3600(MP);
if (ipli == SEI_INTP_PERG) { if (ipli == SEI_INTP_PERG) {MP = 0.0; niter = 5;}
MP = 0.0; if (ipli == SEI_INTP_APOG) {MP = 648000.0; niter = 4;}
niter = 5;
}
if (ipli == SEI_INTP_APOG) {
MP = 648000.0;
niter = 4;
}
cMP = 0; cMP = 0;
dd = 18000.0; dd = 18000.0;
for (iii = 0; iii <= niter; iii++) { for (iii= 0; iii<=niter; iii++) {/**/
/**/ dMP = sMP - MP; dMP = sMP - MP;
mLP = sLP - dMP; mLP = sLP - dMP;
mNF = sNF - dMP; mNF = sNF - dMP;
mD = sD - dMP; mD = sD - dMP;
mMP = sMP - dMP; mMP = sMP - dMP;
for (ii = 0; ii <= 2; ii++) { for (ii = 0; ii <=2; ii++) {/**/
/**/ MP = mMP + (ii - 1) * dd; MP = mMP + (ii-1)*dd; /**/
/**/ NF = mNF + (ii - 1) * dd / fNF; NF = mNF + (ii-1)*dd/fNF;
D = mD + (ii-1)*dd/fD; D = mD + (ii-1)*dd/fD;
SWELP = mLP + (ii-1)*dd/fLP; SWELP = mLP + (ii-1)*dd/fLP;
M = sM + (ii-1)*dd/fM ; M = sM + (ii-1)*dd/fM ;
@ -1872,15 +1915,12 @@ swi_intp_apsides(double J, double *pol, int ipli)
moon3(); moon3();
moon4(); moon4();
if (ii==1) { if (ii==1) {
for (i = 0; i < 3; i++) for( i=0; i<3; i++ ) pol[i] = moonpol[i];
pol[i] = moonpol[i];
} }
rsv[ii] = moonpol[2]; rsv[ii] = moonpol[2];
} }
cMP = cMP = (1.5*rsv[0] - 2*rsv[1] + 0.5*rsv[2]) / (rsv[0] + rsv[2] - 2*rsv[1]);/**/
(1.5 * rsv[0] - 2 * rsv[1] + 0.5 * rsv[2]) / (rsv[0] + rsv[2] - cMP *= dd;
2 * rsv[1]);
/**/ cMP *= dd;
cMP = cMP - dd; cMP = cMP - dd;
mMP += cMP; mMP += cMP;
MP = mMP; MP = mMP;
@ -1888,3 +1928,4 @@ swi_intp_apsides(double J, double *pol, int ipli)
} }
return(0); return(0);
} }

View File

@ -1,4 +1,3 @@
/* SWISSEPH /* SWISSEPH
$Header: /home/dieter/sweph/RCS/swemplan.c,v 1.74 2008/06/16 10:07:20 dieter Exp $ $Header: /home/dieter/sweph/RCS/swemplan.c,v 1.74 2008/06/16 10:07:20 dieter Exp $
Moshier planet routines Moshier planet routines
@ -6,7 +5,6 @@
modified for SWISSEPH by Dieter Koch modified for SWISSEPH by Dieter Koch
**************************************************************/ **************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved. /* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions License conditions
@ -73,24 +71,23 @@
#define FICT_GEO 1 #define FICT_GEO 1
#define KGAUSS_GEO 0.0000298122353216 /* Earth only */ #define KGAUSS_GEO 0.0000298122353216 /* Earth only */
/* #define KGAUSS_GEO 0.00002999502129737 Earth + Moon */ /* #define KGAUSS_GEO 0.00002999502129737 Earth + Moon */
static void embofs_mosh(double J, double *xemb); static void embofs_mosh(double J, double *xemb);
static int check_t_terms(double t, char *sinp, double *doutp); static int check_t_terms(double t, char *sinp, double *doutp);
static int read_elements_file(int32 ipl, double tjd, double *tjd0, static int read_elements_file(int32 ipl, double tjd,
double *tequ, double *mano, double *sema, double *tjd0, double *tequ,
double *ecce, double *parg, double *node, double *mano, double *sema, double *ecce,
double *incl, char *pname, int32 * fict_ifl, double *parg, double *node, double *incl,
char *serr); char *pname, int32 *fict_ifl, char *serr);
static int pnoint2msh[] = {2, 2, 0, 1, 3, 4, 5, 6, 7, 8, }; static int pnoint2msh[] = {2, 2, 0, 1, 3, 4, 5, 6, 7, 8, };
/* From Simon et al (1994) */ /* From Simon et al (1994) */
static double freqs[] = { static double freqs[] =
{
/* Arc sec per 10000 Julian years. */ /* Arc sec per 10000 Julian years. */
53810162868.8982, 53810162868.8982,
21066413643.3548, 21066413643.3548,
@ -103,8 +100,8 @@ static double freqs[] = {
52272245.1795 52272245.1795
}; };
static double phases[] = { static double phases[] =
{
/* Arc sec. */ /* Arc sec. */
252.25090552 * 3600., 252.25090552 * 3600.,
181.97980085 * 3600., 181.97980085 * 3600.,
@ -117,7 +114,8 @@ static double phases[] = {
860492.1546, 860492.1546,
}; };
static struct plantbl *planets[] = { static struct plantbl *planets[] =
{
&mer404, &mer404,
&ven404, &ven404,
&ear404, &ear404,
@ -134,8 +132,7 @@ static double FAR cc[9][24];
static void sscc (int k, double arg, int n); static void sscc (int k, double arg, int n);
int int swi_moshplan2 (double J, int iplm, double *pobj)
swi_moshplan2(double J, int iplm, double *pobj)
{ {
int i, j, k, m, k1, ip, np, nt; int i, j, k, m, k1, ip, np, nt;
signed char FAR *p; signed char FAR *p;
@ -146,8 +143,10 @@ swi_moshplan2(double J, int iplm, double *pobj)
T = (J - J2000) / TIMESCALE; T = (J - J2000) / TIMESCALE;
/* Calculate sin( i*MM ), etc. for needed multiple angles. */ /* Calculate sin( i*MM ), etc. for needed multiple angles. */
for (i = 0; i < 9; i++) { for (i = 0; i < 9; i++)
if ((j = plan->max_harmonic[i]) > 0) { {
if ((j = plan->max_harmonic[i]) > 0)
{
sr = (mods3600 (freqs[i] * T) + phases[i]) * STR; sr = (mods3600 (freqs[i] * T) + phases[i]) * STR;
sscc (i, sr, j); sscc (i, sr, j);
} }
@ -163,29 +162,34 @@ swi_moshplan2(double J, int iplm, double *pobj)
sb = 0.0; sb = 0.0;
sr = 0.0; sr = 0.0;
for (;;) { for (;;)
{
/* argument of sine and cosine */ /* argument of sine and cosine */
/* Number of periodic arguments. */ /* Number of periodic arguments. */
np = *p++; np = *p++;
if (np < 0) if (np < 0)
break; break;
if (np == 0) { /* It is a polynomial term. */ if (np == 0)
{ /* It is a polynomial term. */
nt = *p++; nt = *p++;
/* Longitude polynomial. */ /* Longitude polynomial. */
cu = *pl++; cu = *pl++;
for (ip = 0; ip < nt; ip++) { for (ip = 0; ip < nt; ip++)
{
cu = cu * T + *pl++; cu = cu * T + *pl++;
} }
sl += mods3600 (cu); sl += mods3600 (cu);
/* Latitude polynomial. */ /* Latitude polynomial. */
cu = *pb++; cu = *pb++;
for (ip = 0; ip < nt; ip++) { for (ip = 0; ip < nt; ip++)
{
cu = cu * T + *pb++; cu = cu * T + *pb++;
} }
sb += cu; sb += cu;
/* Radius polynomial. */ /* Radius polynomial. */
cu = *pr++; cu = *pr++;
for (ip = 0; ip < nt; ip++) { for (ip = 0; ip < nt; ip++)
{
cu = cu * T + *pr++; cu = cu * T + *pr++;
} }
sr += cu; sr += cu;
@ -194,12 +198,14 @@ swi_moshplan2(double J, int iplm, double *pobj)
k1 = 0; k1 = 0;
cv = 0.0; cv = 0.0;
sv = 0.0; sv = 0.0;
for (ip = 0; ip < np; ip++) { for (ip = 0; ip < np; ip++)
{
/* What harmonic. */ /* What harmonic. */
j = *p++; j = *p++;
/* Which planet. */ /* Which planet. */
m = *p++ - 1; m = *p++ - 1;
if (j) { if (j)
{
k = j; k = j;
if (j < 0) if (j < 0)
k = -k; k = -k;
@ -208,12 +214,14 @@ swi_moshplan2(double J, int iplm, double *pobj)
if (j < 0) if (j < 0)
su = -su; su = -su;
cu = cc[m][k]; cu = cc[m][k];
if (k1 == 0) { /* set first angle */ if (k1 == 0)
{ /* set first angle */
sv = su; sv = su;
cv = cu; cv = cu;
k1 = 1; k1 = 1;
} }
else { /* combine angles */ else
{ /* combine angles */
t = su * cv + cu * sv; t = su * cv + cu * sv;
cv = cu * cv - su * sv; cv = cu * cv - su * sv;
sv = t; sv = t;
@ -225,7 +233,8 @@ swi_moshplan2(double J, int iplm, double *pobj)
/* Longitude. */ /* Longitude. */
cu = *pl++; cu = *pl++;
su = *pl++; su = *pl++;
for (ip = 0; ip < nt; ip++) { for (ip = 0; ip < nt; ip++)
{
cu = cu * T + *pl++; cu = cu * T + *pl++;
su = su * T + *pl++; su = su * T + *pl++;
} }
@ -233,7 +242,8 @@ swi_moshplan2(double J, int iplm, double *pobj)
/* Latitiude. */ /* Latitiude. */
cu = *pb++; cu = *pb++;
su = *pb++; su = *pb++;
for (ip = 0; ip < nt; ip++) { for (ip = 0; ip < nt; ip++)
{
cu = cu * T + *pb++; cu = cu * T + *pb++;
su = su * T + *pb++; su = su * T + *pb++;
} }
@ -241,7 +251,8 @@ swi_moshplan2(double J, int iplm, double *pobj)
/* Radius. */ /* Radius. */
cu = *pr++; cu = *pr++;
su = *pr++; su = *pr++;
for (ip = 0; ip < nt; ip++) { for (ip = 0; ip < nt; ip++)
{
cu = cu * T + *pr++; cu = cu * T + *pr++;
su = su * T + *pr++; su = su * T + *pr++;
} }
@ -263,9 +274,7 @@ swi_moshplan2(double J, int iplm, double *pobj)
* xe earth's * xe earth's
* serr error string * serr error string
*/ */
int int swi_moshplan(double tjd, int ipli, AS_BOOL do_save, double *xpret, double *xeret, char *serr)
swi_moshplan(double tjd, int ipli, AS_BOOL do_save, double *xpret,
double *xeret, char *serr)
{ {
int i; int i;
int do_earth = FALSE; int do_earth = FALSE;
@ -281,8 +290,7 @@ swi_moshplan(double tjd, int ipli, AS_BOOL do_save, double *xpret,
if (do_save) { if (do_save) {
xp = pdp->x; xp = pdp->x;
xe = pedp->x; xe = pedp->x;
} } else {
else {
xp = xxp; xp = xxp;
xe = xxe; xe = xxe;
} }
@ -300,10 +308,10 @@ swi_moshplan(double tjd, int ipli, AS_BOOL do_save, double *xpret,
} }
/* earth, for geocentric position */ /* earth, for geocentric position */
if (do_earth) { if (do_earth) {
if (tjd == pedp->teval && pedp->iephe == SEFLG_MOSEPH) { if (tjd == pedp->teval
&& pedp->iephe == SEFLG_MOSEPH) {
xe = pedp->x; xe = pedp->x;
} } else {
else {
/* emb */ /* emb */
swi_moshplan2(tjd, pnoint2msh[SEI_EMB], xe); /* emb hel. ecl. 2000 polar */ swi_moshplan2(tjd, pnoint2msh[SEI_EMB], xe); /* emb hel. ecl. 2000 polar */
swi_polcart(xe, xe); /* to cartesian */ swi_polcart(xe, xe); /* to cartesian */
@ -318,8 +326,8 @@ swi_moshplan(double tjd, int ipli, AS_BOOL do_save, double *xpret,
swi_moshplan2(tjd - PLAN_SPEED_INTV, pnoint2msh[SEI_EMB], x2); swi_moshplan2(tjd - PLAN_SPEED_INTV, pnoint2msh[SEI_EMB], x2);
swi_polcart(x2, x2); swi_polcart(x2, x2);
swi_coortrf2(x2, x2, -seps2000, ceps2000); swi_coortrf2(x2, x2, -seps2000, ceps2000);
embofs_mosh(tjd - PLAN_SPEED_INTV, x2); embofs_mosh(tjd - PLAN_SPEED_INTV, x2);/**/
/**/ for (i = 0; i <= 2; i++) for (i = 0; i <= 2; i++)
dx[i] = (xe[i] - x2[i]) / PLAN_SPEED_INTV; dx[i] = (xe[i] - x2[i]) / PLAN_SPEED_INTV;
/* store speed */ /* store speed */
for (i = 0; i <= 2; i++) { for (i = 0; i <= 2; i++) {
@ -333,20 +341,18 @@ swi_moshplan(double tjd, int ipli, AS_BOOL do_save, double *xpret,
/* earth is the planet wanted */ /* earth is the planet wanted */
if (ipli == SEI_EARTH) { if (ipli == SEI_EARTH) {
xp = xe; xp = xe;
} } else {
else {
/* other planet */ /* other planet */
/* if planet has already been computed, return */ /* if planet has already been computed, return */
if (tjd == pdp->teval && pdp->iephe == SEFLG_MOSEPH) { if (tjd == pdp->teval && pdp->iephe == SEFLG_MOSEPH) {
xp = pdp->x; xp = pdp->x;
} } else {
else {
swi_moshplan2(tjd, iplm, xp); swi_moshplan2(tjd, iplm, xp);
swi_polcart(xp, xp); swi_polcart(xp, xp);
swi_coortrf2(xp, xp, -seps2000, ceps2000); swi_coortrf2(xp, xp, -seps2000, ceps2000);
if (do_save) { if (do_save) {
pdp->teval = tjd; pdp->teval = tjd;/**/
/**/ pdp->xflgs = -1; pdp->xflgs = -1;
pdp->iephe = SEFLG_MOSEPH; pdp->iephe = SEFLG_MOSEPH;
} }
/* one more position for speed. /* one more position for speed.
@ -379,8 +385,7 @@ swi_moshplan(double tjd, int ipli, AS_BOOL do_save, double *xpret,
/* Prepare lookup table of sin and cos ( i*Lj ) /* Prepare lookup table of sin and cos ( i*Lj )
* for required multiple angles * for required multiple angles
*/ */
static void static void sscc (int k, double arg, int n)
sscc(int k, double arg, int n)
{ {
double cu, su, cv, sv, s; double cu, su, cv, sv, s;
int i; int i;
@ -393,7 +398,8 @@ sscc(int k, double arg, int n)
cv = cu * cu - su * su; cv = cu * cu - su * su;
ss[k][1] = sv; /* sin(2L) */ ss[k][1] = sv; /* sin(2L) */
cc[k][1] = cv; cc[k][1] = cv;
for (i = 2; i < n; i++) { for (i = 2; i < n; i++)
{
s = su * cv + cu * sv; s = su * cv + cu * sv;
cv = cu * cv - su * sv; cv = cu * cv - su * sv;
sv = s; sv = s;
@ -408,8 +414,7 @@ sscc(int k, double arg, int n)
* J = Julian day number * J = Julian day number
* xemb = rectangular equatorial coordinates of Earth * xemb = rectangular equatorial coordinates of Earth
*/ */
static void static void embofs_mosh(double tjd, double *xemb)
embofs_mosh(double tjd, double *xemb)
{ {
double T, M, a, L, B, p; double T, M, a, L, B, p;
double smp, cmp, s2mp, c2mp, s2d, c2d, sf, cf; double smp, cmp, s2mp, c2mp, s2d, c2d, sf, cf;
@ -421,22 +426,19 @@ embofs_mosh(double tjd, double *xemb)
*/ */
T = (tjd-J1900)/36525.0; T = (tjd-J1900)/36525.0;
/* Mean anomaly of moon (MP) */ /* Mean anomaly of moon (MP) */
a = swe_degnorm(((1.44e-5 * T + 0.009192) * T + 477198.8491) * T + a = swe_degnorm(((1.44e-5*T + 0.009192)*T + 477198.8491)*T + 296.104608);
296.104608);
a *= DEGTORAD; a *= DEGTORAD;
smp = sin(a); smp = sin(a);
cmp = cos(a); cmp = cos(a);
s2mp = 2.0*smp*cmp; /* sin(2MP) */ s2mp = 2.0*smp*cmp; /* sin(2MP) */
c2mp = cmp*cmp - smp*smp; /* cos(2MP) */ c2mp = cmp*cmp - smp*smp; /* cos(2MP) */
/* Mean elongation of moon (D) */ /* Mean elongation of moon (D) */
a = swe_degnorm(((1.9e-6 * T - 0.001436) * T + 445267.1142) * T + a = swe_degnorm(((1.9e-6*T - 0.001436)*T + 445267.1142)*T + 350.737486);
350.737486);
a = 2.0 * DEGTORAD * a; a = 2.0 * DEGTORAD * a;
s2d = sin(a); s2d = sin(a);
c2d = cos(a); c2d = cos(a);
/* Mean distance of moon from its ascending node (F) */ /* Mean distance of moon from its ascending node (F) */
a = swe_degnorm(((-3.e-7 * T - 0.003211) * T + 483202.0251) * T + a = swe_degnorm((( -3.e-7*T - 0.003211)*T + 483202.0251)*T + 11.250889);
11.250889);
a *= DEGTORAD; a *= DEGTORAD;
sf = sin(a); sf = sin(a);
cf = cos(a); cf = cos(a);
@ -446,22 +448,29 @@ embofs_mosh(double tjd, double *xemb)
/* Mean longitude of moon (LP) */ /* Mean longitude of moon (LP) */
L = ((1.9e-6*T - 0.001133)*T + 481267.8831)*T + 270.434164; L = ((1.9e-6*T - 0.001133)*T + 481267.8831)*T + 270.434164;
/* Mean anomaly of sun (M) */ /* Mean anomaly of sun (M) */
M = swe_degnorm(((-3.3e-6 * T - 1.50e-4) * T + 35999.0498) * T + M = swe_degnorm((( -3.3e-6*T - 1.50e-4)*T + 35999.0498)*T + 358.475833);
358.475833);
/* Ecliptic longitude of the moon */ /* Ecliptic longitude of the moon */
L = L + 6.288750 * smp + 1.274018 * sx + 0.658309 * s2d + L = L
0.213616 * s2mp - 0.185596 * sin(DEGTORAD * M) + 6.288750*smp
+ 1.274018*sx
+ 0.658309*s2d
+ 0.213616*s2mp
- 0.185596*sin( DEGTORAD * M )
- 0.114336*s2f; - 0.114336*s2f;
/* Ecliptic latitude of the moon */ /* Ecliptic latitude of the moon */
a = smp*cf; a = smp*cf;
sx = cmp*sf; sx = cmp*sf;
B = 5.128189 * sf + 0.280606 * (a + sx) /* sin(MP+F) */ B = 5.128189*sf
+ 0.280606*(a+sx) /* sin(MP+F) */
+ 0.277693*(a-sx) /* sin(MP-F) */ + 0.277693*(a-sx) /* sin(MP-F) */
+ 0.173238*(s2d*cf - c2d*sf); /* sin(2D-F) */ + 0.173238*(s2d*cf - c2d*sf); /* sin(2D-F) */
B *= DEGTORAD; B *= DEGTORAD;
/* Parallax of the moon */ /* Parallax of the moon */
p = 0.950724 + 0.051818 * cmp + 0.009531 * cx + 0.007843 * c2d + p = 0.950724
0.002824 * c2mp; +0.051818*cmp
+0.009531*cx
+0.007843*c2d
+0.002824*c2mp;
p *= DEGTORAD; p *= DEGTORAD;
/* Elongation of Moon from Sun /* Elongation of Moon from Sun
*/ */
@ -477,8 +486,7 @@ embofs_mosh(double tjd, double *xemb)
/* Convert to equatorial */ /* Convert to equatorial */
swi_coortrf2(xyz, xyz, -seps, ceps); swi_coortrf2(xyz, xyz, -seps, ceps);
/* Precess to equinox of J2000.0 */ /* Precess to equinox of J2000.0 */
swi_precess(xyz, tjd, J_TO_J2000); swi_precess(xyz, tjd, 0, J_TO_J2000);/**/
/**/
/* now emb -> earth */ /* now emb -> earth */
for (i = 0; i <= 2; i++) for (i = 0; i <= 2; i++)
xemb[i] -= xyz[i] / (EARTH_MOON_MRAT + 1.0); xemb[i] -= xyz[i] / (EARTH_MOON_MRAT + 1.0);
@ -501,15 +509,13 @@ static char *plan_fict_nam[SE_NFICT_ELEM] =
"Apollon", "Admetos", "Vulkanus", "Poseidon", "Apollon", "Admetos", "Vulkanus", "Poseidon",
"Isis-Transpluto", "Nibiru", "Harrington", "Isis-Transpluto", "Nibiru", "Harrington",
"Leverrier", "Adams", "Leverrier", "Adams",
"Lowell", "Pickering", "Lowell", "Pickering",};
};
char * char *swi_get_fict_name(int32 ipl, char *snam)
swi_get_fict_name(int32 ipl, char *snam)
{ {
if (read_elements_file if (read_elements_file(ipl, 0, NULL, NULL,
(ipl, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, snam, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL) == ERR) snam, NULL, NULL) == ERR)
strcpy(snam, "name not found"); strcpy(snam, "name not found");
return snam; return snam;
} }
@ -541,12 +547,11 @@ static double plan_oscu_elem[SE_NFICT_ELEM][8] = {
* The fraction is counted from 1 Jan. 1772 */ * The fraction is counted from 1 Jan. 1772 */
{2368547.66, 2431456.5, 0.0, 77.775, 0.3, 0.7, 0, 0}, {2368547.66, 2431456.5, 0.0, 77.775, 0.3, 0.7, 0, 0},
/* Nibiru, elements from Christian Woeltge, Hannover */ /* Nibiru, elements from Christian Woeltge, Hannover */
{1856113.380954, 1856113.380954, 0.0, 234.8921, 0.981092, 103.966, {1856113.380954, 1856113.380954, 0.0, 234.8921, 0.981092, 103.966, -44.567, 158.708},
-44.567, 158.708},
/* Harrington, elements from Astronomical Journal 96(4), Oct. 1988 */ /* Harrington, elements from Astronomical Journal 96(4), Oct. 1988 */
{2374696.5, J2000, 0.0, 101.2, 0.411, 208.5, 275.4, 32.4}, {2374696.5, J2000, 0.0, 101.2, 0.411, 208.5, 275.4, 32.4},
/* Leverrier's Neptune, /* Leverrier's Neptune,
* according to W.G. Hoyt, "Planets X and Pluto", Tucson 1980, p. 63 */ according to W.G. Hoyt, "Planets X and Pluto", Tucson 1980, p. 63 */
{2395662.5, 2395662.5, 34.05, 36.15, 0.10761, 284.75, 0, 0}, {2395662.5, 2395662.5, 34.05, 36.15, 0.10761, 284.75, 0, 0},
/* Adam's Neptune */ /* Adam's Neptune */
{2395662.5, 2395662.5, 24.28, 37.25, 0.12062, 299.11, 0, 0}, {2395662.5, 2395662.5, 24.28, 37.25, 0.12062, 299.11, 0, 0},
@ -562,8 +567,7 @@ static double plan_oscu_elem[SE_NFICT_ELEM][8] = {
0.7870946565779195e-01, 0.5809199028919189e+02, 0.7870946565779195e-01, 0.5809199028919189e+02,
0.8650119410725021e+02, 0.1066835622280712e+02}, 0.8650119410725021e+02, 0.1066835622280712e+02},
/* Chiron, Bowell database 18-mar-1997 */ /* Chiron, Bowell database 18-mar-1997 */
{2450500.5, J2000, 7.258191, 13.67387471, 0.38174778, 339.558345, {2450500.5, J2000, 7.258191, 13.67387471, 0.38174778, 339.558345, 209.379239, 6.933360}, /**/
209.379239, 6.933360}, /**/
#endif #endif
}; };
@ -573,9 +577,7 @@ static double plan_oscu_elem[SE_NFICT_ELEM][8] = {
* ipli body number in planetary data structure * ipli body number in planetary data structure
* iflag flags * iflag flags
*/ */
int int swi_osc_el_plan(double tjd, double *xp, int ipl, int ipli, double *xearth, double *xsun, char *serr)
swi_osc_el_plan(double tjd, double *xp, int ipl, int ipli, double *xearth,
double *xsun, char *serr)
{ {
double pqr[9], x[6]; double pqr[9], x[6];
double eps, K, fac, rho, cose, sine; double eps, K, fac, rho, cose, sine;
@ -590,8 +592,8 @@ swi_osc_el_plan(double tjd, double *xp, int ipl, int ipli, double *xearth,
/* orbital elements, either from file or, if file not found, /* orbital elements, either from file or, if file not found,
* from above built-in set * from above built-in set
*/ */
if (read_elements_file if (read_elements_file(ipl, tjd, &tjd0, &tequ,
(ipl, tjd, &tjd0, &tequ, &mano, &sema, &ecce, &parg, &node, &incl, &mano, &sema, &ecce, &parg, &node, &incl,
NULL, &fict_ifl, serr) == ERR) NULL, &fict_ifl, serr) == ERR)
return ERR; return ERR;
dmot = 0.9856076686 * DEGTORAD / sema / sqrt(sema); /* daily motion */ dmot = 0.9856076686 * DEGTORAD / sema / sqrt(sema); /* daily motion */
@ -621,16 +623,14 @@ swi_osc_el_plan(double tjd, double *xp, int ipl, int ipli, double *xearth,
if (M2 > 150 && M2 < 210) { if (M2 > 150 && M2 < 210) {
M2 -= 180; M2 -= 180;
M_180_or_0 = 180; M_180_or_0 = 180;
} } else
else
M_180_or_0 = 0; M_180_or_0 = 0;
if (M2 > 330) if (M2 > 330)
M2 -= 360; M2 -= 360;
if (M2 < 0) { if (M2 < 0) {
M2 = -M2; M2 = -M2;
Msgn = -1; Msgn = -1;
} } else
else
Msgn = 1; Msgn = 1;
if (M2 < 30) { if (M2 < 30) {
M2 *= DEGTORAD; M2 *= DEGTORAD;
@ -638,9 +638,7 @@ swi_osc_el_plan(double tjd, double *xp, int ipl, int ipli, double *xearth,
beta = M2 / (8 * ecce + 1); beta = M2 / (8 * ecce + 1);
zeta = pow(beta + sqrt(beta * beta + alpha * alpha), 1/3); zeta = pow(beta + sqrt(beta * beta + alpha * alpha), 1/3);
sigma = zeta - alpha / 2; sigma = zeta - alpha / 2;
sigma = sigma = sigma - 0.078 * sigma * sigma * sigma * sigma * sigma / (1 + ecce);
sigma - 0.078 * sigma * sigma * sigma * sigma * sigma / (1 +
ecce);
E = Msgn * (M2 + ecce * (3 * sigma - 4 * sigma * sigma * sigma)) E = Msgn * (M2 + ecce * (3 * sigma - 4 * sigma * sigma * sigma))
+ M_180_or_0; + M_180_or_0;
} }
@ -667,21 +665,20 @@ swi_osc_el_plan(double tjd, double *xp, int ipl, int ipli, double *xearth,
xp[4] = pqr[3] * x[3] + pqr[4] * x[4]; xp[4] = pqr[3] * x[3] + pqr[4] * x[4];
xp[5] = pqr[6] * x[3] + pqr[7] * x[4]; xp[5] = pqr[6] * x[3] + pqr[7] * x[4];
/* transformation to equator */ /* transformation to equator */
eps = swi_epsiln(tequ); eps = swi_epsiln(tequ, 0);
swi_coortrf(xp, xp, -eps); swi_coortrf(xp, xp, -eps);
swi_coortrf(xp+3, xp+3, -eps); swi_coortrf(xp+3, xp+3, -eps);
/* precess to J2000 */ /* precess to J2000 */
if (tequ != J2000) { if (tequ != J2000) {
swi_precess(xp, tequ, J_TO_J2000); swi_precess(xp, tequ, 0, J_TO_J2000);
swi_precess(xp + 3, tequ, J_TO_J2000); swi_precess(xp+3, tequ, 0, J_TO_J2000);
} }
/* to solar system barycentre */ /* to solar system barycentre */
if (fict_ifl & FICT_GEO) { if (fict_ifl & FICT_GEO) {
for (i = 0; i <= 5; i++) { for (i = 0; i <= 5; i++) {
xp[i] += xearth[i]; xp[i] += xearth[i];
} }
} } else {
else {
for (i = 0; i <= 5; i++) { for (i = 0; i <= 5; i++) {
xp[i] += xsun[i]; xp[i] += xsun[i];
} }
@ -694,13 +691,12 @@ swi_osc_el_plan(double tjd, double *xp, int ipl, int ipli, double *xearth,
} }
#if 1 #if 1
/* note: input parameter tjd is required for T terms in elements */ /* note: input parameter tjd is required for T terms in elements */
static int static int read_elements_file(int32 ipl, double tjd,
read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ, double *tjd0, double *tequ,
double *mano, double *sema, double *ecce, double *parg, double *mano, double *sema, double *ecce,
double *node, double *incl, char *pname, int32 * fict_ifl, double *parg, double *node, double *incl,
char *serr) char *pname, int32 *fict_ifl, char *serr)
{ {
int i, iline, iplan, retc, ncpos; int i, iline, iplan, retc, ncpos;
FILE *fp = NULL; FILE *fp = NULL;
@ -713,9 +709,7 @@ read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ,
/* file does not exist, use built-in bodies */ /* file does not exist, use built-in bodies */
if (ipl >= SE_NFICT_ELEM) { if (ipl >= SE_NFICT_ELEM) {
if (serr != NULL) if (serr != NULL)
sprintf(serr, sprintf(serr, "error no elements for fictitious body no %7.0f", (double) ipl);
"error no elements for fictitious body no %7.0f",
(double)ipl);
return ERR; return ERR;
} }
if (tjd0 != NULL) if (tjd0 != NULL)
@ -760,11 +754,11 @@ read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ,
if ((sp = strchr(s, '#')) != NULL) if ((sp = strchr(s, '#')) != NULL)
*sp = '\0'; *sp = '\0';
ncpos = swi_cutstr(s, ",", cpos, 20); ncpos = swi_cutstr(s, ",", cpos, 20);
sprintf(serri, "error in file %s, line %7.0f:", SE_FICTFILE, sprintf(serri, "error in file %s, line %7.0f:", SE_FICTFILE, (double) iline);
(double)iline);
if (ncpos < 9) { if (ncpos < 9) {
if (serr != NULL) if (serr != NULL) {
sprintf(serr, "%s nine elements required", serri); sprintf(serr, "%s nine elements required", serri);
}
return ERR; return ERR;
} }
iplan++; iplan++;
@ -783,11 +777,11 @@ read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ,
else if (strncmp(sp, "j1900", 5) == OK) else if (strncmp(sp, "j1900", 5) == OK)
*tjd0 = J1900; *tjd0 = J1900;
else if (*sp == 'j' || *sp == 'b') { else if (*sp == 'j' || *sp == 'b') {
if (serr != NULL) if (serr != NULL) {
sprintf(serr, "%s invalid epoch", serri); sprintf(serr, "%s invalid epoch", serri);
goto return_err;
} }
else goto return_err;
} else
*tjd0 = atof(sp); *tjd0 = atof(sp);
tt = tjd - *tjd0; tt = tjd - *tjd0;
} }
@ -807,11 +801,11 @@ read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ,
else if (strncmp(sp, "jdate", 5) == OK) else if (strncmp(sp, "jdate", 5) == OK)
*tequ = tjd; *tequ = tjd;
else if (*sp == 'j' || *sp == 'b') { else if (*sp == 'j' || *sp == 'b') {
if (serr != NULL) if (serr != NULL) {
sprintf(serr, "%s invalid equinox", serri); sprintf(serr, "%s invalid equinox", serri);
goto return_err;
} }
else goto return_err;
} else
*tequ = atof(sp); *tequ = atof(sp);
} }
/* mean anomaly t0 */ /* mean anomaly t0 */
@ -819,8 +813,9 @@ read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ,
retc = check_t_terms(tt, cpos[2], mano); retc = check_t_terms(tt, cpos[2], mano);
*mano = swe_degnorm(*mano); *mano = swe_degnorm(*mano);
if (retc == ERR) { if (retc == ERR) {
if (serr != NULL) if (serr != NULL) {
sprintf(serr, "%s mean anomaly value invalid", serri); sprintf(serr, "%s mean anomaly value invalid", serri);
}
goto return_err; goto return_err;
} }
/* if mean anomaly has t terms (which happens with fictitious /* if mean anomaly has t terms (which happens with fictitious
@ -836,8 +831,9 @@ read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ,
if (sema != NULL) { if (sema != NULL) {
retc = check_t_terms(tt, cpos[3], sema); retc = check_t_terms(tt, cpos[3], sema);
if (*sema <= 0 || retc == ERR) { if (*sema <= 0 || retc == ERR) {
if (serr != NULL) if (serr != NULL) {
sprintf(serr, "%s semi-axis value invalid", serri); sprintf(serr, "%s semi-axis value invalid", serri);
}
goto return_err; goto return_err;
} }
} }
@ -845,10 +841,9 @@ read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ,
if (ecce != NULL) { if (ecce != NULL) {
retc = check_t_terms(tt, cpos[4], ecce); retc = check_t_terms(tt, cpos[4], ecce);
if (*ecce >= 1 || *ecce < 0 || retc == ERR) { if (*ecce >= 1 || *ecce < 0 || retc == ERR) {
if (serr != NULL) if (serr != NULL) {
sprintf(serr, sprintf(serr, "%s eccentricity invalid (no parabolic or hyperbolic orbits allowed)", serri);
"%s eccentricity invalid (no parabolic or hyperbolic orbits allowed)", }
serri);
goto return_err; goto return_err;
} }
} }
@ -857,9 +852,9 @@ read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ,
retc = check_t_terms(tt, cpos[5], parg); retc = check_t_terms(tt, cpos[5], parg);
*parg = swe_degnorm(*parg); *parg = swe_degnorm(*parg);
if (retc == ERR) { if (retc == ERR) {
if (serr != NULL) if (serr != NULL) {
sprintf(serr, "%s perihelion argument value invalid", sprintf(serr, "%s perihelion argument value invalid", serri);
serri); }
goto return_err; goto return_err;
} }
*parg *= DEGTORAD; *parg *= DEGTORAD;
@ -869,8 +864,9 @@ read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ,
retc = check_t_terms(tt, cpos[6], node); retc = check_t_terms(tt, cpos[6], node);
*node = swe_degnorm(*node); *node = swe_degnorm(*node);
if (retc == ERR) { if (retc == ERR) {
if (serr != NULL) if (serr != NULL) {
sprintf(serr, "%s node value invalid", serri); sprintf(serr, "%s node value invalid", serri);
}
goto return_err; goto return_err;
} }
*node *= DEGTORAD; *node *= DEGTORAD;
@ -880,8 +876,9 @@ read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ,
retc = check_t_terms(tt, cpos[7], incl); retc = check_t_terms(tt, cpos[7], incl);
*incl = swe_degnorm(*incl); *incl = swe_degnorm(*incl);
if (retc == ERR) { if (retc == ERR) {
if (serr != NULL) if (serr != NULL) {
sprintf(serr, "%s inclination value invalid", serri); sprintf(serr, "%s inclination value invalid", serri);
}
goto return_err; goto return_err;
} }
*incl *= DEGTORAD; *incl *= DEGTORAD;
@ -904,9 +901,9 @@ read_elements_file(int32 ipl, double tjd, double *tjd0, double *tequ,
break; break;
} }
if (!elem_found) { if (!elem_found) {
if (serr != NULL) if (serr != NULL) {
sprintf(serr, "%s elements for planet %7.0f not found", serri, sprintf(serr, "%s elements for planet %7.0f not found", serri, (double) ipl);
(double)ipl); }
goto return_err; goto return_err;
} }
fclose(fp); fclose(fp);
@ -917,8 +914,7 @@ return_err:
} }
#endif #endif
static int static int check_t_terms(double t, char *sinp, double *doutp)
check_t_terms(double t, char *sinp, double *doutp)
{ {
int i, isgn = 1, z; int i, isgn = 1, z;
int retc = 0; int retc = 0;
@ -948,8 +944,7 @@ check_t_terms(double t, char *sinp, double *doutp)
if (*sp == '\0') if (*sp == '\0')
return retc; return retc;
sp++; sp++;
} } else {
else {
while(*sp != '\0' && strchr("* \t", *sp) != NULL) while(*sp != '\0' && strchr("* \t", *sp) != NULL)
sp++; sp++;
if (*sp != '\0' && strchr("tT", *sp) != NULL) { if (*sp != '\0' && strchr("tT", *sp) != NULL) {
@ -959,8 +954,7 @@ check_t_terms(double t, char *sinp, double *doutp)
fac *= tt[0]; fac *= tt[0];
else if ((i = atoi(sp)) <= 4 && i >= 0) else if ((i = atoi(sp)) <= 4 && i >= 0)
fac *= tt[i]; fac *= tt[i];
} } else {
else {
/* a number */ /* a number */
if (atof(sp) != 0 || *sp == '0') if (atof(sp) != 0 || *sp == '0')
fac *= atof(sp); fac *= atof(sp);

View File

@ -1,4 +1,3 @@
/* SWISSEPH /* SWISSEPH
$Header: /home/dieter/sweph/RCS/swemptab.c,v 1.74 2008/06/16 10:07:20 dieter Exp $ $Header: /home/dieter/sweph/RCS/swemptab.c,v 1.74 2008/06/16 10:07:20 dieter Exp $
@ -6,7 +5,6 @@
as it is #included by swemplan as it is #included by swemplan
**************************************************************/ **************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved. /* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions License conditions
@ -365,7 +363,6 @@ static double FAR mertabl[] = {
-0.00013, -0.00986, -0.00013, -0.00986,
}; };
static double FAR mertabb[] = { static double FAR mertabb[] = {
68.33369, 422.77623, -2057.26405, -2522.29068, 68.33369, 422.77623, -2057.26405, -2522.29068,
@ -653,7 +650,6 @@ static double FAR mertabb[] = {
-0.01665, -0.00199, -0.01665, -0.00199,
}; };
static double FAR mertabr[] = { static double FAR mertabr[] = {
-8.30490, -11.68232, 86.54880, 4361.05018, -8.30490, -11.68232, 86.54880, 4361.05018,
@ -1075,7 +1071,6 @@ static signed char FAR merargs[] = {
1, 11, 1, 0, 1, 11, 1, 0,
-1 -1
}; };
/* Total terms = 130, small = 128 */ /* Total terms = 130, small = 128 */
static struct plantbl FAR mer404 = { static struct plantbl FAR mer404 = {
{ 11, 14, 10, 11, 4, 5, 2, 0, 0,}, { 11, 14, 10, 11, 4, 5, 2, 0, 0,},
@ -1333,7 +1328,6 @@ static double FAR ventabl[] = {
-0.00004, 0.00645, -0.00004, 0.00645,
}; };
static double FAR ventabb[] = { static double FAR ventabb[] = {
-23.91858, 31.44154, 25.93273, -67.68643, -23.91858, 31.44154, 25.93273, -67.68643,
@ -1562,7 +1556,6 @@ static double FAR ventabb[] = {
0.00002, 0.00020, 0.00002, 0.00020,
}; };
static double FAR ventabr[] = { static double FAR ventabr[] = {
-0.24459, 3.72698, -6.67281, 5.24378, -0.24459, 3.72698, -6.67281, 5.24378,
@ -1903,7 +1896,6 @@ static signed char FAR venargs[] = {
2, 11, 2,-11, 3, 0, 2, 11, 2,-11, 3, 0,
-1 -1
}; };
/* Total terms = 108, small = 107 */ /* Total terms = 108, small = 107 */
static struct plantbl FAR ven404 = { static struct plantbl FAR ven404 = {
{ 5, 14, 13, 8, 4, 5, 1, 0, 0,}, { 5, 14, 13, 8, 4, 5, 1, 0, 0,},
@ -2224,7 +2216,6 @@ static double FAR eartabl[] = {
0.00002, -0.00623, 0.00002, -0.00623,
}; };
static double FAR eartabb[] = { static double FAR eartabb[] = {
-41.97860, -48.43539, 74.72897, 0.00075, -41.97860, -48.43539, 74.72897, 0.00075,
@ -2517,7 +2508,6 @@ static double FAR eartabb[] = {
0.00025, 0.00021, 0.00025, 0.00021,
}; };
static double FAR eartabr[] = { static double FAR eartabr[] = {
0.64577, -2.90183, -14.50280, 28.85196, 0.64577, -2.90183, -14.50280, 28.85196,
@ -2949,7 +2939,6 @@ static signed char FAR earargs[] = {
2, 9, 2, -9, 3, 0, 2, 9, 2, -9, 3, 0,
-1 -1
}; };
/* Total terms = 135, small = 134 */ /* Total terms = 135, small = 134 */
static struct plantbl FAR ear404 = { static struct plantbl FAR ear404 = {
{ 1, 9, 14, 17, 5, 5, 2, 1, 0,}, { 1, 9, 14, 17, 5, 5, 2, 1, 0,},
@ -3420,7 +3409,6 @@ static double FAR martabl[] = {
-0.00723, -0.01536, -0.00723, -0.01536,
}; };
static double FAR martabb[] = { static double FAR martabb[] = {
-364.49380, -47.17612, -554.97858, -430.63121, -364.49380, -47.17612, -554.97858, -430.63121,
596.44312, 596.44312,
@ -3863,7 +3851,6 @@ static double FAR martabb[] = {
0.00826, -0.00524, 0.00826, -0.00524,
}; };
static double FAR martabr[] = { static double FAR martabr[] = {
-816.07287, -381.41365, -33.69436, 177.22955, -816.07287, -381.41365, -33.69436, 177.22955,
0.18630, 0.18630,
@ -4511,7 +4498,6 @@ static signed char FAR marargs[] = {
1, 7, 4, 0, 1, 7, 4, 0,
-1 -1
}; };
/* Total terms = 201, small = 199 */ /* Total terms = 201, small = 199 */
static struct plantbl FAR mar404 = { static struct plantbl FAR mar404 = {
{ 0, 5, 12, 24, 9, 7, 3, 2, 0,}, { 0, 5, 12, 24, 9, 7, 3, 2, 0,},
@ -4888,7 +4874,6 @@ static double FAR juptabl[] = {
0.00011, 0.12033, 0.00011, 0.12033,
}; };
static double FAR juptabb[] = { static double FAR juptabb[] = {
548.59659, 594.29629, 219.97664, 59.71822, 548.59659, 594.29629, 219.97664, 59.71822,
23.62157, 40.77732, 227.07380, 23.62157, 40.77732, 227.07380,
@ -5235,7 +5220,6 @@ static double FAR juptabb[] = {
-0.00006, 0.00001, -0.00006, 0.00001,
}; };
static double FAR juptabr[] = { static double FAR juptabr[] = {
-734.58857, -1081.04460, -551.65750, -148.79782, -734.58857, -1081.04460, -551.65750, -148.79782,
-25.23171, 164.64781, 248.64813, -25.23171, 164.64781, 248.64813,
@ -5728,7 +5712,6 @@ static signed char FAR jupargs[] = {
2, 1, 3, -1, 5, 0, 2, 1, 3, -1, 5, 0,
-1 -1
}; };
/* Total terms = 142, small = 140 */ /* Total terms = 142, small = 140 */
static struct plantbl FAR jup404 = { static struct plantbl FAR jup404 = {
{ 0, 0, 1, 0, 9, 16, 7, 5, 0,}, { 0, 0, 1, 0, 9, 16, 7, 5, 0,},
@ -6248,7 +6231,6 @@ static double FAR sattabl[] = {
-0.00010, 0.06547, -0.00010, 0.06547,
}; };
static double FAR sattabb[] = { static double FAR sattabb[] = {
-567865.62548, -796277.29029, -410804.00791, -91793.12562, -567865.62548, -796277.29029, -410804.00791, -91793.12562,
-6268.13975, 398.64391, -710.67442, 175.29456, -6268.13975, 398.64391, -710.67442, 175.29456,
@ -6738,7 +6720,6 @@ static double FAR sattabb[] = {
-0.00003, -0.00013, -0.00003, -0.00013,
}; };
static double FAR sattabr[] = { static double FAR sattabr[] = {
-38127.94034, -48221.08524, -20986.93487, -3422.75861, -38127.94034, -48221.08524, -20986.93487, -3422.75861,
-8.97362, 53.34259, -404.15708, -0.05434, -8.97362, 53.34259, -404.15708, -0.05434,
@ -7447,7 +7428,6 @@ static signed char FAR satargs[] = {
2, 1, 3, -1, 6, 0, 2, 1, 3, -1, 6, 0,
-1 -1
}; };
/* Total terms = 215, small = 211 */ /* Total terms = 215, small = 211 */
static struct plantbl FAR sat404 = { static struct plantbl FAR sat404 = {
{ 0, 0, 1, 0, 8, 18, 9, 5, 0,}, { 0, 0, 1, 0, 8, 18, 9, 5, 0,},
@ -7862,7 +7842,6 @@ static double FAR uratabl[] = {
-0.01517, 0.03748, -0.01517, 0.03748,
}; };
static double FAR uratabb[] = { static double FAR uratabb[] = {
0.00000, 107.91527, 83.39404, -124.29804, 0.00000, 107.91527, 83.39404, -124.29804,
@ -8247,7 +8226,6 @@ static double FAR uratabb[] = {
0.00005, 0.00003, 0.00005, 0.00003,
}; };
static double FAR uratabr[] = { static double FAR uratabr[] = {
0.00000, -53.23277, -44.70609, -62.54432, 0.00000, -53.23277, -44.70609, -62.54432,
@ -8813,7 +8791,6 @@ static signed char FAR uraargs[] = {
2, 3, 5, -1, 7, 0, 2, 3, 5, -1, 7, 0,
-1 -1
}; };
/* Total terms = 177, small = 171 */ /* Total terms = 177, small = 171 */
static struct plantbl FAR ura404 = { static struct plantbl FAR ura404 = {
{ 0, 0, 0, 0, 5, 10, 9, 12, 0,}, { 0, 0, 0, 0, 5, 10, 9, 12, 0,},
@ -8966,7 +8943,6 @@ static double FAR neptabl[] = {
-0.28141, 0.25061, -0.20293, 0.79930, -0.28141, 0.25061, -0.20293, 0.79930,
}; };
static double FAR neptabb[] = { static double FAR neptabb[] = {
-391.05987, -243.95958, -23.83558, 58.13857, -391.05987, -243.95958, -23.83558, 58.13857,
@ -9089,7 +9065,6 @@ static double FAR neptabb[] = {
0.00106, 0.00025, 0.00013, -0.00019, 0.00106, 0.00025, 0.00013, -0.00019,
}; };
static double FAR neptabr[] = { static double FAR neptabr[] = {
-767.68936, -460.59576, -52.41861, -273.85897, -767.68936, -460.59576, -52.41861, -273.85897,
@ -9275,7 +9250,6 @@ static signed char FAR nepargs[] = {
2, 2, 5, -1, 8, 1, 2, 2, 5, -1, 8, 1,
-1 -1
}; };
/* Total terms = 59, small = 58 */ /* Total terms = 59, small = 58 */
static struct plantbl FAR nep404 = { static struct plantbl FAR nep404 = {
{ 0, 0, 0, 0, 3, 8, 7, 9, 0,}, { 0, 0, 0, 0, 3, 8, 7, 9, 0,},
@ -9697,7 +9671,6 @@ static double FAR plutabl[] = {
-0.06243, 0.04306, -0.06243, 0.04306,
}; };
static double FAR plutabb[] = { static double FAR plutabb[] = {
-35042727.30412, -49049197.81293, -25374963.60995, -5761406.03035, -35042727.30412, -49049197.81293, -25374963.60995, -5761406.03035,
-467370.57540, 14040.11453, 2329.15763, -13978.69390, -467370.57540, 14040.11453, 2329.15763, -13978.69390,
@ -10089,7 +10062,6 @@ static double FAR plutabb[] = {
0.05985, 0.04130, 0.05985, 0.04130,
}; };
static double FAR plutabr[] = { static double FAR plutabr[] = {
17990649.12487, 24806479.30874, 12690953.00645, 2892671.69562, 17990649.12487, 24806479.30874, 12690953.00645, 2892671.69562,
249947.71316, -5138.71425, 1142.68629, 6075.25751, 249947.71316, -5138.71425, 1142.68629, 6075.25751,
@ -10658,7 +10630,6 @@ static signed char FAR pluargs[] = {
1, 2, 5, 0, 1, 2, 5, 0,
-1 -1
}; };
/* Total terms = 173, small = 156 */ /* Total terms = 173, small = 156 */
static struct plantbl FAR plu404 = { static struct plantbl FAR plu404 = {
{ 0, 0, 0, 0, 2, 2, 9, 13, 13,}, { 0, 0, 0, 0, 2, 2, 9, 13, 13,},

View File

@ -1,4 +1,3 @@
/************************************************************ /************************************************************
$Header: /home/dieter/sweph/RCS/swenut2000a.h,v 1.74 2008/06/16 10:07:20 dieter Exp $ $Header: /home/dieter/sweph/RCS/swenut2000a.h,v 1.74 2008/06/16 10:07:20 dieter Exp $
definitions for nutation theory IAU 2000a definitions for nutation theory IAU 2000a
@ -7,7 +6,6 @@
Compilation Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich Compilation Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich
************************************************************/ ************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved. /* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions License conditions
@ -64,14 +62,11 @@
/* 0.1 microarcsecond to degrees */ /* 0.1 microarcsecond to degrees */
#define O1MAS2DEG (1 / 3600.0 / 10000000.0) #define O1MAS2DEG (1 / 3600.0 / 10000000.0)
/* Number of terms in the luni-solar nutation model */ /* Number of terms in the luni-solar nutation model */
#define NLS 678 #define NLS 678
#define NLS_2000B 77 #define NLS_2000B 77
/* Number of terms in the planetary nutation model */ /* Number of terms in the planetary nutation model */
#define NPL 687 #define NPL 687
/* Luni-Solar argument multipliers /* Luni-Solar argument multipliers
L L' F D Om */ L L' F D Om */
static int16 nls[] = { static int16 nls[] = {
@ -1439,7 +1434,6 @@ static int32 cls[] = {
}; };
#if NUT_IAU_2000A #if NUT_IAU_2000A
/* Planetary argument multipliers /* Planetary argument multipliers
* L L' F D Om Me Ve E Ma Ju Sa Ur Ne pre */ * L L' F D Om Me Ve E Ma Ju Sa Ur Ne pre */
static int16 npl[] = { static int16 npl[] = {

View File

@ -1,4 +1,3 @@
/************************************************************ /************************************************************
$Header: /home/dieter/sweph/RCS/sweodef.h,v 1.74 2008/06/16 10:07:20 dieter Exp $ $Header: /home/dieter/sweph/RCS/sweodef.h,v 1.74 2008/06/16 10:07:20 dieter Exp $
definitions and constants for all Swiss Ephemeris source files, definitions and constants for all Swiss Ephemeris source files,
@ -313,7 +312,6 @@ typedef int32 centisec; /* centiseconds used for angles and times */
# define FILE_RW_ACCESS "r+t" /* open text file for writing and reading */ # define FILE_RW_ACCESS "r+t" /* open text file for writing and reading */
# define FILE_W_CREATE "wt" /* create/open text file for write*/ # define FILE_W_CREATE "wt" /* create/open text file for write*/
# define FILE_A_ACCESS "a+t" /* create/open text file for append*/ # define FILE_A_ACCESS "a+t" /* create/open text file for append*/
/* attention, all backslashes for msdos directry names must be written as \\, /* attention, all backslashes for msdos directry names must be written as \\,
because it is the C escape character */ because it is the C escape character */
# define DIR_GLUE "\\" /* glue string for directory/file */ # define DIR_GLUE "\\" /* glue string for directory/file */

View File

@ -1,10 +1,8 @@
/***************************************************** /*****************************************************
$Header: /home/dieter/sweph/RCS/swepcalc.c,v 1.74 2008/06/16 10:07:20 dieter Exp $ $Header: /home/dieter/sweph/RCS/swepcalc.c,v 1.74 2008/06/16 10:07:20 dieter Exp $
Placalc compatibility interface for Swiss Ephemeris. Placalc compatibility interface for Swiss Ephemeris.
*******************************************************/ *******************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved. /* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions License conditions
@ -82,12 +80,7 @@ Placalc compatibility interface for Swiss Ephemeris.
local globals, not exported local globals, not exported
************************************************************/ ************************************************************/
static int plac2swe[] = static int plac2swe[] = {SE_SUN, SE_MOON, SE_MERCURY, SE_VENUS, SE_MARS, SE_JUPITER, SE_SATURN, SE_URANUS, SE_NEPTUNE, SE_PLUTO, SE_MEAN_NODE, SE_TRUE_NODE, SE_CHIRON, SE_MEAN_APOG, SE_CERES, SE_PALLAS, SE_JUNO, SE_VESTA,};
{ SE_SUN, SE_MOON, SE_MERCURY, SE_VENUS, SE_MARS, SE_JUPITER, SE_SATURN,
SE_URANUS, SE_NEPTUNE, SE_PLUTO, SE_MEAN_NODE, SE_TRUE_NODE, SE_CHIRON,
SE_MEAN_APOG,
SE_CERES, SE_PALLAS, SE_JUNO, SE_VESTA,
};
/* If there occurs an internal error in placalc, a message is /* If there occurs an internal error in placalc, a message is
* written into the string variable perrtx. * written into the string variable perrtx.
@ -114,8 +107,7 @@ static double rmima[CALC_N][2] = {
{28.67716748, 50.29208774}, {28.67716748, 50.29208774},
{ 0.00, 0.00259553}, /* nodes don't get a real value*/ { 0.00, 0.00259553}, /* nodes don't get a real value*/
{ 0.00, 0.00259553}, { 0.00, 0.00259553},
{7.36277475, 19.86585062} { 7.36277475, 19.86585062}};
};
/********************************************************** /**********************************************************
function nacalc () function nacalc ()
@ -132,8 +124,7 @@ coordinate format for fast mathematics with planetary positions.
This function is just a template of how the calc() package This function is just a template of how the calc() package
can be used. can be used.
**********************************************************/ **********************************************************/
int int nacalc (double jd_ad, /* universal time relative julian date */
nacalc(double jd_ad, /* universal time relative julian date */
centisec *plon, /* returned longitudes */ centisec *plon, /* returned longitudes */
centisec *pspe /* returned speeds, if not NULL pointer */ centisec *pspe /* returned speeds, if not NULL pointer */
) )
@ -147,13 +138,10 @@ nacalc(double jd_ad, /* universal time relative julian date */
for (planet = SUN; planet <= MAXPL_NACALC; planet++) { for (planet = SUN; planet <= MAXPL_NACALC; planet++) {
if (calc (planet, jd_ad, flag, &rlng, &rrad, &rlat, &rspeed) == OK) { if (calc (planet, jd_ad, flag, &rlng, &rrad, &rlat, &rspeed) == OK) {
plon [planet] = swe_csnorm(swe_d2l (rlng * DEG)); plon [planet] = swe_csnorm(swe_d2l (rlng * DEG));
if (pspe != NULL) if (pspe != NULL) pspe [planet] = swe_d2l (rspeed * DEG);
pspe[planet] = swe_d2l(rspeed * DEG); } else {
}
else {
plon [planet] = -1; plon [planet] = -1;
if (pspe != NULL) if (pspe != NULL) pspe [planet] = 0;
pspe[planet] = 0;
if (result != ERR) { /* save first error message */ if (result != ERR) { /* save first error message */
strcpy(err, placalc_get_errtext()); strcpy(err, placalc_get_errtext());
} }
@ -171,19 +159,17 @@ nacalc(double jd_ad, /* universal time relative julian date */
* over a communication line to the calculation client. * over a communication line to the calculation client.
* if plalist = 0, only SUN .. CHIRON are delivered, no LILITH * if plalist = 0, only SUN .. CHIRON are delivered, no LILITH
******************************************************************/ ******************************************************************/
int int calcserv(int id, /* request id, random number to prevent phase err */
calcserv(int id, /* request id, random number to prevent phase err */
double jd_ad, /* time as relative Astrodienst julian date */ double jd_ad, /* time as relative Astrodienst julian date */
int flag, /* a set of CALC_BIT_ bitflags */ int flag, /* a set of CALC_BIT_ bitflags */
int plalist,/* bit list of planets to be computed, 0 = all */ int plalist,/* bit list of planets to be computed, 0 = all */
char *so) char *so) /* output string, MUST BE LONG ENOUGH (800 bytes)*/
{ /* output string, MUST BE LONG ENOUGH (800 bytes) */ {
int p, planet, so_len; int p, planet, so_len;
double rlng, rrad, rlat, rspeed, rau[CALC_N]; double rlng, rrad, rlat, rspeed, rau[CALC_N];
centisec lcs[CALC_N], lpcs[CALC_N], betcs[CALC_N]; centisec lcs[CALC_N], lpcs[CALC_N], betcs[CALC_N];
char s[AS_MAXCH]; char s[AS_MAXCH];
if (plalist == 0) if (plalist == 0) plalist = (1 << 13) - 1; /* sun .. chiron */;
plalist = (1 << 13) - 1; /* sun .. chiron */ ;
/* /*
* flag determines whether deltat is added to t; * flag determines whether deltat is added to t;
* if CALC_BIT_EPHE is set, jd_ad is considered as ephemeris time, * if CALC_BIT_EPHE is set, jd_ad is considered as ephemeris time,
@ -193,15 +179,13 @@ calcserv(int id, /* request id, random number to prevent phase er
jd_ad += deltat (jd_ad); jd_ad += deltat (jd_ad);
} }
for (p = SUN; p < CALC_N; p++) { for (p = SUN; p < CALC_N; p++) {
if (!check_bit(plalist, p)) if (! check_bit(plalist, p)) continue;
continue;
if (calc (p, jd_ad, flag, &rlng, &rrad, &rlat, &rspeed) == OK) { if (calc (p, jd_ad, flag, &rlng, &rrad, &rlat, &rspeed) == OK) {
lcs [p] = swe_d2l (rlng * DEG); lcs [p] = swe_d2l (rlng * DEG);
lpcs [p] = swe_d2l (rspeed * DEG); lpcs [p] = swe_d2l (rspeed * DEG);
betcs [p] = swe_d2l (rlat * DEG); betcs [p] = swe_d2l (rlat * DEG);
rau [p] = rrad; rau [p] = rrad;
} } else {
else {
sprintf(so,"error at planet %d", p); sprintf(so,"error at planet %d", p);
return ( ERR); return ( ERR);
} }
@ -220,16 +204,14 @@ calcserv(int id, /* request id, random number to prevent phase er
swe_d2l(ekl * DEG), swe_d2l (nut * DEG) ); swe_d2l(ekl * DEG), swe_d2l (nut * DEG) );
so_len = strlen (so); so_len = strlen (so);
for (planet = SUN; planet < CALC_N; planet++) { for (planet = SUN; planet < CALC_N; planet++) {
if (!check_bit(plalist, planet)) if (! check_bit(plalist, planet)) continue;
continue;
sprintf (s ,",%d", lcs[planet]); sprintf (s ,",%d", lcs[planet]);
strcat (so + so_len, s); strcat (so + so_len, s);
so_len += strlen (s); so_len += strlen (s);
} }
if (flag & CALC_BIT_SPEED) { if (flag & CALC_BIT_SPEED) {
for (planet = SUN; planet < CALC_N; planet++) { for (planet = SUN; planet < CALC_N; planet++) {
if (!check_bit(plalist, planet)) if (! check_bit(plalist, planet)) continue;
continue;
sprintf (s ,",%d", lpcs[planet]); sprintf (s ,",%d", lpcs[planet]);
strcat (so + so_len, s); strcat (so + so_len, s);
so_len += strlen (s); so_len += strlen (s);
@ -237,8 +219,7 @@ calcserv(int id, /* request id, random number to prevent phase er
} }
if (flag & CALC_BIT_BETA) { if (flag & CALC_BIT_BETA) {
for (planet = SUN; planet < CALC_N; planet++) { for (planet = SUN; planet < CALC_N; planet++) {
if (!check_bit(plalist, planet)) if (! check_bit(plalist, planet)) continue;
continue;
sprintf (s ,",%d", betcs[planet]); sprintf (s ,",%d", betcs[planet]);
strcat (so + so_len, s); strcat (so + so_len, s);
so_len += strlen (s); so_len += strlen (s);
@ -246,8 +227,7 @@ calcserv(int id, /* request id, random number to prevent phase er
} }
if (flag & CALC_BIT_RGEO) { if (flag & CALC_BIT_RGEO) {
for (planet = SUN; planet < CALC_N; planet++) { for (planet = SUN; planet < CALC_N; planet++) {
if (!check_bit(plalist, planet)) if (! check_bit(plalist, planet)) continue;
continue;
sprintf (s ,",%d", rel_geo(planet,rau[planet])); sprintf (s ,",%d", rel_geo(planet,rau[planet]));
strcat (so + so_len, s); strcat (so + so_len, s);
so_len += strlen (s); so_len += strlen (s);
@ -255,8 +235,7 @@ calcserv(int id, /* request id, random number to prevent phase er
} }
if (flag & CALC_BIT_RAU) { if (flag & CALC_BIT_RAU) {
for (planet = SUN; planet < CALC_N; planet++) { for (planet = SUN; planet < CALC_N; planet++) {
if (!check_bit(plalist, planet)) if (! check_bit(plalist, planet)) continue;
continue;
sprintf (s ,",%.8f", rau[planet]); sprintf (s ,",%.8f", rau[planet]);
strcat (so + so_len, s); strcat (so + so_len, s);
so_len += strlen (s); so_len += strlen (s);
@ -297,19 +276,21 @@ calcserv(int id, /* request id, random number to prevent phase er
will return the values for time teph. will return the values for time teph.
******************************************************************/ ******************************************************************/
int int calc(int planet, /* planet index as defined in placalc.h,
calc(int planet, /* planet index as defined in placalc.h, SUN = 0, MOON = 1 etc.
* SUN = 0, MOON = 1 etc. planet == -1 calc calculates only nut, ekl, meanekl */
* planet == -1 calc calculates only nut, ekl, meanekl */
double jd_ad, /* relative Astrodienst Juldate, ephemeris time. double jd_ad, /* relative Astrodienst Juldate, ephemeris time.
* Astrodienst Juldate is relative 31 Dec 1949, noon. */ Astrodienst Juldate is relative 31 Dec 1949, noon. */
int flag, /* See definition of flag bits above */ int flag, /* See definition of flag bits above */
double *alng, double *arad, double *alat, double *alngspeed) double *alng,
double *arad,
double *alat,
double *alngspeed)
/* pointers to the return variables: /* pointers to the return variables:
* alng = ecliptic longitude in degrees alng = ecliptic longitude in degrees
* arad = radius vector in AU (astronomic units) arad = radius vector in AU (astronomic units)
* alat = ecliptic latitude in degrees alat = ecliptic latitude in degrees
* alngspeed = speed of planet in degrees per day alngspeed = speed of planet in degrees per day
*/ */
{ {
double tjd = jd_ad + JUL_OFFSET; double tjd = jd_ad + JUL_OFFSET;
@ -348,8 +329,7 @@ calc(int planet, /* planet index as defined in placalc.h,
*alng = nut = x[2]; *alng = nut = x[2];
*arad = x[1]; *arad = x[1];
*alat = ekl = x[0]; *alat = ekl = x[0];
} } else {
else {
*alng = x[0]; *alng = x[0];
*arad = x[2]; *arad = x[2];
*alat = x[1]; *alat = x[1];
@ -358,8 +338,7 @@ calc(int planet, /* planet index as defined in placalc.h,
return (OK); return (OK);
} /* end calc */ } /* end calc */
int int rel_geo(int planet, double rau)
rel_geo(int planet, double rau)
{ {
/* /*
* get relative earth distance in range 0..1000: * get relative earth distance in range 0..1000:
@ -377,12 +356,8 @@ rel_geo(int planet, double rau)
int rgeo; int rgeo;
if (planet == MEAN_NODE || planet == TRUE_NODE || planet == LILITH) { if (planet == MEAN_NODE || planet == TRUE_NODE || planet == LILITH) {
return 0; return 0;
} } else {
else { rgeo = 1000 * (1.0 - (rau - rmima[planet][0]) / (rmima[planet][1] - rmima[planet][0]));
rgeo =
1000 * (1.0 -
(rau - rmima[planet][0]) / (rmima[planet][1] -
rmima[planet][0]));
} }
if (rgeo < 0) if (rgeo < 0)
rgeo = 0; rgeo = 0;
@ -395,74 +370,31 @@ rel_geo(int planet, double rau)
* get the planet index for an AFL letter * get the planet index for an AFL letter
* returns -1 if the letter does not correspond to a planet. * returns -1 if the letter does not correspond to a planet.
*/ */
int int afl2planet(int afl)
afl2planet(int afl)
{ {
int p; int p;
switch (afl) { switch (afl) {
case AFL_SUN: case AFL_SUN : p = SUN; break;
p = SUN; case AFL_MON : p = MOON; break;
break; case AFL_MER : p = MERCURY; break;
case AFL_MON: case AFL_VEN : p = VENUS; break;
p = MOON; case AFL_MAR : p = MARS; break;
break; case AFL_JUP : p = JUPITER; break;
case AFL_MER: case AFL_SAT : p = SATURN; break;
p = MERCURY; case AFL_URA : p = URANUS; break;
break; case AFL_NEP : p = NEPTUNE; break;
case AFL_VEN: case AFL_PLU : p = PLUTO; break;
p = VENUS; case AFL_MNODE : p = MEAN_NODE; break;
break; case AFL_TNODE : p = TRUE_NODE; break;
case AFL_MAR: case AFL_CHI : p = CHIRON; break;
p = MARS; case AFL_LIL : p = LILITH; break;
break; case AFL_CER : p = CERES; break;
case AFL_JUP: case AFL_PAL : p = PALLAS; break;
p = JUPITER; case AFL_JUN : p = JUNO; break;
break; case AFL_VES : p = VESTA; break;
case AFL_SAT: case AFL_AC : p = AC; break;
p = SATURN; case AFL_MC : p = MC; break;
break; default : p = -1; break;
case AFL_URA:
p = URANUS;
break;
case AFL_NEP:
p = NEPTUNE;
break;
case AFL_PLU:
p = PLUTO;
break;
case AFL_MNODE:
p = MEAN_NODE;
break;
case AFL_TNODE:
p = TRUE_NODE;
break;
case AFL_CHI:
p = CHIRON;
break;
case AFL_LIL:
p = LILITH;
break;
case AFL_CER:
p = CERES;
break;
case AFL_PAL:
p = PALLAS;
break;
case AFL_JUN:
p = JUNO;
break;
case AFL_VES:
p = VESTA;
break;
case AFL_AC:
p = AC;
break;
case AFL_MC:
p = MC;
break;
default:
p = -1;
break;
} }
return p; return p;
} }
@ -471,50 +403,29 @@ afl2planet(int afl)
* get the AFL letter for a planet * get the AFL letter for a planet
* returns -1 if no letter corresponds to a planet. * returns -1 if no letter corresponds to a planet.
*/ */
int int planet2afl(int planet)
planet2afl(int planet)
{ {
switch (planet) { switch (planet) {
case SUN: case SUN: return AFL_SUN;
return AFL_SUN; case MOON: return AFL_MON;
case MOON: case MERCURY: return AFL_MER;
return AFL_MON; case VENUS: return AFL_VEN;
case MERCURY: case MARS: return AFL_MAR;
return AFL_MER; case JUPITER: return AFL_JUP;
case VENUS: case SATURN: return AFL_SAT;
return AFL_VEN; case URANUS: return AFL_URA;
case MARS: case NEPTUNE: return AFL_NEP;
return AFL_MAR; case PLUTO: return AFL_PLU;
case JUPITER: case MEAN_NODE: return AFL_MNODE;
return AFL_JUP; case TRUE_NODE: return AFL_TNODE;
case SATURN: case CHIRON: return AFL_CHI;
return AFL_SAT; case LILITH: return AFL_LIL;
case URANUS: case CERES: return AFL_CER;
return AFL_URA; case PALLAS: return AFL_PAL;
case NEPTUNE: case JUNO: return AFL_JUN;
return AFL_NEP; case VESTA: return AFL_VES;
case PLUTO: case AC: return AFL_AC;
return AFL_PLU; case MC: return AFL_MC;
case MEAN_NODE:
return AFL_MNODE;
case TRUE_NODE:
return AFL_TNODE;
case CHIRON:
return AFL_CHI;
case LILITH:
return AFL_LIL;
case CERES:
return AFL_CER;
case PALLAS:
return AFL_PAL;
case JUNO:
return AFL_JUN;
case VESTA:
return AFL_VES;
case AC:
return AFL_AC;
case MC:
return AFL_MC;
} }
if (planet >= FIRST_HSNR && planet <= LAST_HSNR) if (planet >= FIRST_HSNR && planet <= LAST_HSNR)
return AFL_HOUSE; return AFL_HOUSE;
@ -526,50 +437,29 @@ planet2afl(int planet)
* get the 2-letter abbreviation for a planet * get the 2-letter abbreviation for a planet
* returns ?? if not defined * returns ?? if not defined
*/ */
char * char *planet2abbr2(int planet)
planet2abbr2(int planet)
{ {
switch (planet) { switch (planet) {
case SUN: case SUN: return "su";
return "su"; case MOON: return "mo";
case MOON: case MERCURY: return "me";
return "mo"; case VENUS: return "ve";
case MERCURY: case MARS: return "ma";
return "me"; case JUPITER: return "ju";
case VENUS: case SATURN: return "sa";
return "ve"; case URANUS: return "ur";
case MARS: case NEPTUNE: return "ne";
return "ma"; case PLUTO: return "pl";
case JUPITER: case MEAN_NODE: return "mn";
return "ju"; case TRUE_NODE: return "tn";
case SATURN: case CHIRON: return "ch";
return "sa"; case LILITH: return "li";
case URANUS: case CERES: return "ce";
return "ur"; case PALLAS: return "pa";
case NEPTUNE: case JUNO: return "jn";
return "ne"; case VESTA: return "vs";
case PLUTO: case AC: return "ac";
return "pl"; case MC: return "mc";
case MEAN_NODE:
return "mn";
case TRUE_NODE:
return "tn";
case CHIRON:
return "ch";
case LILITH:
return "li";
case CERES:
return "ce";
case PALLAS:
return "pa";
case JUNO:
return "jn";
case VESTA:
return "vs";
case AC:
return "ac";
case MC:
return "mc";
} }
return "??"; return "??";
} }
@ -578,60 +468,37 @@ planet2abbr2(int planet)
* get the 3-letter abbreviation for a planet * get the 3-letter abbreviation for a planet
* returns ??? if not defined * returns ??? if not defined
*/ */
char * char *planet2abbr3(int planet)
planet2abbr3(int planet)
{ {
switch (planet) { switch (planet) {
case SUN: case SUN: return "sun";
return "sun"; case MOON: return "mon";
case MOON: case MERCURY: return "mer";
return "mon"; case VENUS: return "ven";
case MERCURY: case MARS: return "mar";
return "mer"; case JUPITER: return "jup";
case VENUS: case SATURN: return "sat";
return "ven"; case URANUS: return "ura";
case MARS: case NEPTUNE: return "nep";
return "mar"; case PLUTO: return "plu";
case JUPITER: case MEAN_NODE: return "mno";
return "jup"; case TRUE_NODE: return "tno";
case SATURN: case CHIRON: return "chi";
return "sat"; case LILITH: return "lil";
case URANUS: case CERES: return "cer";
return "ura"; case PALLAS: return "pal";
case NEPTUNE: case JUNO: return "jun";
return "nep"; case VESTA: return "ves";
case PLUTO: case AC: return "asc";
return "plu"; case MC: return "mc ";
case MEAN_NODE:
return "mno";
case TRUE_NODE:
return "tno";
case CHIRON:
return "chi";
case LILITH:
return "lil";
case CERES:
return "cer";
case PALLAS:
return "pal";
case JUNO:
return "jun";
case VESTA:
return "ves";
case AC:
return "asc";
case MC:
return "mc ";
} }
return "???"; return "???";
} }
char * char *placalc_set_ephepath(char *path)
placalc_set_ephepath(char *path)
{ {
static char *epath; static char *epath;
if (path == NULL) if (path == NULL) return epath;
return epath;
if (epath != NULL) if (epath != NULL)
free((void *) epath); free((void *) epath);
epath = malloc(strlen(path) + 1); epath = malloc(strlen(path) + 1);
@ -642,14 +509,12 @@ placalc_set_ephepath(char *path)
return epath; return epath;
} }
void void placalc_close_files()
placalc_close_files()
{ {
swe_close(); swe_close();
} }
char * char *placalc_get_errtext()
placalc_get_errtext()
{ {
return perrtx; return perrtx;
} }
@ -659,9 +524,8 @@ deltat(t): returns delta t (in julian days) from universal time t
is included by users is included by users
ET = UT + deltat ET = UT + deltat
******************************************************/ ******************************************************/
double double deltat (double jd_ad) /* Astrodienst relative julian date */
deltat(double jd_ad) {
{ /* Astrodienst relative julian date */
return swe_deltat(jd_ad + JUL_OFFSET); return swe_deltat(jd_ad + JUL_OFFSET);
} }
@ -677,8 +541,7 @@ deltat(double jd_ad)
* lon, lat pointer for returning the ecliptic coordinates * lon, lat pointer for returning the ecliptic coordinates
* (mean ecliptic and equinox of date) * (mean ecliptic and equinox of date)
**********************************************************/ **********************************************************/
int int fixstar(char *star, double jd, double *lon, double *lat)
fixstar(char *star, double jd, double *lon, double *lat)
{ {
double x[6]; double x[6];
int i; int i;
@ -696,16 +559,13 @@ fixstar(char *star, double jd, double *lon, double *lat)
} }
/******************************************************************/ /******************************************************************/
double double diff8360 (double a, double b)
diff8360(double a, double b)
/* a - b on a 360 degree circle, result -180..180*/ /* a - b on a 360 degree circle, result -180..180*/
{ {
double d; double d;
d = a - b; d = a - b;
if (d >= 180.0) if ( d >= 180.0 ) return( d - 360.0 );
return (d - 360.0); if ( d < -180.0 ) return( d + 360.0 );
if (d < -180.0)
return (d + 360.0);
return( d ); return( d );
} /* diff8360 */ } /* diff8360 */
@ -717,14 +577,12 @@ diff8360(double a, double b)
return in which house pp is; return in which house pp is;
houses are numbered from 1 .. 12 houses are numbered from 1 .. 12
*************************************/ *************************************/
int int HouseNr(struct houses *hsp, CSEC pp)
HouseNr(struct houses *hsp, CSEC pp)
{ {
CSEC cx; CSEC cx;
int i = 2; int i = 2;
cx = swe_difcsn(pp, hsp->cusp [1]); /* distance from cusp 1 */ cx = swe_difcsn(pp, hsp->cusp [1]); /* distance from cusp 1 */
while (i < 13 && cx >= difcsn(hsp->cusp[i], hsp->cusp[1])) while (i < 13 && cx >= difcsn(hsp->cusp [i], hsp->cusp [1])) i++;
i++;
return (i - 1); return (i - 1);
} }
@ -732,15 +590,12 @@ HouseNr(struct houses *hsp, CSEC pp)
returns the inp-house number, where pp is in returns the inp-house number, where pp is in
houses are numbered from 1 .. 12 houses are numbered from 1 .. 12
************************************/ ************************************/
int int InpHouseNr (struct houses *hsp, CSEC pp, CSEC *coff)
InpHouseNr(struct houses *hsp, CSEC pp, CSEC * coff)
{ {
CSEC cx; CSEC cx;
int i = 2; int i = 2;
cx = swe_difcsn(pp, hsp->cusp [1] + coff [1]); cx = swe_difcsn(pp, hsp->cusp [1] + coff [1]);
while (i < 13 while(i<13 && cx >= swe_difcsn(hsp->cusp[i] + coff[i], hsp->cusp[1] + coff[1]))
&& cx >= swe_difcsn(hsp->cusp[i] + coff[i],
hsp->cusp[1] + coff[1]))
i++; i++;
return (i - 1); return (i - 1);
} }
@ -753,8 +608,7 @@ InpHouseNr(struct houses *hsp, CSEC pp, CSEC * coff)
* We first calculate the absolute offsets for each house of our birth chart, * We first calculate the absolute offsets for each house of our birth chart,
* then call the function InpHouseNr() with those values. * then call the function InpHouseNr() with those values.
*/ */
int int InpHouseNr2 (struct houses *hsp, CSEC pp, CSEC *coff)
InpHouseNr2(struct houses *hsp, CSEC pp, CSEC * coff)
{ {
int i, j; int i, j;
CSEC myoff[13]; CSEC myoff[13];
@ -763,57 +617,34 @@ InpHouseNr2(struct houses *hsp, CSEC pp, CSEC * coff)
if (myoff[0] == 1) { if (myoff[0] == 1) {
for (i = 1; i < 13; i++) { for (i = 1; i < 13; i++) {
j = i + 1; j = i + 1;
if (j > 12) if (j > 12) j = 1;
j = 1; myoff[j] = swe_degnorm((hsp->cusp[j] - hsp->cusp[i]) / 360000.0) / 30.0 * myoff[j];
myoff[j] =
swe_degnorm((hsp->cusp[j] -
hsp->cusp[i]) / 360000.0) / 30.0 * myoff[j];
} }
} }
return InpHouseNr(hsp, pp, myoff); return InpHouseNr(hsp, pp, myoff);
} }
/* ********************************************************* */ /* ********************************************************* */
/* Houses: */ /* Houses: */
/* ********************************************************* */ /* ********************************************************* */
/* Koch and Placidus don't work in the polar circle. */ /* Koch and Placidus don't work in the polar circle. */
/* We swap MC/IC so that MC is always before AC in the zodiac */ /* We swap MC/IC so that MC is always before AC in the zodiac */
/* We than divide the quadrants into 3 equal parts. */ /* We than divide the quadrants into 3 equal parts. */
/* ********************************************************* */ /* ********************************************************* */
/* All angles are expressed in centiseconds (1/100th of a */ /* All angles are expressed in centiseconds (1/100th of a */
/* second of arc) and integer arithmetic is used for these. */ /* second of arc) and integer arithmetic is used for these. */
/* Special trigonometric functions dsin, dcos etc. are im- */ /* Special trigonometric functions dsin, dcos etc. are im- */
/* plemented for arguments in centiseconds. */ /* plemented for arguments in centiseconds. */
/* ********************************************************* */ /* ********************************************************* */
/* Arguments: th = sidereal time (angle 0..360 degrees */ /* Arguments: th = sidereal time (angle 0..360 degrees */
/* hsy = letter code for house system; implemen- */ /* hsy = letter code for house system; implemen- */
/* ted are P,K,C,R,E,V. */ /* ted are P,K,C,R,E,V. */
/* fi = geographic latitude */ /* fi = geographic latitude */
/* ekl = obliquity of the ecliptic */ /* ekl = obliquity of the ecliptic */
/* iteration_count = number of iterations in */ /* iteration_count = number of iterations in */
/* Placidus calculation; can be 1 or 2. */ /* Placidus calculation; can be 1 or 2. */
/* ********************************************************* */ /* ********************************************************* */
void void CalcHouses(CSEC th, CSEC fi, CSEC mekl, char hsy, int iteration_count,
CalcHouses(CSEC th, CSEC fi, CSEC mekl, char hsy, int iteration_count,
struct houses *hsp ) struct houses *hsp )
{ {
int retc = 0, i; int retc = 0, i;
@ -821,8 +652,7 @@ CalcHouses(CSEC th, CSEC fi, CSEC mekl, char hsy, int iteration_count,
double cusps[13]; double cusps[13];
double ascmc[10]; double ascmc[10];
/* iteration_count is always 2 */ /* iteration_count is always 2 */
retc = retc = swe_houses_armc(th / cs2deg, fi / cs2deg, mekl / cs2deg, (int) hsy,
swe_houses_armc(th / cs2deg, fi / cs2deg, mekl / cs2deg, (int)hsy,
cusps, ascmc); cusps, ascmc);
for (i = 0; i < 13; i++) for (i = 0; i < 13; i++)
hsp->cusp[i] = swe_d2l(cusps[i] * cs2deg); hsp->cusp[i] = swe_d2l(cusps[i] * cs2deg);
@ -836,8 +666,7 @@ CalcHouses(CSEC th, CSEC fi, CSEC mekl, char hsy, int iteration_count,
} /* procedure houses */ } /* procedure houses */
/******************************/ /******************************/
void void RecalcAspects(struct AspectType *a)
RecalcAspects(struct AspectType *a)
{ {
centisec diff,orbis; centisec diff,orbis;
int p1, p2, i; int p1, p2, i;
@ -867,8 +696,7 @@ RecalcAspects(struct AspectType *a)
a->Asp [p2][p1].orb = arp->orb; a->Asp [p2][p1].orb = arp->orb;
} /* for p2 */ } /* for p2 */
} /* for p1 */ } /* for p1 */
} } else { /* interaspects between set 1 and set 2 */
else { /* interaspects between set 1 and set 2 */
for (p1 = 0; p1 < a->NrOfPlanets; p1++) { for (p1 = 0; p1 < a->NrOfPlanets; p1++) {
for (p2 = 0; p2 < a->NrOfPlanets; p2++) { for (p2 = 0; p2 < a->NrOfPlanets; p2++) {
arp = &(a->Asp[p1][p2]); arp = &(a->Asp[p1][p2]);
@ -899,8 +727,7 @@ function sidtime (t): returns sidereal time at greenwich;
Parameters differ from ASYS version! after AESuppl. 1961, page 75 Parameters differ from ASYS version! after AESuppl. 1961, page 75
version 24-oct-87 version 24-oct-87
***********************************************************/ ***********************************************************/
double double sidtime (double jd_ad, double ecl, double nuta)
sidtime(double jd_ad, double ecl, double nuta)
/* jd_ad relative julian date */ /* jd_ad relative julian date */
/* ecl, nuta ecliptic and nutation of date, in degrees */ /* ecl, nuta ecliptic and nutation of date, in degrees */
{ {
@ -908,14 +735,12 @@ sidtime(double jd_ad, double ecl, double nuta)
} }
# ifdef INTEL_BYTE_ORDER # ifdef INTEL_BYTE_ORDER
/********************************************************************/ /********************************************************************/
void void longreorder (UCHAR *p, int n)
longreorder(UCHAR * p, int n)
/* p points to memory filled with int32 values; for /* p points to memory filled with int32 values; for
* each of the values the seqeuence of the four bytes each of the values the seqeuence of the four bytes
* has to be reversed, to translate HP-UX and VAX has to be reversed, to translate HP-UX and VAX
* ordering to MSDOS/Turboc ordering */ ordering to MSDOS/Turboc ordering */
{ {
int i; int i;
unsigned char c0, c1, c2, c3; unsigned char c0, c1, c2, c3;

View File

@ -1,4 +1,3 @@
/************************************************************ /************************************************************
$Header: /home/dieter/sweph/RCS/swepcalc.h,v 1.74 2008/06/16 10:07:20 dieter Exp $ $Header: /home/dieter/sweph/RCS/swepcalc.h,v 1.74 2008/06/16 10:07:20 dieter Exp $
Definitions and constants for Placalc interface to SwissEph Definitions and constants for Placalc interface to SwissEph
@ -106,10 +105,14 @@
extern int nacalc(double jd_ad, centisec *plon, centisec *pspe); extern int nacalc(double jd_ad, centisec *plon, centisec *pspe);
extern int calcserv(int id, double t, int flag, int plalist, char *so); extern int calcserv(int id, double t, int flag, int plalist, char *so);
extern void helup(double jd_ad); extern void helup(double jd_ad);
extern void togeo(double le, double re, double l, double r, double z, extern void togeo(double le, double re, double l, double r, double z, double *alg, double *arg);
double *alg, double *arg); extern int calc(int p,
extern int calc(int p, double jd_ad, int flag, double *alng, double *arad, double jd_ad,
double *alat, double *alngspeed); int flag,
double *alng,
double *arad,
double *alat,
double *alngspeed);
extern int rel_geo(int p, double rau); extern int rel_geo(int p, double rau);
extern int hel( int p, /* planet index as defined by placalc.h */ extern int hel( int p, /* planet index as defined by placalc.h */
double jd_ad, /* relative juliand date, ephemeris time */ double jd_ad, /* relative juliand date, ephemeris time */
@ -133,7 +136,7 @@ extern void placalc_close_files();
extern int fixstar(char *star, double jd, double *lon, double *lat); extern int fixstar(char *star, double jd, double *lon, double *lat);
extern char *placalc_get_errtext(); extern char *placalc_get_errtext();
extern char *placalc_set_ephepath(char *new_path); /* sets ephepath; extern char *placalc_set_ephepath(char *new_path); /* sets ephepath;
* if called with NULL, returns current path */ if called with NULL, returns current path */
/* /*
* because deltat() required a relative Julian date due to historical reasons, * because deltat() required a relative Julian date due to historical reasons,
@ -146,7 +149,6 @@ extern char *placalc_set_ephepath(char *new_path); /* sets ephepath;
* returns -1 if the letter does not correspond to a planet. * returns -1 if the letter does not correspond to a planet.
*/ */
extern int afl2planet(int afl); extern int afl2planet(int afl);
/* /*
* get the AFL letter for a planet * get the AFL letter for a planet
* returns -1 if planet has no letter. * returns -1 if planet has no letter.
@ -169,7 +171,7 @@ extern char *planet2abbr3(int planet);
* planet index numbers, used to identify a planet in calc() and * planet index numbers, used to identify a planet in calc() and
* other related functions. * other related functions.
*/ */
#define CALC_ONLY_ECL_NUT -1 /* pseudo planet index for calls to calc */ #define CALC_ONLY_ECL_NUT (-1) /* pseudo planet index for calls to calc */
#define SUN 0 /* used synonymously for earth too */ #define SUN 0 /* used synonymously for earth too */
#define EARTH 0 #define EARTH 0
#define MOON 1 #define MOON 1
@ -192,6 +194,7 @@ extern char *planet2abbr3(int planet);
#define PALLAS 15 #define PALLAS 15
#define JUNO 16 #define JUNO 16
#define VESTA 17 #define VESTA 17
#define EARTHHEL 18 /* heliocentric earth */
#define MAXPL_NACALC (LILITH) /* nacalc computes SUN..LILITH */ #define MAXPL_NACALC (LILITH) /* nacalc computes SUN..LILITH */
# define PROG_PLANET_OFFSET 50 /* progressed sun */ # define PROG_PLANET_OFFSET 50 /* progressed sun */
@ -213,7 +216,6 @@ extern char *planet2abbr3(int planet);
# define LAST_HSNR 32 # define LAST_HSNR 32
# define NO_OF_HOUSES 12 # define NO_OF_HOUSES 12
#define MAX_PL_INDEX 32 #define MAX_PL_INDEX 32
/* /*
* in a bitlist flag each planet is represented by a bit; * in a bitlist flag each planet is represented by a bit;
* all 14 defined planets can be called at once with * all 14 defined planets can be called at once with
@ -291,7 +293,7 @@ extern char *planet2abbr3(int planet);
*/ */
#ifndef ADATE /* this must be bracketed because users of swepcalc #ifndef ADATE /* this must be bracketed because users of swepcalc
* may also include astrolib.h for other reasons */ may also include astrolib.h for other reasons */
#define ADATE struct adate #define ADATE struct adate
/* makros for bit operations */ /* makros for bit operations */
@ -312,11 +314,10 @@ ADATE { /* date structure used by revjuls and juldays */
*/ */
extern double julday(int month, int day, int year, double hour, int gregflag); extern double julday(int month, int day, int year, double hour, int gregflag);
extern double juldays(int gregflag, ADATE *adp); extern double juldays(int gregflag, ADATE *adp);
extern void revjul(double u, int gregflag, int *jmon, int *jday, int *jyear, extern void revjul (double u, int gregflag,
double *jut); int *jmon, int *jday, int *jyear, double *jut);
extern void revjuls(double u, int gregflag, ADATE *adp); extern void revjuls(double u, int gregflag, ADATE *adp);
extern int day_of_week(double t); extern int day_of_week(double t);
/* /*
* end swpdate.c * end swpdate.c
*/ */
@ -397,34 +398,32 @@ extern int day_of_week(double t);
# define ASP_ANGLES {0, 0*DEG, 180*DEG, 90*DEG, 120*DEG,\ # define ASP_ANGLES {0, 0*DEG, 180*DEG, 90*DEG, 120*DEG,\
60*DEG, 30*DEG, 150*DEG, 45*DEG, 135*DEG, 72*DEG, 144*DEG} 60*DEG, 30*DEG, 150*DEG, 45*DEG, 135*DEG, 72*DEG, 144*DEG}
struct AspectType struct AspectType {
{
AS_BOOL dataValid; /* used as boolean */ AS_BOOL dataValid; /* used as boolean */
int NrOfPlanets, NrOfAspects; int NrOfPlanets,
NrOfAspects;
centisec *PlanetPos; /* pointer to an array of planet positions centisec *PlanetPos; /* pointer to an array of planet positions
* [0..NrOfPlanets-1]; the user of the [0..NrOfPlanets-1]; the user of the
* structure must set this pointer to his structure must set this pointer to his
* array of planet positions */ array of planet positions */
centisec *ppos2; /* second set for mutual aspects only; if centisec *ppos2; /* second set for mutual aspects only; if
* not NULL, interaspects are calculated */ not NULL, interaspects are calculated */
centisec *Maxorb; /* pointer to an array [0..NrOfAspects] of centisec *Maxorb; /* pointer to an array [0..NrOfAspects] of
* maximum orbes; element[0] not used; maximum orbes; element[0] not used;
* the user of the structure must set this the user of the structure must set this
* pointer to his array of maxorbs */ pointer to his array of maxorbs */
centisec *Angle; /* pointer to Angle[0..NrOfAspects] of the centisec *Angle; /* pointer to Angle[0..NrOfAspects] of the
* angles of aspects; [0] not used; the angles of aspects; [0] not used; the
* user must set this pointer to his array user must set this pointer to his array
* of angles */ of angles */
struct aspRec struct aspRec {
{
int index; /* number of the found aspect */ int index; /* number of the found aspect */
centisec orb; centisec orb;
} }
Asp [MAXPLANETS] [MAXPLANETS]; Asp [MAXPLANETS] [MAXPLANETS];
}; };
struct houses struct houses {
{
centisec cusp[13]; centisec cusp[13];
centisec ac; centisec ac;
centisec mc; centisec mc;
@ -432,15 +431,14 @@ struct houses
# define HOUSES struct houses # define HOUSES struct houses
#endif /* ifndef ASP_144 */ #endif /* ifndef ASP_144 */
/********************************** /**********************************
functions exported originally from housasp.c functions exported originally from housasp.c
***********************************/ ***********************************/
extern int HouseNr(HOUSES *h, CSEC p); extern int HouseNr(HOUSES *h, CSEC p);
/* /*
* return in which house pp is, return in which house pp is,
* The caller is responsible for proper initialization of cusps The caller is responsible for proper initialization of cusps
*/ */
extern int InpHouseNr(HOUSES *h, CSEC p, CSEC *cuspoff); extern int InpHouseNr(HOUSES *h, CSEC p, CSEC *cuspoff);

View File

@ -1,11 +1,9 @@
/***************************************************** /*****************************************************
$Header: swepdate.c,v 1.65 2003/06/14 13:02:01 alois Exp $ $Header: swepdate.c,v 1.65 2003/06/14 13:02:01 alois Exp $
Placalc compatibility interface for Swiss Ephemeris. Placalc compatibility interface for Swiss Ephemeris.
date functions date functions
*******************************************************/ *******************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved. /* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions License conditions
@ -131,8 +129,7 @@ date functions
and notifies errors like 32 January. and notifies errors like 32 January.
****************************************************************/ ****************************************************************/
double double julday(int month, int day, int year, double hour, int gregflag)
julday(int month, int day, int year, double hour, int gregflag)
{ {
double jd; double jd;
jd = swe_julday(year, month, day, hour, gregflag); jd = swe_julday(year, month, day, hour, gregflag);
@ -142,8 +139,7 @@ julday(int month, int day, int year, double hour, int gregflag)
/* /*
* monday = 0, ... sunday = 6 * monday = 0, ... sunday = 6
*/ */
int int day_of_week(double jd)
day_of_week(double jd)
{ {
return (((int) floor (jd - 2433282 - 1.5) %7) + 7) % 7; return (((int) floor (jd - 2433282 - 1.5) %7) + 7) % 7;
} }
@ -152,11 +148,9 @@ day_of_week(double jd)
get absolute julian day number (author: Marc Pottenger) get absolute julian day number (author: Marc Pottenger)
with bug fix for year < -4711 15-aug-88 with bug fix for year < -4711 15-aug-88
*/ */
double double juldays(int gregflag, ADATE *adp )
juldays(int gregflag, ADATE * adp)
{ {
return swe_julday(adp->year, adp->month, adp->day, adp->csec / 360000.0, return swe_julday(adp->year, adp->month, adp->day, adp->csec / 360000.0, gregflag);
gregflag);
} }
/*** revjul ****************************************************** /*** revjul ******************************************************
@ -178,8 +172,8 @@ juldays(int gregflag, ADATE * adp)
Original author Mark Pottenger, Los Angeles. Original author Mark Pottenger, Los Angeles.
with bug fix for year < -4711 16-aug-88 Alois Treindl with bug fix for year < -4711 16-aug-88 Alois Treindl
*************************************************************************/ *************************************************************************/
void void revjul (double jd, int gregflag,
revjul(double jd, int gregflag, int *jmon, int *jday, int *jyear, double *jut) int *jmon, int *jday, int *jyear, double *jut)
{ {
swe_revjul(jd, gregflag, jyear, jmon, jday, jut); swe_revjul(jd, gregflag, jyear, jmon, jday, jut);
} }
@ -189,8 +183,7 @@ revjul(double jd, int gregflag, int *jmon, int *jday, int *jyear, double *jut)
with bug fix for year < -4711 16-aug-88 with bug fix for year < -4711 16-aug-88
arguments are julian day #, calendar flag (0=julian, 1=gregorian) arguments are julian day #, calendar flag (0=julian, 1=gregorian)
*/ */
void void revjuls(double jd, int gregflag, struct adate *adp)
revjuls(double jd, int gregflag, struct adate *adp)
{ {
double jut; double jut;
swe_revjul(jd, gregflag, &adp->year, &adp->month, &adp->day, &jut); swe_revjul(jd, gregflag, &adp->year, &adp->month, &adp->day, &jut);
@ -222,8 +215,9 @@ revjuls(double jd, int gregflag, struct adate *adp)
Return: OK or ERR (for illegal date) Return: OK or ERR (for illegal date)
*********************************************************/ *********************************************************/
int int date_conversion (int d ,
date_conversion(int d, int m, int y, /* day, month, year */ int m ,
int y , /* day, month, year */
centisec gutime, /* greenwich time in centiseconds */ centisec gutime, /* greenwich time in centiseconds */
char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */ char c, /* calendar g[regorian]|j[ulian]|a[stro = greg] */
double *tgmt double *tgmt
@ -242,8 +236,7 @@ date_conversion(int d, int m, int y, /* day, month, year */
*tgmt = jd - JUL_OFFSET; *tgmt = jd - JUL_OFFSET;
if (rmon == m && rday == d && ryear == y) { if (rmon == m && rday == d && ryear == y) {
return OK; return OK;
} } else {
else {
return ERR; return ERR;
} }
} /* end date_conversion */ } /* end date_conversion */

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,6 @@
Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich
************************************************************/ ************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved. /* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions License conditions
@ -64,7 +63,7 @@
* move over from swephexp.h * move over from swephexp.h
*/ */
#define SE_VERSION "1.79.00" #define SE_VERSION "2.00.00"
#define J2000 2451545.0 /* 2000 January 1.5 */ #define J2000 2451545.0 /* 2000 January 1.5 */
#define B1950 2433282.42345905 /* 1950 January 0.923 */ #define B1950 2433282.42345905 /* 1950 January 0.923 */
@ -129,10 +128,13 @@
#define SE_TIDAL_DE404 (-25.580) /* was (-25.8) until V. 1.76.2 */ #define SE_TIDAL_DE404 (-25.580) /* was (-25.8) until V. 1.76.2 */
#define SE_TIDAL_DE405 (-25.826) /* was (-25.7376) until V. 1.76.2 */ #define SE_TIDAL_DE405 (-25.826) /* was (-25.7376) until V. 1.76.2 */
#define SE_TIDAL_DE406 (-25.826) /* was (-25.7376) until V. 1.76.2 */ #define SE_TIDAL_DE406 (-25.826) /* was (-25.7376) until V. 1.76.2 */
#define SE_TIDAL_DE421 (-25.85) /* JPL Interoffice Memorandum 14-mar-2008 on DE421 Lunar Orbit */
#define SE_TIDAL_DE430 (-25.82) /* JPL Interoffice Memorandum 9-jul-2013 on DE430 Lunar Orbit */
#define SE_TIDAL_DE431 (-25.82) /* waiting for information */
#define SE_TIDAL_26 (-26.0) #define SE_TIDAL_26 (-26.0)
#define SE_TIDAL_DEFAULT SE_TIDAL_DE406 #define SE_TIDAL_DEFAULT SE_TIDAL_DE431
/* /*
* earlier content * earlier content
@ -227,15 +229,19 @@
#define MOSHPLEPH_END 2818000.5 #define MOSHPLEPH_END 2818000.5
#define MOSHLUEPH_START 625000.5 #define MOSHLUEPH_START 625000.5
#define MOSHLUEPH_END 2818000.5 #define MOSHLUEPH_END 2818000.5
#define MOSHNDEPH_START -254900.5 /* 14 Feb -5410 00:00 ET jul.cal. */ /*#define MOSHNDEPH_START -254900.5 */ /* 14 Feb -5410 00:00 ET jul.cal.*/
#define MOSHNDEPH_END 3697000.5 /* 11 Dec 5409 00:00 ET, greg. cal */ /*#define MOSHNDEPH_END 3697000.5 */ /* 11 Dec 5409 00:00 ET, greg. cal */
#define MOSHNDEPH_START -3100015.5 /* 15 Aug -13200 00:00 ET jul.cal.*/
#define MOSHNDEPH_END 8000016.5 /* 15 Mar 17191 00:00 ET, greg. cal */
/* /*
#define MOSHPLEPH_START -225000.5 #define MOSHPLEPH_START -225000.5
#define MOSHPLEPH_END 3600000.5 #define MOSHPLEPH_END 3600000.5
#define MOSHLUEPH_START -225000.5 #define MOSHLUEPH_START -225000.5
#define MOSHLUEPH_END 3600000.5 #define MOSHLUEPH_END 3600000.5
*/ */
#define JPL_DE431_START -3027215.5
#define JPL_DE431_END 7930192.5
#if FALSE /* Alois commented out, not used anywhere */ #if FALSE /* Alois commented out, not used anywhere */
#define JPLEPH_START 625307.5 /* about -3000 (DE406) */ #define JPLEPH_START 625307.5 /* about -3000 (DE406) */
#define JPLEPH_END 2816848.5 /* about 3000 (DE406) */ #define JPLEPH_END 2816848.5 /* about 3000 (DE406) */
@ -263,7 +269,6 @@
#define MOON_MEAN_DIST 384400000.0 /* in m, AA 1996, F2 */ #define MOON_MEAN_DIST 384400000.0 /* in m, AA 1996, F2 */
#define MOON_MEAN_INCL 5.1453964 /* AA 1996, D2 */ #define MOON_MEAN_INCL 5.1453964 /* AA 1996, D2 */
#define MOON_MEAN_ECC 0.054900489 /* AA 1996, F2 */ #define MOON_MEAN_ECC 0.054900489 /* AA 1996, F2 */
/* #define SUN_EARTH_MRAT 328900.561400 Su/(Ea+Mo) AA 2006 K7 */ /* #define SUN_EARTH_MRAT 328900.561400 Su/(Ea+Mo) AA 2006 K7 */
#define SUN_EARTH_MRAT 332946.050895 /* Su / (Ea only) AA 2006 K7 */ #define SUN_EARTH_MRAT 332946.050895 /* Su / (Ea only) AA 2006 K7 */
#define EARTH_MOON_MRAT (1 / 0.0123000383) /* AA 2006, K7 */ #define EARTH_MOON_MRAT (1 / 0.0123000383) /* AA 2006, K7 */
@ -280,7 +285,6 @@
#define KGAUSS 0.01720209895 /* Gaussian gravitational constant K6 */ #define KGAUSS 0.01720209895 /* Gaussian gravitational constant K6 */
#define SUN_RADIUS (959.63 / 3600 * DEGTORAD) /* Meeus germ. p 391 */ #define SUN_RADIUS (959.63 / 3600 * DEGTORAD) /* Meeus germ. p 391 */
#define EARTH_RADIUS 6378136.6 /* AA 2006 K6 */ #define EARTH_RADIUS 6378136.6 /* AA 2006 K6 */
/*#define EARTH_OBLATENESS (1.0/ 298.257223563) * AA 1998 K13 */ /*#define EARTH_OBLATENESS (1.0/ 298.257223563) * AA 1998 K13 */
#define EARTH_OBLATENESS (1.0/ 298.25642) /* AA 2006 K6 */ #define EARTH_OBLATENESS (1.0/ 298.25642) /* AA 2006 K6 */
#define EARTH_ROT_SPEED (7.2921151467e-5 * 86400) /* in rad/day, expl. suppl., p 162 */ #define EARTH_ROT_SPEED (7.2921151467e-5 * 86400) /* in rad/day, expl. suppl., p 162 */
@ -289,10 +293,8 @@
/* node of ecliptic measured on ecliptic 2000 */ /* node of ecliptic measured on ecliptic 2000 */
#define SSY_PLANE_NODE_E2000 (107.582569 * DEGTORAD) #define SSY_PLANE_NODE_E2000 (107.582569 * DEGTORAD)
/* node of ecliptic measured on solar system rotation plane */ /* node of ecliptic measured on solar system rotation plane */
#define SSY_PLANE_NODE (107.58883388 * DEGTORAD) #define SSY_PLANE_NODE (107.58883388 * DEGTORAD)
/* inclination of ecliptic against solar system rotation plane */ /* inclination of ecliptic against solar system rotation plane */
#define SSY_PLANE_INCL (1.578701 * DEGTORAD) #define SSY_PLANE_INCL (1.578701 * DEGTORAD)
@ -340,10 +342,7 @@ static const double pla_diam[NDIAM] = { 1392000000.0, /* Sun */
* t0 epoch of ayanamsa, TDT (ET) * t0 epoch of ayanamsa, TDT (ET)
* ayan_t0 ayanamsa value at epoch * ayan_t0 ayanamsa value at epoch
*/ */
struct aya_init struct aya_init {double t0, ayan_t0;};
{
double t0, ayan_t0;
};
static const struct aya_init ayanamsa[] = { static const struct aya_init ayanamsa[] = {
{2433282.5, 24.042044444}, /* 0: Fagan/Bradley (Default) */ {2433282.5, 24.042044444}, /* 0: Fagan/Bradley (Default) */
/*{J1900, 360 - 337.53953}, * 1: Lahiri (Robert Hand) */ /*{J1900, 360 - 337.53953}, * 1: Lahiri (Robert Hand) */
@ -373,28 +372,28 @@ static const struct aya_init ayanamsa[] = {
{J1900, 0}, /*19: J1900 */ {J1900, 0}, /*19: J1900 */
{B1950, 0}, /*20: B1950 */ {B1950, 0}, /*20: B1950 */
{1903396.8128654, 0}, /*21: Suryasiddhanta, assuming {1903396.8128654, 0}, /*21: Suryasiddhanta, assuming
* ingress of mean Sun into Aries at point ingress of mean Sun into Aries at point
* of mean equinox of date on of mean equinox of date on
* 21.3.499, noon, Ujjain (75.7684565 E) 21.3.499, noon, Ujjain (75.7684565 E)
* = 7:30:31.57 UT */ = 7:30:31.57 UT */
{1903396.8128654,-0.21463395},/*22: Suryasiddhanta, assuming {1903396.8128654,-0.21463395},/*22: Suryasiddhanta, assuming
* ingress of mean Sun into Aries at ingress of mean Sun into Aries at
* true position of mean Sun at same epoch */ true position of mean Sun at same epoch */
{1903396.7895321, 0}, /*23: Aryabhata, same date, but UT 6:56:55.57 {1903396.7895321, 0}, /*23: Aryabhata, same date, but UT 6:56:55.57
* analogous 21 */ analogous 21 */
{1903396.7895321,-0.23763238},/*24: Aryabhata, analogous 22 */ {1903396.7895321,-0.23763238},/*24: Aryabhata, analogous 22 */
{0, 0}, /*25: - */ {1903396.8128654,-0.79167046},/*25: SS, Revati/zePsc at polar long. 359°50'*/
{0, 0}, /*26: - */ {1903396.8128654, 2.11070444},/*26: SS, Citra/Spica at polar long. 180° */
{0, 0}, /*27: - */ {0, 0}, /*27: True Citra (Spica always exactly at 0 Libra) */
{0, 0}, /*28: - */ {0, 0}, /*28: True Revati (zeta Psc always exactly at 0 Aries) */
{0, 0}, /*29: - */ {0, 0}, /*29: - */
{0, 0}, /*30: - */
}; };
#define PLAN_DATA struct plan_data #define PLAN_DATA struct plan_data
/* obliquity of ecliptic */ /* obliquity of ecliptic */
struct epsilon struct epsilon {
{
double teps, eps, seps, ceps; /* jd, eps, sin(eps), cos(eps) */ double teps, eps, seps, ceps; /* jd, eps, sin(eps), cos(eps) */
}; };
@ -403,8 +402,7 @@ extern struct epsilon oec2000;
extern struct epsilon oec; extern struct epsilon oec;
*/ */
struct plan_data struct plan_data {
{
/* the following data are read from file only once, immediately after /* the following data are read from file only once, immediately after
* file has been opened */ * file has been opened */
int ibdy; /* internal body number */ int ibdy; /* internal body number */
@ -414,7 +412,7 @@ struct plan_data
* to coordinate system of orbital plane * to coordinate system of orbital plane
* SEI_FLG_ELLIPSE: TRUE if reference ellipse */ * SEI_FLG_ELLIPSE: TRUE if reference ellipse */
int ncoe; /* # of coefficients of ephemeris polynomial, int ncoe; /* # of coefficients of ephemeris polynomial,
* is polynomial order + 1 */ is polynomial order + 1 */
/* where is the segment index on the file */ /* where is the segment index on the file */
int32 lndx0; /* file position of begin of planet's index */ int32 lndx0; /* file position of begin of planet's index */
int32 nndx; /* number of index entries on file: computed */ int32 nndx; /* number of index entries on file: computed */
@ -467,24 +465,20 @@ extern int swi_moshmoon2(double jd, double *x);
extern int swi_intp_apsides(double J, double *pol, int ipli); extern int swi_intp_apsides(double J, double *pol, int ipli);
/* planets, s. moshplan.c */ /* planets, s. moshplan.c */
extern int swi_moshplan(double tjd, int ipli, AS_BOOL do_save, double *xpret, extern int swi_moshplan(double tjd, int ipli, AS_BOOL do_save, double *xpret, double *xeret, char *serr);
double *xeret, char *serr);
extern int swi_moshplan2(double J, int iplm, double *pobj); extern int swi_moshplan2(double J, int iplm, double *pobj);
extern int swi_osc_el_plan(double tjd, double *xp, int ipl, int ipli, extern int swi_osc_el_plan(double tjd, double *xp, int ipl, int ipli, double *xearth, double *xsun, char *serr);
double *xearth, double *xsun, char *serr);
extern FILE *swi_fopen(int ifno, char *fname, char *ephepath, char *serr); extern FILE *swi_fopen(int ifno, char *fname, char *ephepath, char *serr);
/* nutation */ /* nutation */
struct nut struct nut {
{
double tnut; double tnut;
double nutlo[2]; /* nutation in longitude and obliquity */ double nutlo[2]; /* nutation in longitude and obliquity */
double snut, cnut; /* sine and cosine of nutation in obliquity */ double snut, cnut; /* sine and cosine of nutation in obliquity */
double matrix[3][3]; double matrix[3][3];
}; };
struct plantbl struct plantbl {
{
char max_harmonic[9]; char max_harmonic[9];
char max_power_of_t; char max_power_of_t;
signed char *arg_tbl; signed char *arg_tbl;
@ -494,8 +488,7 @@ struct plantbl
double distance; double distance;
}; };
struct file_data struct file_data {
{
char fnam[AS_MAXCH]; /* ephemeris file name */ char fnam[AS_MAXCH]; /* ephemeris file name */
int fversion; /* version number of file */ int fversion; /* version number of file */
char astnam[50]; /* asteroid name, if asteroid file */ char astnam[50]; /* asteroid name, if asteroid file */
@ -509,13 +502,15 @@ struct file_data
int ipl[SEI_FILE_NMAXPLAN]; /* planet numbers */ int ipl[SEI_FILE_NMAXPLAN]; /* planet numbers */
}; };
struct gen_const struct gen_const {
{ double clight,
double clight, aunit, helgravconst, ratme, sunradius; aunit,
helgravconst,
ratme,
sunradius;
}; };
struct save_positions struct save_positions {
{
int ipl; int ipl;
double tsave; double tsave;
int32 iflgsave; int32 iflgsave;
@ -529,8 +524,7 @@ struct save_positions
double xsaves[24]; double xsaves[24];
}; };
struct node_data struct node_data {
{
/* result of most recent data evaluation for this body: */ /* result of most recent data evaluation for this body: */
double teval; /* time for which last computation was made */ double teval; /* time for which last computation was made */
int32 iephe; /* which ephemeris was used */ int32 iephe; /* which ephemeris was used */
@ -544,29 +538,31 @@ struct node_data
*/ */
}; };
struct topo_data struct topo_data {
{
double geolon, geolat, geoalt; double geolon, geolat, geoalt;
double teval; double teval;
double tjd_ut; double tjd_ut;
double xobs[6]; double xobs[6];
}; };
struct sid_data struct sid_data {
{
int32 sid_mode; int32 sid_mode;
double ayan_t0; double ayan_t0;
double t0; double t0;
}; };
struct swe_data struct swe_data {
{
AS_BOOL ephe_path_is_set; AS_BOOL ephe_path_is_set;
short jpl_file_is_open; short jpl_file_is_open;
FILE *fixfp; /* fixed stars file pointer */ FILE *fixfp; /* fixed stars file pointer */
char ephepath[AS_MAXCH]; char ephepath[AS_MAXCH];
char jplfnam[AS_MAXCH]; char jplfnam[AS_MAXCH];
short jpldenum; short jpldenum;
double eop_tjd_beg;
double eop_tjd_beg_horizons;
double eop_tjd_end;
double eop_tjd_end_add;
int eop_dpsi_loaded;
AS_BOOL geopos_is_set; AS_BOOL geopos_is_set;
AS_BOOL ayana_is_set; AS_BOOL ayana_is_set;
AS_BOOL is_old_starfile; AS_BOOL is_old_starfile;
@ -592,6 +588,8 @@ struct swe_data
double ast_diam; double ast_diam;
int i_saved_planet_name; int i_saved_planet_name;
char saved_planet_name[80]; char saved_planet_name[80];
double dpsi[36525]; /* works for 100 years after 1962 */
double deps[36525];
}; };
extern struct swe_data FAR swed; extern struct swe_data FAR swed;

View File

@ -1,4 +1,3 @@
/************************************************************ /************************************************************
$Header: /home/dieter/sweph/RCS/swephexp.h,v 1.75 2009/04/08 07:19:08 dieter Exp $ $Header: /home/dieter/sweph/RCS/swephexp.h,v 1.75 2009/04/08 07:19:08 dieter Exp $
SWISSEPH: exported definitions and constants SWISSEPH: exported definitions and constants
@ -20,7 +19,6 @@
Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich
************************************************************/ ************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved. /* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions License conditions
@ -76,8 +74,7 @@
*/ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C" {
{
#endif #endif
#ifndef _SWEPHEXP_INCLUDED /* allow multiple #includes of swephexp.h */ #ifndef _SWEPHEXP_INCLUDED /* allow multiple #includes of swephexp.h */
@ -145,7 +142,6 @@ extern "C"
#define SE_ADMETOS 45 #define SE_ADMETOS 45
#define SE_VULKANUS 46 #define SE_VULKANUS 46
#define SE_POSEIDON 47 #define SE_POSEIDON 47
/* other fictitious bodies */ /* other fictitious bodies */
#define SE_ISIS 48 #define SE_ISIS 48
#define SE_NIBIRU 49 #define SE_NIBIRU 49
@ -192,7 +188,7 @@ extern "C"
#define SEFLG_J2000 32 /* no precession, i.e. give J2000 equinox */ #define SEFLG_J2000 32 /* no precession, i.e. give J2000 equinox */
#define SEFLG_NONUT 64 /* no nutation, i.e. mean equinox of date */ #define SEFLG_NONUT 64 /* no nutation, i.e. mean equinox of date */
#define SEFLG_SPEED3 128 /* speed from 3 positions (do not use it, #define SEFLG_SPEED3 128 /* speed from 3 positions (do not use it,
* SEFLG_SPEED is faster and more precise.) */ SEFLG_SPEED is faster and more precise.) */
#define SEFLG_SPEED 256 /* high precision speed */ #define SEFLG_SPEED 256 /* high precision speed */
#define SEFLG_NOGDEFL 512 /* turn off gravitational deflection */ #define SEFLG_NOGDEFL 512 /* turn off gravitational deflection */
#define SEFLG_NOABERR 1024 /* turn off 'annual' aberration of light */ #define SEFLG_NOABERR 1024 /* turn off 'annual' aberration of light */
@ -203,12 +199,14 @@ extern "C"
#define SEFLG_TOPOCTR (32*1024) /* topocentric positions */ #define SEFLG_TOPOCTR (32*1024) /* topocentric positions */
#define SEFLG_SIDEREAL (64*1024) /* sidereal positions */ #define SEFLG_SIDEREAL (64*1024) /* sidereal positions */
#define SEFLG_ICRS (128*1024) /* ICRS (DE406 reference frame) */ #define SEFLG_ICRS (128*1024) /* ICRS (DE406 reference frame) */
#define SEFLG_DPSIDEPS_1980 (256*1024) /* reproduce JPL Horizons
* 1962 - today to 0.002 arcsec. */
#define SEFLG_JPLHOR SEFLG_DPSIDEPS_1980
#define SEFLG_JPLHOR_APPROX (512*1024) /* approximate JPL Horizons 1962 - today */
#define SE_SIDBITS 256 #define SE_SIDBITS 256
/* for projection onto ecliptic of t0 */ /* for projection onto ecliptic of t0 */
#define SE_SIDBIT_ECL_T0 256 #define SE_SIDBIT_ECL_T0 256
/* for projection onto solar system plane */ /* for projection onto solar system plane */
#define SE_SIDBIT_SSY_PLANE 512 #define SE_SIDBIT_SSY_PLANE 512
@ -238,9 +236,13 @@ extern "C"
#define SE_SIDM_SURYASIDDHANTA_MSUN 22 #define SE_SIDM_SURYASIDDHANTA_MSUN 22
#define SE_SIDM_ARYABHATA 23 #define SE_SIDM_ARYABHATA 23
#define SE_SIDM_ARYABHATA_MSUN 24 #define SE_SIDM_ARYABHATA_MSUN 24
#define SE_SIDM_SS_REVATI 25
#define SE_SIDM_SS_CITRA 26
#define SE_SIDM_TRUE_CITRA 27
#define SE_SIDM_TRUE_REVATI 28
#define SE_SIDM_USER 255 #define SE_SIDM_USER 255
#define SE_NSIDM_PREDEF 27 #define SE_NSIDM_PREDEF 29
/* used for swe_nod_aps(): */ /* used for swe_nod_aps(): */
#define SE_NODBIT_MEAN 1 /* mean nodes/apsides */ #define SE_NODBIT_MEAN 1 /* mean nodes/apsides */
@ -270,10 +272,18 @@ extern "C"
#define SE_ECL_ALLTYPES_LUNAR (SE_ECL_TOTAL|SE_ECL_PARTIAL|SE_ECL_PENUMBRAL) #define SE_ECL_ALLTYPES_LUNAR (SE_ECL_TOTAL|SE_ECL_PARTIAL|SE_ECL_PENUMBRAL)
#define SE_ECL_VISIBLE 128 #define SE_ECL_VISIBLE 128
#define SE_ECL_MAX_VISIBLE 256 #define SE_ECL_MAX_VISIBLE 256
#define SE_ECL_1ST_VISIBLE 512 #define SE_ECL_1ST_VISIBLE 512 /* begin of partial eclipse */
#define SE_ECL_2ND_VISIBLE 1024 #define SE_ECL_PARTBEG_VISIBLE 512 /* begin of partial eclipse */
#define SE_ECL_3RD_VISIBLE 2048 #define SE_ECL_2ND_VISIBLE 1024 /* begin of total eclipse */
#define SE_ECL_4TH_VISIBLE 4096 #define SE_ECL_TOTBEG_VISIBLE 1024 /* begin of total eclipse */
#define SE_ECL_3RD_VISIBLE 2048 /* end of total eclipse */
#define SE_ECL_TOTEND_VISIBLE 2048 /* end of total eclipse */
#define SE_ECL_4TH_VISIBLE 4096 /* end of partial eclipse */
#define SE_ECL_PARTEND_VISIBLE 4096 /* end of partial eclipse */
#define SE_ECL_PENUMBBEG_VISIBLE 8192 /* begin of penumbral eclipse */
#define SE_ECL_PENUMBEND_VISIBLE 16384 /* end of penumbral eclipse */
#define SE_ECL_OCC_BEG_DAYLIGHT 8192 /* occultation begins during the day */
#define SE_ECL_OCC_END_DAYLIGHT 16384 /* occultation ends during the day */
#define SE_ECL_ONE_TRY (32*1024) #define SE_ECL_ONE_TRY (32*1024)
/* check if the next conjunction of the moon with /* check if the next conjunction of the moon with
* a planet is an occultation; don't search further */ * a planet is an occultation; don't search further */
@ -313,13 +323,15 @@ extern "C"
* only used for experimenting with various JPL ephemeris files * only used for experimenting with various JPL ephemeris files
* which are available at Astrodienst's internal network * which are available at Astrodienst's internal network
*/ */
#define SE_DE_NUMBER 406 #define SE_DE_NUMBER 431
#define SE_FNAME_DE200 "de200.eph" #define SE_FNAME_DE200 "de200.eph"
#define SE_FNAME_DE403 "de403.eph" #define SE_FNAME_DE403 "de403.eph"
#define SE_FNAME_DE404 "de404.eph" #define SE_FNAME_DE404 "de404.eph"
#define SE_FNAME_DE405 "de405.eph" #define SE_FNAME_DE405 "de405.eph"
#define SE_FNAME_DE406 "de406.eph" #define SE_FNAME_DE406 "de406.eph"
#define SE_FNAME_DFT SE_FNAME_DE406 #define SE_FNAME_DE431 "de431.eph"
#define SE_FNAME_DFT SE_FNAME_DE431
#define SE_FNAME_DFT2 SE_FNAME_DE406
#define SE_STARFILE_OLD "fixstars.cat" #define SE_STARFILE_OLD "fixstars.cat"
#define SE_STARFILE "sefstars.txt" #define SE_STARFILE "sefstars.txt"
#define SE_ASTNAMFILE "seasnam.txt" #define SE_ASTNAMFILE "seasnam.txt"
@ -346,9 +358,9 @@ extern "C"
# else # else
# define SE_EPHE_PATH ".:/users/ephe2/:/users/ephe/" # define SE_EPHE_PATH ".:/users/ephe2/:/users/ephe/"
/* At Astrodienst, we maintain two ephemeris areas for /* At Astrodienst, we maintain two ephemeris areas for
* the thousands of asteroid files: the thousands of asteroid files:
* the short files in /users/ephe/ast*, the short files in /users/ephe/ast*,
* the long file in /users/ephe2/ast*. */ the long file in /users/ephe2/ast*. */
# endif # endif
#endif #endif
#endif /* SE_EPHE_PATH */ #endif /* SE_EPHE_PATH */
@ -384,6 +396,7 @@ extern "C"
#define SE_HELFLAG_VISLIM_DARK (1 << 12) /* 4096 */ #define SE_HELFLAG_VISLIM_DARK (1 << 12) /* 4096 */
#define SE_HELFLAG_VISLIM_NOMOON (1 << 13) /* 8192 */ #define SE_HELFLAG_VISLIM_NOMOON (1 << 13) /* 8192 */
#define SE_HELFLAG_VISLIM_PHOTOPIC (1 << 14) /* 16384 */ #define SE_HELFLAG_VISLIM_PHOTOPIC (1 << 14) /* 16384 */
#define SE_HELFLAG_AV (1 << 15) /* 32768 */
#define SE_HELFLAG_AVKIND_VR (1 << 15) /* 32768 */ #define SE_HELFLAG_AVKIND_VR (1 << 15) /* 32768 */
#define SE_HELFLAG_AVKIND_PTO (1 << 16) #define SE_HELFLAG_AVKIND_PTO (1 << 16)
#define SE_HELFLAG_AVKIND_MIN7 (1 << 17) #define SE_HELFLAG_AVKIND_MIN7 (1 << 17)
@ -472,12 +485,12 @@ extern "C"
#endif #endif
#ifdef MAKE_DLL16 /* 16bit DLL */ #ifdef MAKE_DLL16 /* 16bit DLL */
/* We compiled the 16bit DLL for Windows 3.x using Borland C/C++ Ver:3.x /* We compiled the 16bit DLL for Windows 3.x using Borland C/C++ Ver:3.x
* and the -WD or -WDE compiler switch. */ and the -WD or -WDE compiler switch. */
#define EXP16 __export #define EXP16 __export
#define EXP32 #define EXP32
#else /* 32bit DLL */ #else /* 32bit DLL */
/* To export symbols in the new DLL model of Win32, Microsoft /* To export symbols in the new DLL model of Win32, Microsoft
* recommends the following approach */ recommends the following approach */
#define EXP16 #define EXP16
#define EXP32 __declspec( dllexport ) #define EXP32 __declspec( dllexport )
#endif #endif
@ -496,34 +509,12 @@ extern "C"
#define ext_def(x) extern EXP32 x FAR PASCAL_CONV EXP16 #define ext_def(x) extern EXP32 x FAR PASCAL_CONV EXP16
/* ext_def(x) evaluates to x on Unix */ /* ext_def(x) evaluates to x on Unix */
ext_def(int32) swe_heliacal_ut(double tjdstart_ut, double *geopos, ext_def(int32) swe_heliacal_ut(double tjdstart_ut, double *geopos, double *datm, double *dobs, char *ObjectName, int32 TypeEvent, int32 iflag, double *dret, char *serr);
double *datm, double *dobs, ext_def(int32) swe_heliacal_pheno_ut(double tjd_ut, double *geopos, double *datm, double *dobs, char *ObjectName, int32 TypeEvent, int32 helflag, double *darr, char *serr);
char *ObjectName, int32 TypeEvent, ext_def(int32) swe_vis_limit_mag(double tjdut, double *geopos, double *datm, double *dobs, char *ObjectName, int32 helflag, double *dret, char *serr);
int32 iflag, double *dret, char *serr);
ext_def(int32) swe_heliacal_pheno_ut(double tjd_ut, double *geopos,
double *datm, double *dobs,
char *ObjectName, int32 TypeEvent,
int32 helflag, double *darr,
char *serr);
ext_def(int32) swe_vis_limit_mag(double tjdut, double *geopos,
double *datm, double *dobs,
char *ObjectName, int32 helflag,
double *dret, char *serr);
/* the following are secret, for Victor Reijs' */ /* the following are secret, for Victor Reijs' */
ext_def(int32) swe_heliacal_angle(double tjdut, double *dgeo, ext_def(int32) swe_heliacal_angle(double tjdut, double *dgeo, double *datm, double *dobs, int32 helflag, double mag, double azi_obj, double azi_sun, double azi_moon, double alt_moon, double *dret, char *serr);
double *datm, double *dobs, ext_def(int32) swe_topo_arcus_visionis(double tjdut, double *dgeo, double *datm, double *dobs, int32 helflag, double mag, double azi_obj, double alt_obj, double azi_sun, double azi_moon, double alt_moon, double *dret, char *serr);
int32 helflag, double mag,
double azi_obj, double azi_sun,
double azi_moon, double alt_moon,
double *dret, char *serr);
ext_def(int32) swe_topo_arcus_visionis(double tjdut, double *dgeo,
double *datm, double *dobs,
int32 helflag, double mag,
double azi_obj, double alt_obj,
double azi_sun, double azi_moon,
double alt_moon, double *dret,
char *serr);
/**************************** /****************************
* exports from sweph.c * exports from sweph.c
@ -532,15 +523,19 @@ extern "C"
ext_def(char *) swe_version(char *); ext_def(char *) swe_version(char *);
/* planets, moon, nodes etc. */ /* planets, moon, nodes etc. */
ext_def(int32) swe_calc(double tjd, int ipl, int32 iflag, double *xx, ext_def( int32 ) swe_calc(
double tjd, int ipl, int32 iflag,
double *xx,
char *serr); char *serr);
ext_def(int32) swe_calc_ut(double tjd_ut, int32 ipl, int32 iflag, ext_def(int32) swe_calc_ut(double tjd_ut, int32 ipl, int32 iflag,
double *xx, char *serr); double *xx, char *serr);
/* fixed stars */ /* fixed stars */
ext_def(int32) swe_fixstar(char *star, double tjd, int32 iflag, ext_def( int32 ) swe_fixstar(
double *xx, char *serr); char *star, double tjd, int32 iflag,
double *xx,
char *serr);
ext_def(int32) swe_fixstar_ut(char *star, double tjd_ut, int32 iflag, ext_def(int32) swe_fixstar_ut(char *star, double tjd_ut, int32 iflag,
double *xx, char *serr); double *xx, char *serr);
@ -563,8 +558,7 @@ extern "C"
ext_def (void) swe_set_topo(double geolon, double geolat, double geoalt); ext_def (void) swe_set_topo(double geolon, double geolat, double geoalt);
/* set sidereal mode */ /* set sidereal mode */
ext_def(void) swe_set_sid_mode(int32 sid_mode, double t0, ext_def(void) swe_set_sid_mode(int32 sid_mode, double t0, double ayan_t0);
double ayan_t0);
/* get ayanamsa */ /* get ayanamsa */
ext_def(double) swe_get_ayanamsa(double tjd_et); ext_def(double) swe_get_ayanamsa(double tjd_et);
@ -577,157 +571,164 @@ extern "C"
* exports from swedate.c * exports from swedate.c
****************************/ ****************************/
ext_def(int) swe_date_conversion(int y, int m, int d, /* year, month, day */ ext_def( int ) swe_date_conversion(
int y , int m , int d , /* year, month, day */
double utime, /* universal time in hours (decimal) */ double utime, /* universal time in hours (decimal) */
char c, /* calendar g[regorian]|j[ulian] */ char c, /* calendar g[regorian]|j[ulian] */
double *tjd); double *tjd);
ext_def(double) swe_julday(int year, int month, int day, double hour, ext_def( double ) swe_julday(
int year, int month, int day, double hour,
int gregflag); int gregflag);
ext_def(void) swe_revjul(double jd, int gregflag, int *jyear, int *jmon, ext_def( void ) swe_revjul (
int *jday, double *jut); double jd,
int gregflag,
int *jyear, int *jmon, int *jday, double *jut);
ext_def(int32) swe_utc_to_jd(int32 iyear, int32 imonth, int32 iday, ext_def(int32) swe_utc_to_jd(
int32 iyear, int32 imonth, int32 iday,
int32 ihour, int32 imin, double dsec, int32 ihour, int32 imin, double dsec,
int32 gregflag, double *dret, char *serr); int32 gregflag, double *dret, char *serr);
ext_def(void) swe_jdet_to_utc(double tjd_et, int32 gregflag, ext_def(void) swe_jdet_to_utc(
int32 * iyear, int32 * imonth, double tjd_et, int32 gregflag,
int32 * iday, int32 * ihour, int32 * imin, int32 *iyear, int32 *imonth, int32 *iday,
double *dsec); int32 *ihour, int32 *imin, double *dsec);
ext_def(void) swe_jdut1_to_utc(double tjd_ut, int32 gregflag, ext_def(void) swe_jdut1_to_utc(
int32 * iyear, int32 * imonth, double tjd_ut, int32 gregflag,
int32 * iday, int32 * ihour, int32 *iyear, int32 *imonth, int32 *iday,
int32 * imin, double *dsec); int32 *ihour, int32 *imin, double *dsec);
ext_def(void) swe_utc_time_zone(int32 iyear, int32 imonth, int32 iday, ext_def(void) swe_utc_time_zone(
int32 iyear, int32 imonth, int32 iday,
int32 ihour, int32 imin, double dsec, int32 ihour, int32 imin, double dsec,
double d_timezone, int32 * iyear_out, double d_timezone,
int32 * imonth_out, int32 * iday_out, int32 *iyear_out, int32 *imonth_out, int32 *iday_out,
int32 * ihour_out, int32 * imin_out, int32 *ihour_out, int32 *imin_out, double *dsec_out);
double *dsec_out);
/**************************** /****************************
* exports from swehouse.c * exports from swehouse.c
****************************/ ****************************/
ext_def(int) swe_houses(double tjd_ut, double geolat, double geolon, ext_def( int ) swe_houses(
int hsys, double *cusps, double *ascmc); double tjd_ut, double geolat, double geolon, int hsys,
double *cusps, double *ascmc);
ext_def(int) swe_houses_ex(double tjd_ut, int32 iflag, double geolat, ext_def( int ) swe_houses_ex(
double geolon, int hsys, double *cusps, double tjd_ut, int32 iflag, double geolat, double geolon, int hsys,
double *ascmc); double *cusps, double *ascmc);
ext_def( int ) swe_houses_armc(
double armc, double geolat, double eps, int hsys,
double *cusps, double *ascmc);
ext_def(double) swe_house_pos(
double armc, double geolat, double eps, int hsys, double *xpin, char *serr);
ext_def(char *) swe_house_name(int hsys);
ext_def(int) swe_houses_armc(double armc, double geolat, double eps,
int hsys, double *cusps, double *ascmc);
ext_def(double) swe_house_pos(double armc, double geolat, double eps,
int hsys, double *xpin, char *serr);
/**************************** /****************************
* exports from swecl.c * exports from swecl.c
****************************/ ****************************/
ext_def(int32) swe_gauquelin_sector(double t_ut, int32 ipl, ext_def(int32) swe_gauquelin_sector(double t_ut, int32 ipl, char *starname, int32 iflag, int32 imeth, double *geopos, double atpress, double attemp, double *dgsect, char *serr);
char *starname, int32 iflag,
int32 imeth, double *geopos,
double atpress, double attemp,
double *dgsect, char *serr);
/* computes geographic location and attributes of solar /* computes geographic location and attributes of solar
* eclipse at a given tjd */ * eclipse at a given tjd */
ext_def(int32) swe_sol_eclipse_where(double tjd, int32 ifl, ext_def (int32) swe_sol_eclipse_where(double tjd, int32 ifl, double *geopos, double *attr, char *serr);
double *geopos, double *attr,
char *serr);
ext_def(int32) swe_lun_occult_where(double tjd, int32 ipl, ext_def (int32) swe_lun_occult_where(double tjd, int32 ipl, char *starname, int32 ifl, double *geopos, double *attr, char *serr);
char *starname, int32 ifl,
double *geopos, double *attr,
char *serr);
/* computes attributes of a solar eclipse for given tjd, geolon, geolat */ /* computes attributes of a solar eclipse for given tjd, geolon, geolat */
ext_def(int32) swe_sol_eclipse_how(double tjd, int32 ifl, ext_def (int32) swe_sol_eclipse_how(double tjd, int32 ifl, double *geopos, double *attr, char *serr);
double *geopos, double *attr,
char *serr);
/* finds time of next local eclipse */ /* finds time of next local eclipse */
ext_def(int32) swe_sol_eclipse_when_loc(double tjd_start, int32 ifl, ext_def (int32) swe_sol_eclipse_when_loc(double tjd_start, int32 ifl, double *geopos, double *tret, double *attr, int32 backward, char *serr);
double *geopos, double *tret,
double *attr, int32 backward,
char *serr);
ext_def(int32) swe_lun_occult_when_loc(double tjd_start, int32 ipl, ext_def (int32) swe_lun_occult_when_loc(double tjd_start, int32 ipl, char *starname, int32 ifl,
char *starname, int32 ifl, double *geopos, double *tret, double *attr, int32 backward, char *serr);
double *geopos, double *tret,
double *attr, int32 backward,
char *serr);
/* finds time of next eclipse globally */ /* finds time of next eclipse globally */
ext_def(int32) swe_sol_eclipse_when_glob(double tjd_start, int32 ifl, ext_def (int32) swe_sol_eclipse_when_glob(double tjd_start, int32 ifl, int32 ifltype,
int32 ifltype, double *tret, double *tret, int32 backward, char *serr);
int32 backward, char *serr);
/* finds time of next occultation globally */ /* finds time of next occultation globally */
ext_def(int32) swe_lun_occult_when_glob(double tjd_start, int32 ipl, ext_def (int32) swe_lun_occult_when_glob(double tjd_start, int32 ipl, char *starname, int32 ifl, int32 ifltype,
char *starname, int32 ifl, double *tret, int32 backward, char *serr);
int32 ifltype, double *tret,
int32 backward, char *serr);
/* computes attributes of a lunar eclipse for given tjd */ /* computes attributes of a lunar eclipse for given tjd */
ext_def(int32) swe_lun_eclipse_how(double tjd_ut, int32 ifl, ext_def (int32) swe_lun_eclipse_how(
double *geopos, double *attr, double tjd_ut,
int32 ifl,
double *geopos,
double *attr,
char *serr); char *serr);
ext_def(int32) swe_lun_eclipse_when(double tjd_start, int32 ifl, ext_def (int32) swe_lun_eclipse_when(double tjd_start, int32 ifl, int32 ifltype,
int32 ifltype, double *tret, double *tret, int32 backward, char *serr);
int32 backward, char *serr);
ext_def (int32) swe_lun_eclipse_when_loc(double tjd_start, int32 ifl,
double *geopos, double *tret, double *attr, int32 backward, char *serr);
/* planetary phenomena */ /* planetary phenomena */
ext_def(int32) swe_pheno(double tjd, int32 ipl, int32 iflag, ext_def (int32) swe_pheno(double tjd, int32 ipl, int32 iflag, double *attr, char *serr);
double *attr, char *serr);
ext_def(int32) swe_pheno_ut(double tjd_ut, int32 ipl, int32 iflag, ext_def(int32) swe_pheno_ut(double tjd_ut, int32 ipl, int32 iflag, double *attr, char *serr);
double *attr, char *serr);
ext_def(double) swe_refrac(double inalt, double atpress, double attemp, ext_def (double) swe_refrac(double inalt, double atpress, double attemp, int32 calc_flag);
int32 calc_flag);
ext_def(double) swe_refrac_extended(double inalt, double geoalt, ext_def (double) swe_refrac_extended(double inalt, double geoalt, double atpress, double attemp, double lapse_rate, int32 calc_flag, double *dret);
double atpress, double attemp,
double lapse_rate, int32 calc_flag,
double *dret);
ext_def (void) swe_set_lapse_rate(double lapse_rate); ext_def (void) swe_set_lapse_rate(double lapse_rate);
ext_def(void) swe_azalt(double tjd_ut, int32 calc_flag, double *geopos, ext_def (void) swe_azalt(
double atpress, double attemp, double *xin, double tjd_ut,
int32 calc_flag,
double *geopos,
double atpress,
double attemp,
double *xin,
double *xaz); double *xaz);
ext_def(void) swe_azalt_rev(double tjd_ut, int32 calc_flag, ext_def (void) swe_azalt_rev(
double *geopos, double *xin, double *xout); double tjd_ut,
int32 calc_flag,
double *geopos,
double *xin,
double *xout);
ext_def(int32) swe_rise_trans_true_hor(double tjd_ut, int32 ipl, ext_def (int32) swe_rise_trans_true_hor(
char *starname, int32 epheflag, double tjd_ut, int32 ipl, char *starname,
int32 rsmi, double *geopos, int32 epheflag, int32 rsmi,
double *geopos,
double atpress, double attemp, double atpress, double attemp,
double horhgt, double *tret, double horhgt,
double *tret,
char *serr); char *serr);
ext_def(int32) swe_rise_trans(double tjd_ut, int32 ipl, char *starname, ext_def (int32) swe_rise_trans(
double tjd_ut, int32 ipl, char *starname,
int32 epheflag, int32 rsmi, int32 epheflag, int32 rsmi,
double *geopos, double atpress, double *geopos,
double attemp, double *tret, char *serr); double atpress, double attemp,
double *tret,
char *serr);
ext_def (int32) swe_nod_aps(double tjd_et, int32 ipl, int32 iflag, ext_def (int32) swe_nod_aps(double tjd_et, int32 ipl, int32 iflag,
int32 method, double *xnasc, double *xndsc, int32 method,
double *xperi, double *xaphe, char *serr); double *xnasc, double *xndsc,
double *xperi, double *xaphe,
char *serr);
ext_def (int32) swe_nod_aps_ut(double tjd_ut, int32 ipl, int32 iflag, ext_def (int32) swe_nod_aps_ut(double tjd_ut, int32 ipl, int32 iflag,
int32 method, double *xnasc, int32 method,
double *xndsc, double *xperi, double *xnasc, double *xndsc,
double *xaphe, char *serr); double *xperi, double *xaphe,
char *serr);
/**************************** /****************************
@ -738,7 +739,9 @@ extern "C"
ext_def( double ) swe_deltat(double tjd); ext_def( double ) swe_deltat(double tjd);
/* equation of time */ /* equation of time */
ext_def(int) swe_time_equ(double tjd, double *te, char *serr); ext_def(int32) swe_time_equ(double tjd, double *te, char *serr);
ext_def(int32) swe_lmt_to_lat(double tjd_lmt, double geolon, double *tjd_lat, char *serr);
ext_def(int32) swe_lat_to_lmt(double tjd_lat, double geolon, double *tjd_lmt, char *serr);
/* sidereal time */ /* sidereal time */
ext_def( double ) swe_sidtime0(double tjd_ut, double eps, double nut); ext_def( double ) swe_sidtime0(double tjd_ut, double eps, double nut);
@ -757,9 +760,7 @@ extern "C"
ext_def( double ) swe_rad_midp(double x1, double x0); ext_def( double ) swe_rad_midp(double x1, double x0);
ext_def( double ) swe_deg_midp(double x1, double x0); ext_def( double ) swe_deg_midp(double x1, double x0);
ext_def(void) swe_split_deg(double ddeg, int32 roundflag, int32 * ideg, ext_def( void ) swe_split_deg(double ddeg, int32 roundflag, int32 *ideg, int32 *imin, int32 *isec, double *dsecfr, int32 *isgn);
int32 * imin, int32 * isec, double *dsecfr,
int32 * isgn);
/******************************************************* /*******************************************************
* other functions from swephlib.c; * other functions from swephlib.c;
@ -790,11 +791,9 @@ extern "C"
/* monday = 0, ... sunday = 6 */ /* monday = 0, ... sunday = 6 */
ext_def( int ) swe_day_of_week(double jd); ext_def( int ) swe_day_of_week(double jd);
ext_def(char *) swe_cs2timestr(CSEC t, int sep, AS_BOOL suppressZero, ext_def( char *) swe_cs2timestr(CSEC t, int sep, AS_BOOL suppressZero, char *a);
char *a);
ext_def(char *) swe_cs2lonlatstr(CSEC t, char pchar, char mchar, ext_def( char *) swe_cs2lonlatstr(CSEC t, char pchar, char mchar, char *s);
char *s);
ext_def( char *) swe_cs2degstr(CSEC t, char *a); ext_def( char *) swe_cs2degstr(CSEC t, char *a);

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,6 @@
Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich Authors: Dieter Koch and Alois Treindl, Astrodienst Zurich
************************************************************/ ************************************************************/
/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved. /* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved.
License conditions License conditions
@ -60,40 +59,109 @@
for promoting such software, products or services. for promoting such software, products or services.
*/ */
#define PREC_IAU_1976 1
/* Set TRUE, to include Herring's (1987) corrections to IAU 1980 #define PREC_IAU_2000 2
* nutation series. AA (1996) neglects them. */ #define PREC_IAU_2006 3
#define NUT_CORR_1987 FALSE #define PREC_BRETAGNON_2003 4
#define PREC_LASKAR_1986 5
#define PREC_SIMON_1994 6
#define PREC_WILLIAMS_1994 7
#define PREC_VONDRAK_2011 8
/* Precession coefficients for remote past and future. /* Precession coefficients for remote past and future.
* One of the following four defines must be true. * One of the following four defines must be true.
*/ */
#define PREC_VONDRAK_2011 TRUE #define USE_PREC_VONDRAK_2011 TRUE
#define PREC_WILLIAMS_1994 FALSE #define USE_PREC_WILLIAMS_1994 FALSE
#define PREC_SIMON_1994 FALSE #define USE_PREC_SIMON_1994 FALSE
#define PREC_LASKAR_1986 FALSE #define USE_PREC_LASKAR_1986 FALSE
#define PREC_BRETAGNON_2003 FALSE #define USE_PREC_BRETAGNON_2003 FALSE
/* IAU precession 1976 or 2003 for recent centuries. /* IAU precession 1976 or 2003 for recent centuries.
* only one of the following two defines may be TRUE */ * only one of the following two defines may be TRUE */
#define PREC_IAU_1976 FALSE #define USE_PREC_IAU_1976 FALSE
#define PREC_IAU_2003 FALSE /* precession model P03 */ #define USE_PREC_IAU_2000 FALSE
#define USE_PREC_IAU_2006 FALSE /* precession model P03 */
#define PREC_IAU_1976_CTIES 2.0 /* J2000 +/- two centuries */ #define PREC_IAU_1976_CTIES 2.0 /* J2000 +/- two centuries */
#define PREC_IAU_2000_CTIES 2.0 /* J2000 +/- two centuries */
/* we use P03 for whole ephemeris */ /* we use P03 for whole ephemeris */
#define PREC_IAU_2003_CTIES 75.0 /* J2000 +/- 75 centuries */ #define PREC_IAU_2006_CTIES 75.0 /* J2000 +/- 75 centuries */
/* choose between the following nutation models */ /* choose between the following nutation models */
#define NUT_IAU_1980 FALSE #define NUT_IAU_1980 FALSE
#define NUT_IAU_2000A FALSE /* very time consuming ! */ #define NUT_IAU_2000A FALSE /* very time consuming ! */
#define NUT_IAU_2000B TRUE /* fast, but precision of milli-arcsec */ #define NUT_IAU_2000B TRUE /* fast, but precision of milli-arcsec */
/* Set TRUE, to include Herring's (1987) corrections to IAU 1980
* nutation series. AA (1996) neglects them. */
#define NUT_CORR_1987 FALSE
/* frame bias */
#define FRAME_BIAS_IAU2006 TRUE /* if false, frame bias iau2000 will be used
* difference is minimal. */
/* For reproducing JPL Horizons to 2 mas (SEFLG_JPLHOR):
* The user has to keep the following files up to date which contain
* the earth orientation parameters related to the IAU 1980 nutation
* theory.
* Download the file
* datacenter.iers.org/eop/-/somos/5Rgv/document/tx13iers.u24/eopc04_08.62-now
* and rename it as eop_1962_today.txt. For current data and estimations for
* the near future, also download maia.usno.navy.mil/ser7/finals.all and
* rename it as eop_finals.txt */
#define DPSI_DEPS_IAU1980_FILE_EOPC04 "eop_1962_today.txt"
#define DPSI_DEPS_IAU1980_FILE_FINALS "eop_finals.txt"
#define DPSI_DEPS_IAU1980_TJD0_HORIZONS 2437684.5
#define HORIZONS_TJD0_DPSI_DEPS_IAU1980 2437684.5
#define INCLUDE_CODE_FOR_DPSI_DEPS_IAU1980 TRUE
/* You can set the latter false if you do not want to compile the
* code required to reproduce JPL Horizons.
* Keep it TRUE in order to reproduce JPL Horizons following
* IERS Conventions 1996 (1992), p. 22. Call swe_calc_ut() with
* iflag|SEFLG_JPLHOR. This options runs only, if the files
* DPSI_DEPS_IAU1980_FILE_EOPC04 and DPSI_DEPS_IAU1980_FILE_FINALS
* are in the ephemeris path.
*/
/* If the above define INCLUDE_CODE_FOR_DPSI_DEPS_IAU1980 is FALSE or
* the software does not find the earth orientation files (see above)
* in the ephemeris path, then SEFLG_JPLHOR will run as
* SEFLG_JPLHOR_APPROX.
* The following define APPROXIMATE_HORIZONS_ASTRODIENST defines
* the handling of SEFLG_JPLHOR_APPROX.
* With this flag, planetary positions are always calculated
* using a recent precession/nutation model.
* If APPROXIMATE_HORIZONS_ASTRODIENST is FALSE, then the
* frame bias as recommended by IERS Conventions 2003 and 2010
* is *not* applied. Instead, dpsi_bias and deps_bias are added to
* nutation. This procedure is found in some older astronomical software.
* Equatorial apparent positions will be close to JPL Horizons
* (within a few mas) beetween 1962 and current years. Ecl. longitude
* will be good, latitude bad.
* If APPROXIMATE_HORIZONS_ASTRODIENST is TRUE, the approximation of
* JPL Horizons is even better. Frame bias matrix is applied with
* some correction to RA and another correction is added to epsilon.
*/
#define APPROXIMATE_HORIZONS_ASTRODIENST TRUE
#define USE_HORIZONS_METHOD_BEFORE_1980 TRUE /* Horizons method before 20-jan-1962 */
/* The latter, if combined with SEFLG_JPLHOR provides good agreement
* with JPL Horizons for 1800 - today. However, Horizons uses correct
* dpsi and deps only after 20-jan-1962. For all dates before that
* it uses dpsi and deps of 20-jan-1962, which provides a continuous
* ephemeris, but does not make sense otherwise.
* Before 1800, even this option does not provide agreement with Horizons,
* because Horizons uses a different precession model (Owen 1986)
* before 1800, which is not included in the Swiss Ephemeris.
* If this macro is FALSE then the program defaults to SEFLG_JPLHOR_APPROX
* outside the time range of correction data dpsi and deps.
* Note that this will result in a non-continuous ephemeris near
* 20-jan-1962 and current years.
*/
/* coordinate transformation */ /* coordinate transformation */
extern void swi_coortrf(double *xpo, double *xpn, double eps); extern void swi_coortrf(double *xpo, double *xpn, double eps);
/* coordinate transformation */ /* coordinate transformation */
extern void swi_coortrf2(double *xpo, double *xpn, double sineps, extern void swi_coortrf2(double *xpo, double *xpn, double sineps, double coseps);
double coseps);
/* cartesian to polar coordinates */ /* cartesian to polar coordinates */
extern void swi_cartpol(double *x, double *l); extern void swi_cartpol(double *x, double *l);
@ -106,40 +174,38 @@ extern void swi_polcart_sp(double *l, double *x);
extern void swi_polcart(double *l, double *x); extern void swi_polcart(double *l, double *x);
/* GCRS to J2000 */ /* GCRS to J2000 */
extern void swi_bias(double *x, int32 iflag, AS_BOOL backward); extern void swi_bias(double *x, double tjd, int32 iflag, AS_BOOL backward);
extern void swi_get_eop_time_range(void);
/* GCRS to FK5 */ /* GCRS to FK5 */
extern void swi_icrs2fk5(double *x, int32 iflag, AS_BOOL backward); extern void swi_icrs2fk5(double *x, int32 iflag, AS_BOOL backward);
/* precession */ /* precession */
extern int swi_precess(double *R, double J, int direction); extern int swi_precess(double *R, double J, int32 iflag, int direction );
extern void swi_precess_speed(double *xx, double t, int direction); extern void swi_precess_speed(double *xx, double t, int32 iflag, int direction);
/* from sweph.c, light deflection, aberration, etc. */ /* from sweph.c, light deflection, aberration, etc. */
extern void swi_deflect_light(double *xx, double dt, int32 iflag); extern void swi_deflect_light(double *xx, double dt, int32 iflag);
extern void swi_aberr_light(double *xx, double *xe, int32 iflag); extern void swi_aberr_light(double *xx, double *xe, int32 iflag);
extern int swi_plan_for_osc_elem(int32 iflag, double tjd, double *xx); extern int swi_plan_for_osc_elem(int32 iflag, double tjd, double *xx);
extern int swi_trop_ra2sid_lon(double *xin, double *xout, double *xoutr, extern int swi_trop_ra2sid_lon(double *xin, double *xout, double *xoutr, int32 iflag, char *serr);
int32 iflag, char *serr); extern int swi_trop_ra2sid_lon_sosy(double *xin, double *xout, double *xoutr, int32 iflag, char *serr);
extern int swi_trop_ra2sid_lon_sosy(double *xin, double *xout, double *xoutr, extern int swi_get_observer(double tjd, int32 iflag,
int32 iflag, char *serr); AS_BOOL do_save, double *xobs, char *serr);
extern int swi_get_observer(double tjd, int32 iflag, AS_BOOL do_save,
double *xobs, char *serr);
extern void swi_force_app_pos_etc(); extern void swi_force_app_pos_etc();
/* obliquity of ecliptic */ /* obliquity of ecliptic */
extern void swi_check_ecliptic(double tjd); extern void swi_check_ecliptic(double tjd, int32 iflag);
extern double swi_epsiln(double J); extern double swi_epsiln(double J, int32 iflag);
extern void swi_ldp_peps(double J, double *dpre, double *deps); extern void swi_ldp_peps(double J, double *dpre, double *deps);
/* nutation */ /* nutation */
extern void swi_check_nutation(double tjd, int32 iflag); extern void swi_check_nutation(double tjd, int32 iflag);
extern int swi_nutation(double J, double *nutlo); extern int swi_nutation(double J, int32 iflag, double *nutlo);
extern void swi_nutate(double *xx, int32 iflag, AS_BOOL backward); extern void swi_nutate(double *xx, int32 iflag, AS_BOOL backward);
extern void swi_mean_lunar_elements(double tjd, double *node, double *dnode, extern void swi_mean_lunar_elements(double tjd,
double *node, double *dnode,
double *peri, double *dperi); double *peri, double *dperi);
/* */ /* */
extern double swi_mod2PI(double x); extern double swi_mod2PI(double x);
@ -149,7 +215,6 @@ extern double swi_edcheb(double x, double *coef, int ncf);
/* cross product of vectors */ /* cross product of vectors */
extern void swi_cross_prod(double *a, double *b, double *x); extern void swi_cross_prod(double *a, double *b, double *x);
/* dot product of vecotrs */ /* dot product of vecotrs */
extern double swi_dot_prod_unit(double *x, double *y); extern double swi_dot_prod_unit(double *x, double *y);
@ -173,6 +238,8 @@ extern void swi_FK4_FK5(double *xp, double tjd);
extern char *swi_strcpy(char *to, char *from); extern char *swi_strcpy(char *to, char *from);
extern char *swi_strncpy(char *to, char *from, size_t n); extern char *swi_strncpy(char *to, char *from, size_t n);
extern double swi_deltat_ephe(double tjd_ut, int32 epheflag);
#ifdef TRACE #ifdef TRACE
# define TRACE_COUNT_MAX 10000 # define TRACE_COUNT_MAX 10000
extern FILE *swi_fp_trace_c; extern FILE *swi_fp_trace_c;

File diff suppressed because it is too large Load Diff