sweph 2.10.3-4 → 2.10.3-6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- package/binding.gyp +2 -1
- package/index.d.ts +163 -87
- package/index.js +16 -7
- package/index.mjs +113 -102
- package/package.json +11 -7
- package/prebuilds/darwin-arm64/sweph.node +0 -0
- package/prebuilds/linux-arm64/sweph.node +0 -0
- package/prebuilds/linux-x64/sweph.node +0 -0
- package/prebuilds/win32-x64/sweph.node +0 -0
- package/src/functions/deg_midp.cpp +19 -0
- package/src/functions/difrad2n.cpp +19 -0
- package/src/functions/rad_midp.cpp +19 -0
- package/src/functions/set_lapse_rate.cpp +14 -0
- package/src/sweph.cpp +4 -0
- package/src/sweph.h +5 -1
- package/swisseph/swecl.c +19 -21
- package/swisseph/swehel.c +5 -16
- package/swisseph/swehouse.c +6 -3
- package/swisseph/swejpl.c +7 -1
- package/swisseph/swemmoon.c +6 -6
- package/swisseph/sweodef.h +0 -19
- package/swisseph/sweph.c +7 -7
- package/swisseph/sweph.h +14 -14
- package/swisseph/swephexp.h +3 -8
- package/swisseph/swephlib.c +16 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sweph",
|
|
3
|
-
"version": "2.10.3-
|
|
3
|
+
"version": "2.10.3-6",
|
|
4
4
|
"description": "The definitive Swiss Ephemeris bindings for Node.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sweph",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"license": "(AGPL-3.0-or-later OR LGPL-3.0-or-later)",
|
|
22
22
|
"author": "Timotej Valentin Rojko",
|
|
23
23
|
"exports": {
|
|
24
|
+
"types": "./index.d.ts",
|
|
24
25
|
"require": "./index.js",
|
|
25
|
-
"import": "./index.mjs"
|
|
26
|
-
"types": "./index.d.ts"
|
|
26
|
+
"import": "./index.mjs"
|
|
27
27
|
},
|
|
28
28
|
"main": "index.js",
|
|
29
29
|
"types": "./index.d.ts",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"./index.mjs",
|
|
33
33
|
"./index.d.ts",
|
|
34
34
|
"./constants.js",
|
|
35
|
+
"./prebuilds",
|
|
35
36
|
"./binding.gyp",
|
|
36
37
|
"./swisseph",
|
|
37
38
|
"./src/functions",
|
|
@@ -40,13 +41,16 @@
|
|
|
40
41
|
],
|
|
41
42
|
"scripts": {
|
|
42
43
|
"preinstall": "node -e \"const { readdirSync, readFileSync, writeFileSync } = require('fs'); const file = readdirSync('./src/functions').map((x,i) => readFileSync('./src/functions/' + x, 'utf8').replace(/args/g, 'args' + i).replace('#include <sweph.h>', '')).reduce((a,b) => a + b, '#include <sweph.h>'); writeFileSync('./src/functions.cpp', file, 'utf8');\"",
|
|
43
|
-
"
|
|
44
|
-
"test": "node -e \"const s = require('./'); const c = s.calc(2222222,0,4); console.log('OK')\""
|
|
44
|
+
"rebuild": "node-gyp rebuild && npm run test",
|
|
45
|
+
"test": "node -e \"const s = require('./'); const c = s.calc(2222222,0,4); console.log('OK')\"",
|
|
46
|
+
"install": "node-gyp-build && npm run test",
|
|
47
|
+
"prebuild": "prebuildify --napi --strip"
|
|
45
48
|
},
|
|
46
49
|
"dependencies": {
|
|
47
|
-
"node-addon-api": "
|
|
50
|
+
"node-addon-api": "^8.9.0",
|
|
51
|
+
"node-gyp-build": "^4.8.4"
|
|
48
52
|
},
|
|
49
53
|
"devDependencies": {
|
|
50
|
-
"
|
|
54
|
+
"prebuildify": "^6.0.1"
|
|
51
55
|
}
|
|
52
56
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#include <sweph.h>
|
|
2
|
+
|
|
3
|
+
constexpr std::pair<int, const char*> args[] = {
|
|
4
|
+
{ 2, "Expecting 2 arguments: deg1, deg2" },
|
|
5
|
+
{ NUMBER, "Argument 1 should be a number - first point in degrees" },
|
|
6
|
+
{ NUMBER, "Argument 2 should be a number - second point in degrees" }
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
Napi::Value sweph_deg_midp(const Napi::CallbackInfo& info) {
|
|
10
|
+
Napi::Env env = info.Env();
|
|
11
|
+
if(!sweph_type_check(args, info)) {
|
|
12
|
+
return env.Null();
|
|
13
|
+
}
|
|
14
|
+
double mid = swe_deg_midp(
|
|
15
|
+
info[0].As<Napi::Number>().DoubleValue(),
|
|
16
|
+
info[1].As<Napi::Number>().DoubleValue()
|
|
17
|
+
);
|
|
18
|
+
return Napi::Number::New(env, mid);
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#include <sweph.h>
|
|
2
|
+
|
|
3
|
+
constexpr std::pair<int, const char*> args[] = {
|
|
4
|
+
{ 2, "Expecting 2 arguments: rad, rad" },
|
|
5
|
+
{ NUMBER, "Argument 1 should be a number - radians" },
|
|
6
|
+
{ NUMBER, "Argument 2 should be a number - radians" }
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
Napi::Value sweph_difrad2n(const Napi::CallbackInfo& info) {
|
|
10
|
+
Napi::Env env = info.Env();
|
|
11
|
+
if(!sweph_type_check(args, info)) {
|
|
12
|
+
return env.Null();
|
|
13
|
+
}
|
|
14
|
+
double dif = swe_difrad2n(
|
|
15
|
+
info[0].As<Napi::Number>().DoubleValue(),
|
|
16
|
+
info[1].As<Napi::Number>().DoubleValue()
|
|
17
|
+
);
|
|
18
|
+
return Napi::Number::New(env, dif);
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#include <sweph.h>
|
|
2
|
+
|
|
3
|
+
constexpr std::pair<int, const char*> args[] = {
|
|
4
|
+
{ 2, "Expecting 2 arguments: rad1, rad2" },
|
|
5
|
+
{ NUMBER, "Argument 1 should be a number - first point in radians" },
|
|
6
|
+
{ NUMBER, "Argument 2 should be a number - second point in radians" }
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
Napi::Value sweph_rad_midp(const Napi::CallbackInfo& info) {
|
|
10
|
+
Napi::Env env = info.Env();
|
|
11
|
+
if(!sweph_type_check(args, info)) {
|
|
12
|
+
return env.Null();
|
|
13
|
+
}
|
|
14
|
+
double mid = swe_rad_midp(
|
|
15
|
+
info[0].As<Napi::Number>().DoubleValue(),
|
|
16
|
+
info[1].As<Napi::Number>().DoubleValue()
|
|
17
|
+
);
|
|
18
|
+
return Napi::Number::New(env, mid);
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#include <sweph.h>
|
|
2
|
+
|
|
3
|
+
constexpr std::pair<int, const char*> args[] = {
|
|
4
|
+
{ 1, "Expecting 1 arguments: lapse_rate" },
|
|
5
|
+
{ NUMBER, "Argument 1 should be a number - lapse rate [°K/m]" }
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
void sweph_set_lapse_rate(const Napi::CallbackInfo& info) {
|
|
9
|
+
if(!sweph_type_check(args, info)) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
swe_set_lapse_rate(info[0].As<Napi::Number>().DoubleValue());
|
|
13
|
+
return;
|
|
14
|
+
}
|
package/src/sweph.cpp
CHANGED
|
@@ -5,6 +5,7 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) {
|
|
|
5
5
|
exports["set_delta_t_userdef"] = Napi::Function::New(env, sweph_set_delta_t_userdef);
|
|
6
6
|
exports["set_ephe_path"] = Napi::Function::New(env, sweph_set_ephe_path);
|
|
7
7
|
exports["set_jpl_file"] = Napi::Function::New(env, sweph_set_jpl_file);
|
|
8
|
+
exports["set_lapse_rate"] = Napi::Function::New(env, sweph_set_lapse_rate);
|
|
8
9
|
exports["set_sid_mode"] = Napi::Function::New(env, sweph_set_sid_mode);
|
|
9
10
|
exports["set_tid_acc"] = Napi::Function::New(env, sweph_set_tid_acc);
|
|
10
11
|
exports["set_topo"] = Napi::Function::New(env, sweph_set_topo);
|
|
@@ -84,6 +85,9 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) {
|
|
|
84
85
|
exports["difdegn"] = Napi::Function::New(env, sweph_difdegn);
|
|
85
86
|
exports["difcs2n"] = Napi::Function::New(env, sweph_difcs2n);
|
|
86
87
|
exports["difdeg2n"] = Napi::Function::New(env, sweph_difdeg2n);
|
|
88
|
+
exports["difrad2n"] = Napi::Function::New(env, sweph_difrad2n);
|
|
89
|
+
exports["deg_midp"] = Napi::Function::New(env, sweph_deg_midp);
|
|
90
|
+
exports["rad_midp"] = Napi::Function::New(env, sweph_rad_midp);
|
|
87
91
|
exports["csroundsec"] = Napi::Function::New(env, sweph_csroundsec);
|
|
88
92
|
exports["d2l"] = Napi::Function::New(env, sweph_d2l);
|
|
89
93
|
exports["day_of_week"] = Napi::Function::New(env, sweph_day_of_week);
|
package/src/sweph.h
CHANGED
|
@@ -9,6 +9,7 @@ void sweph_close(const Napi::CallbackInfo& info);
|
|
|
9
9
|
void sweph_set_delta_t_userdef(const Napi::CallbackInfo& info);
|
|
10
10
|
void sweph_set_ephe_path(const Napi::CallbackInfo& info);
|
|
11
11
|
void sweph_set_jpl_file(const Napi::CallbackInfo& info);
|
|
12
|
+
void sweph_set_lapse_rate(const Napi::CallbackInfo& info);
|
|
12
13
|
void sweph_set_sid_mode(const Napi::CallbackInfo& info);
|
|
13
14
|
void sweph_set_tid_acc(const Napi::CallbackInfo& info);
|
|
14
15
|
void sweph_set_topo(const Napi::CallbackInfo& info);
|
|
@@ -88,6 +89,9 @@ Napi::Value sweph_difcsn(const Napi::CallbackInfo& info);
|
|
|
88
89
|
Napi::Value sweph_difcs2n(const Napi::CallbackInfo& info);
|
|
89
90
|
Napi::Value sweph_difdegn(const Napi::CallbackInfo& info);
|
|
90
91
|
Napi::Value sweph_difdeg2n(const Napi::CallbackInfo& info);
|
|
92
|
+
Napi::Value sweph_difrad2n(const Napi::CallbackInfo& info);
|
|
93
|
+
Napi::Value sweph_deg_midp(const Napi::CallbackInfo& info);
|
|
94
|
+
Napi::Value sweph_rad_midp(const Napi::CallbackInfo& info);
|
|
91
95
|
Napi::Value sweph_csroundsec(const Napi::CallbackInfo& info);
|
|
92
96
|
Napi::Value sweph_d2l(const Napi::CallbackInfo& info);
|
|
93
97
|
Napi::Value sweph_day_of_week(const Napi::CallbackInfo& info);
|
|
@@ -116,4 +120,4 @@ enum TYPES {
|
|
|
116
120
|
TRUEFALSE
|
|
117
121
|
};
|
|
118
122
|
|
|
119
|
-
#endif
|
|
123
|
+
#endif
|
package/swisseph/swecl.c
CHANGED
|
@@ -771,7 +771,7 @@ iter_where:
|
|
|
771
771
|
} else {
|
|
772
772
|
if (serr != NULL)
|
|
773
773
|
sprintf(serr, "no solar eclipse at tjd = %f", tjd);
|
|
774
|
-
for (i = 0; i <
|
|
774
|
+
for (i = 0; i < 2; i++)
|
|
775
775
|
geopos[i] = 0;
|
|
776
776
|
*dcore = 0;
|
|
777
777
|
retc = 0;
|
|
@@ -1991,7 +1991,7 @@ end_search_global:
|
|
|
1991
1991
|
* SE_ECL_VISIBLE,
|
|
1992
1992
|
* SE_ECL_MAX_VISIBLE,
|
|
1993
1993
|
* SE_ECL_1ST_VISIBLE, SE_ECL_2ND_VISIBLE
|
|
1994
|
-
*
|
|
1994
|
+
* SE_ECL_3RD_VISIBLE, SE_ECL_4TH_VISIBLE
|
|
1995
1995
|
*
|
|
1996
1996
|
* tret[0] time of maximum eclipse
|
|
1997
1997
|
* tret[1] time of first contact
|
|
@@ -2048,7 +2048,7 @@ int32 CALL_CONV swe_sol_eclipse_when_loc(double tjd_start, int32 ifl,
|
|
|
2048
2048
|
* SE_ECL_VISIBLE,
|
|
2049
2049
|
* SE_ECL_MAX_VISIBLE,
|
|
2050
2050
|
* SE_ECL_1ST_VISIBLE, SE_ECL_2ND_VISIBLE
|
|
2051
|
-
*
|
|
2051
|
+
* SE_ECL_3RD_VISIBLE, SE_ECL_4TH_VISIBLE
|
|
2052
2052
|
* SE_ECL_OCC_BEG_DAYLIGHT, SE_ECL_OCC_END_DAYLIGHT
|
|
2053
2053
|
* The latter two indicate that the beginning or end of the occultation takes
|
|
2054
2054
|
* place during the day. If Venus is occulted, it may be observable with the
|
|
@@ -2103,7 +2103,7 @@ static int32 eclipse_when_loc(double tjd_start, int32 ifl, double *geopos, doubl
|
|
|
2103
2103
|
int32 retflag = 0, retc;
|
|
2104
2104
|
double t, tjd, dt, dtint, K, T, T2, T3, T4, F, M, Mm;
|
|
2105
2105
|
double tjdr, tjds;
|
|
2106
|
-
double E, Ff
|
|
2106
|
+
double E, Ff; // A1, Om;
|
|
2107
2107
|
double xs[6], xm[6], ls[6], lm[6], x1[6], x2[6], dm, ds;
|
|
2108
2108
|
double rmoon, rsun, rsplusrm, rsminusrm;
|
|
2109
2109
|
double dc[3], dctr, dctrmin;
|
|
@@ -2149,16 +2149,14 @@ next_try:
|
|
|
2149
2149
|
+ 0.1017438 * T2
|
|
2150
2150
|
+ 0.00001239 * T3
|
|
2151
2151
|
+ 0.000000058 * T4);
|
|
2152
|
-
Om = swe_degnorm(124.7746 - 1.56375580 * K
|
|
2153
|
-
+ 0.0020691 * T2
|
|
2154
|
-
+ 0.00000215 * T3);
|
|
2152
|
+
// Om = swe_degnorm(124.7746 - 1.56375580 * K + 0.0020691 * T2 + 0.00000215 * T3);
|
|
2155
2153
|
E = 1 - 0.002516 * T - 0.0000074 * T2;
|
|
2156
|
-
A1 = swe_degnorm(299.77 + 0.107408 * K - 0.009173 * T2);
|
|
2154
|
+
// A1 = swe_degnorm(299.77 + 0.107408 * K - 0.009173 * T2);
|
|
2157
2155
|
M *= DEGTORAD;
|
|
2158
2156
|
Mm *= DEGTORAD;
|
|
2159
2157
|
F *= DEGTORAD;
|
|
2160
|
-
Om *= DEGTORAD;
|
|
2161
|
-
A1 *= DEGTORAD;
|
|
2158
|
+
// Om *= DEGTORAD;
|
|
2159
|
+
// A1 *= DEGTORAD;
|
|
2162
2160
|
tjd = tjd - 0.4075 * sin(Mm)
|
|
2163
2161
|
+ 0.1721 * E * sin(M);
|
|
2164
2162
|
swe_set_topo(geopos[0], geopos[1], geopos[2]);
|
|
@@ -4213,7 +4211,6 @@ static int32 rise_set_fast(
|
|
|
4213
4211
|
int i;
|
|
4214
4212
|
double xx[6], xaz[6], xaz2[6];
|
|
4215
4213
|
double dd, dt, refr;
|
|
4216
|
-
double dtsum = 0;
|
|
4217
4214
|
int32 iflag = epheflag & (SEFLG_JPLEPH|SEFLG_SWIEPH|SEFLG_MOSEPH);
|
|
4218
4215
|
int32 iflagtopo = iflag | SEFLG_EQUATORIAL;
|
|
4219
4216
|
double sda, armc, md, dmd, mdrise, rdi, tr, dalt;
|
|
@@ -4307,9 +4304,11 @@ run_rise_again:
|
|
|
4307
4304
|
dd = (xaz2[1] - xaz[1]);
|
|
4308
4305
|
dalt = xaz[1] + rdi;
|
|
4309
4306
|
dt = dalt / dd / 1000.0;
|
|
4310
|
-
if (dt > 0.1)
|
|
4311
|
-
|
|
4312
|
-
|
|
4307
|
+
if (dt > 0.1) {
|
|
4308
|
+
dt = 0.1;
|
|
4309
|
+
} else if (dt < -0.1) {
|
|
4310
|
+
dt = -0.1;
|
|
4311
|
+
}
|
|
4313
4312
|
if ((0) && fabs(dt) > 5.0 / 86400.0 && nloop < 20)
|
|
4314
4313
|
nloop++;
|
|
4315
4314
|
tr -= dt;
|
|
@@ -4403,8 +4402,8 @@ int32 CALL_CONV swe_rise_trans_true_hor(
|
|
|
4403
4402
|
double t, te, tt, dt, twohrs = 1.0 / 12.0;
|
|
4404
4403
|
double curdist;
|
|
4405
4404
|
int32 tohor_flag = SE_EQU2HOR;
|
|
4406
|
-
int nazalt = 0;
|
|
4407
|
-
int ncalc = 0;
|
|
4405
|
+
int nazalt = 0;
|
|
4406
|
+
int ncalc = 0;
|
|
4408
4407
|
AS_BOOL do_fixstar = (starname != NULL && *starname != '\0');
|
|
4409
4408
|
if (geopos[2] < SEI_ECL_GEOALT_MIN || geopos[2] > SEI_ECL_GEOALT_MAX) {
|
|
4410
4409
|
if (serr != NULL)
|
|
@@ -4676,8 +4675,8 @@ nazalt++;
|
|
|
4676
4675
|
}
|
|
4677
4676
|
if (t > tjd_ut) {
|
|
4678
4677
|
*tret = t;
|
|
4679
|
-
|
|
4680
|
-
|
|
4678
|
+
if (0) fprintf(stderr, "nazalt=%d\n", nazalt);
|
|
4679
|
+
if (0) fprintf(stderr, "ncalc=%d\n", ncalc);
|
|
4681
4680
|
return OK;
|
|
4682
4681
|
}
|
|
4683
4682
|
}
|
|
@@ -5782,7 +5781,7 @@ int32 CALL_CONV swe_get_orbital_elements(
|
|
|
5782
5781
|
int32 iflJ2000 = (iflag & SEFLG_EPHMASK)|SEFLG_J2000|SEFLG_XYZ|SEFLG_TRUEPOS|SEFLG_NONUT|SEFLG_SPEED;
|
|
5783
5782
|
int32 iflJ2000p = (iflag & SEFLG_EPHMASK)|SEFLG_J2000|SEFLG_TRUEPOS|SEFLG_NONUT|SEFLG_SPEED;
|
|
5784
5783
|
double Gmsm;
|
|
5785
|
-
int32 iflg0 = 0;
|
|
5784
|
+
// int32 iflg0 = 0;
|
|
5786
5785
|
double fac, sgn, rxy, rxyz, c2, cosnode, sinnode;
|
|
5787
5786
|
double incl, node, parg, peri, mlon;
|
|
5788
5787
|
double csid, ctro, csyn, dmot, pa;
|
|
@@ -5795,8 +5794,7 @@ int32 CALL_CONV swe_get_orbital_elements(
|
|
|
5795
5794
|
sprintf(serr, "error in swe_get_orbital_elements(): object %d not valid\n", ipl);
|
|
5796
5795
|
return ERR;
|
|
5797
5796
|
}
|
|
5798
|
-
if (ipl != SE_MOON)
|
|
5799
|
-
iflg0 |= SEFLG_HELCTR;
|
|
5797
|
+
// if (ipl != SE_MOON) iflg0 |= SEFLG_HELCTR;
|
|
5800
5798
|
/* first, we need a heliocentric distance of the planet */
|
|
5801
5799
|
if (swe_calc(tjd_et, ipl, iflJ2000p, x, serr) == ERR)
|
|
5802
5800
|
return ERR;
|
package/swisseph/swehel.c
CHANGED
|
@@ -3164,8 +3164,8 @@ static int32 heliacal_ut_vis_lim(double tjd_start, double *dgeo, double *datm, d
|
|
|
3164
3164
|
{
|
|
3165
3165
|
int i;
|
|
3166
3166
|
double d, darr[10], direct = 1, tjd, tday;
|
|
3167
|
-
int32
|
|
3168
|
-
int32
|
|
3167
|
+
int32 retval = OK, helflag2;
|
|
3168
|
+
int32 ipl;
|
|
3169
3169
|
int32 TypeEvent = TypeEventIn;
|
|
3170
3170
|
char serr[AS_MAXCH];
|
|
3171
3171
|
for (i = 0; i < 10; i++)
|
|
@@ -3173,10 +3173,6 @@ static int32 heliacal_ut_vis_lim(double tjd_start, double *dgeo, double *datm, d
|
|
|
3173
3173
|
*dret = tjd_start;
|
|
3174
3174
|
*serr = '\0';
|
|
3175
3175
|
ipl = DeterObject(ObjectName);
|
|
3176
|
-
epheflag = helflag & (SEFLG_JPLEPH|SEFLG_SWIEPH|SEFLG_MOSEPH);
|
|
3177
|
-
iflag = SEFLG_TOPOCTR | SEFLG_EQUATORIAL | epheflag;
|
|
3178
|
-
if (!(helflag & SE_HELFLAG_HIGH_PRECISION))
|
|
3179
|
-
iflag |= SEFLG_NONUT | SEFLG_TRUEPOS;
|
|
3180
3176
|
if (ipl == SE_MERCURY)
|
|
3181
3177
|
tjd = tjd_start - 30;
|
|
3182
3178
|
else
|
|
@@ -3255,8 +3251,7 @@ static int32 moon_event_vis_lim(double tjdstart, double *dgeo, double *datm, dou
|
|
|
3255
3251
|
double tjd, trise;
|
|
3256
3252
|
char serr[AS_MAXCH];
|
|
3257
3253
|
char ObjectName[30];
|
|
3258
|
-
int32
|
|
3259
|
-
int32 epheflag = helflag & (SEFLG_JPLEPH|SEFLG_SWIEPH|SEFLG_MOSEPH);
|
|
3254
|
+
int32 ipl, retval, helflag2, direct;
|
|
3260
3255
|
dret[0] = tjdstart; /* will be returned in error case */
|
|
3261
3256
|
if (TypeEvent == 1 || TypeEvent == 2) {
|
|
3262
3257
|
if (serr_ret != NULL)
|
|
@@ -3265,9 +3260,6 @@ static int32 moon_event_vis_lim(double tjdstart, double *dgeo, double *datm, dou
|
|
|
3265
3260
|
}
|
|
3266
3261
|
strcpy(ObjectName, "moon");
|
|
3267
3262
|
ipl = SE_MOON;
|
|
3268
|
-
iflag = SEFLG_TOPOCTR | SEFLG_EQUATORIAL | epheflag;
|
|
3269
|
-
if (!(helflag & SE_HELFLAG_HIGH_PRECISION))
|
|
3270
|
-
iflag |= SEFLG_NONUT|SEFLG_TRUEPOS;
|
|
3271
3263
|
helflag2 = helflag;
|
|
3272
3264
|
helflag2 &= ~SE_HELFLAG_HIGH_PRECISION;
|
|
3273
3265
|
/* check Synodic/phase Period */
|
|
@@ -3392,7 +3384,7 @@ static int32 heliacal_ut(double JDNDaysUTStart, double *dgeo, double *datm, doub
|
|
|
3392
3384
|
*/
|
|
3393
3385
|
int32 CALL_CONV swe_heliacal_ut(double JDNDaysUTStart, double *dgeo, double *datm, double *dobs, char *ObjectNameIn, int32 TypeEvent, int32 helflag, double *dret, char *serr_ret)
|
|
3394
3386
|
{
|
|
3395
|
-
int32 retval, Planet
|
|
3387
|
+
int32 retval, Planet;
|
|
3396
3388
|
char ObjectName[AS_MAXCH], serr[AS_MAXCH], s[AS_MAXCH];
|
|
3397
3389
|
double tjd0 = JDNDaysUTStart, tjd, dsynperiod, tjdmax, tadd;
|
|
3398
3390
|
int32 MaxCountSynodicPeriod = MAX_COUNT_SYNPER;
|
|
@@ -3490,11 +3482,8 @@ int32 CALL_CONV swe_heliacal_ut(double JDNDaysUTStart, double *dgeo, double *dat
|
|
|
3490
3482
|
/*
|
|
3491
3483
|
* this is the outer loop over n synodic periods
|
|
3492
3484
|
*/
|
|
3493
|
-
tjd = tjd0;
|
|
3494
3485
|
retval = -2; /* indicates that another synodic period has to be done */
|
|
3495
|
-
for (
|
|
3496
|
-
tjd < tjdmax && retval == -2;
|
|
3497
|
-
itry++, tjd += tadd) {
|
|
3486
|
+
for (tjd = tjd0; tjd < tjdmax && retval == -2; tjd += tadd) {
|
|
3498
3487
|
*serr = '\0';
|
|
3499
3488
|
retval = heliacal_ut(tjd, dgeo, datm, dobs, ObjectName, TypeEvent, helflag, dret, serr);
|
|
3500
3489
|
/* if resulting event date < start date for search (tjd0): retry starting
|
package/swisseph/swehouse.c
CHANGED
|
@@ -967,7 +967,9 @@ static int CalcH(
|
|
|
967
967
|
} /* if */
|
|
968
968
|
hsp->mc = swe_degnorm(hsp->mc);
|
|
969
969
|
if (hsp->do_speed) hsp->mc_speed = AscDash(th, 0, sine, cose);
|
|
970
|
-
|
|
970
|
+
// ascendant
|
|
971
|
+
// In case of ascendant, the great circle is the horizon, which has pole height latitude.
|
|
972
|
+
// intersection equator horizon is at th + 90, reactasce 90° east of meridian.
|
|
971
973
|
hsp->ac = Asc1(th + 90, fi, sine, cose);
|
|
972
974
|
if (hsp->do_speed)
|
|
973
975
|
hsp->ac_speed = AscDash(th + 90, fi, sine, cose);
|
|
@@ -2049,7 +2051,7 @@ porphyry:
|
|
|
2049
2051
|
|
|
2050
2052
|
/*****
|
|
2051
2053
|
* oblique triangle formed by: great circle with pole height f, ecliptic and equator,
|
|
2052
|
-
* x = intersection equator - great circle.
|
|
2054
|
+
* x = intersection equator - great circle, measured along equator.
|
|
2053
2055
|
* return crossing of ecliptic with great circle.
|
|
2054
2056
|
* Prepare quadrants before doing the work in Asc2.
|
|
2055
2057
|
*/
|
|
@@ -2091,7 +2093,8 @@ static double Asc1(double x1, double f, double sine, double cose)
|
|
|
2091
2093
|
* f in range -90 .. +90
|
|
2092
2094
|
* sine, cose around e=23°
|
|
2093
2095
|
* oblique triangle formed by: great circle with pole height f, ecliptic and equator,
|
|
2094
|
-
*
|
|
2096
|
+
* In case of ascendant, the great circle is the horizon, which has pole height latitude.
|
|
2097
|
+
* x = intersection equator - great circle, measured along equator.
|
|
2095
2098
|
* return crossing of ecliptic with great circle.
|
|
2096
2099
|
*/
|
|
2097
2100
|
static double Asc2(double x, double f, double sine, double cose)
|
package/swisseph/swejpl.c
CHANGED
|
@@ -81,6 +81,12 @@
|
|
|
81
81
|
typedef off_t off_t64;
|
|
82
82
|
#define FSEEK fseeko
|
|
83
83
|
#define FTELL ftello
|
|
84
|
+
// #ifdef __ANDROID_API__
|
|
85
|
+
// #undef FSEEK
|
|
86
|
+
// #undef FTELL
|
|
87
|
+
// #define FSEEK fseek
|
|
88
|
+
// #define FTELL ftell
|
|
89
|
+
// #endif
|
|
84
90
|
#endif
|
|
85
91
|
|
|
86
92
|
#define DEBUG_DO_SHOW FALSE
|
|
@@ -945,7 +951,7 @@ int swi_open_jpl_file(double *ss, char *fname, char *fpath, char *serr)
|
|
|
945
951
|
return retc;
|
|
946
952
|
}
|
|
947
953
|
|
|
948
|
-
int32 swi_get_jpl_denum()
|
|
954
|
+
int32 swi_get_jpl_denum(void)
|
|
949
955
|
{
|
|
950
956
|
return js->eh_denum;
|
|
951
957
|
}
|
package/swisseph/swemmoon.c
CHANGED
|
@@ -1179,7 +1179,7 @@ moonpol[1] *= a;
|
|
|
1179
1179
|
moonpol[2] *= a;
|
|
1180
1180
|
}
|
|
1181
1181
|
#else
|
|
1182
|
-
static void moon1()
|
|
1182
|
+
static void moon1(void)
|
|
1183
1183
|
{
|
|
1184
1184
|
double a;
|
|
1185
1185
|
/* This code added by Bhanu Pinnamaneni, 17-aug-2009 */
|
|
@@ -1364,7 +1364,7 @@ moonpol[2] *= a;
|
|
|
1364
1364
|
}
|
|
1365
1365
|
#endif /* MOSH_MOON_200 */
|
|
1366
1366
|
|
|
1367
|
-
static void moon2()
|
|
1367
|
+
static void moon2(void)
|
|
1368
1368
|
{
|
|
1369
1369
|
/* terms in T^0 */
|
|
1370
1370
|
g = STR*(2*(Ea-Ju+D)-MP+648431.172);
|
|
@@ -1441,7 +1441,7 @@ g = STR*(SWELP - 2.0*D + 2.5);
|
|
|
1441
1441
|
B += 0.29855 * sin(g);
|
|
1442
1442
|
}
|
|
1443
1443
|
|
|
1444
|
-
static void moon3()
|
|
1444
|
+
static void moon3(void)
|
|
1445
1445
|
{
|
|
1446
1446
|
/* terms in T^0 */
|
|
1447
1447
|
moonpol[0] = 0.0;
|
|
@@ -1455,7 +1455,7 @@ moonpol[2] = 1.0e-4 * moonpol[2] + 385000.52899; /* kilometers */
|
|
|
1455
1455
|
|
|
1456
1456
|
/* Compute final ecliptic polar coordinates
|
|
1457
1457
|
*/
|
|
1458
|
-
static void moon4()
|
|
1458
|
+
static void moon4(void)
|
|
1459
1459
|
{
|
|
1460
1460
|
moonpol[2] /= AUNIT / 1000;
|
|
1461
1461
|
moonpol[0] = STR * mods3600( moonpol[0] );
|
|
@@ -1760,7 +1760,7 @@ void swi_mean_lunar_elements(double tjd,
|
|
|
1760
1760
|
*peri = swe_degnorm(*peri - dcor);
|
|
1761
1761
|
}
|
|
1762
1762
|
|
|
1763
|
-
static void mean_elements()
|
|
1763
|
+
static void mean_elements(void)
|
|
1764
1764
|
{
|
|
1765
1765
|
double fracT = fmod(T, 1);
|
|
1766
1766
|
/* Mean anomaly of sun = l' (J. Laskar) */
|
|
@@ -1817,7 +1817,7 @@ SWELP += ((z[11]*T + z[10])*T + z[9])*T2;
|
|
|
1817
1817
|
*/
|
|
1818
1818
|
}
|
|
1819
1819
|
|
|
1820
|
-
void mean_elements_pl()
|
|
1820
|
+
void mean_elements_pl(void)
|
|
1821
1821
|
{
|
|
1822
1822
|
/* Mean longitudes of planets (Laskar, Bretagnon) */
|
|
1823
1823
|
Ve = mods3600( 210664136.4335482 * T + 655127.283046 );
|
package/swisseph/sweodef.h
CHANGED
|
@@ -139,12 +139,6 @@
|
|
|
139
139
|
# define WATCOMC
|
|
140
140
|
#endif
|
|
141
141
|
|
|
142
|
-
#ifdef __MWERKS__ /* defined on Macintosh CodeWarrior */
|
|
143
|
-
# if macintosh && powerc
|
|
144
|
-
# define MACOS MY_TRUE /* let it undefined otherwise */
|
|
145
|
-
# define MSDOS MY_FALSE /* in case one above fired falsely */
|
|
146
|
-
# endif
|
|
147
|
-
#endif
|
|
148
142
|
|
|
149
143
|
#ifdef MSDOS
|
|
150
144
|
# define HPUNIX MY_FALSE
|
|
@@ -154,17 +148,12 @@
|
|
|
154
148
|
# endif
|
|
155
149
|
# define UNIX_FS MY_FALSE
|
|
156
150
|
#else
|
|
157
|
-
# ifdef MACOS
|
|
158
|
-
# define HPUNIX MY_FALSE
|
|
159
|
-
# define UNIX_FS MY_FALSE
|
|
160
|
-
# else
|
|
161
151
|
# define MSDOS MY_FALSE
|
|
162
152
|
# define HPUNIX MY_TRUE
|
|
163
153
|
# ifndef _HPUX_SOURCE
|
|
164
154
|
# define _HPUX_SOURCE
|
|
165
155
|
# endif
|
|
166
156
|
# define UNIX_FS MY_TRUE
|
|
167
|
-
# endif
|
|
168
157
|
#endif
|
|
169
158
|
|
|
170
159
|
#include <math.h>
|
|
@@ -321,13 +310,6 @@ typedef int32 centisec; /* centiseconds used for angles and times */
|
|
|
321
310
|
# define BFILE_A_ACCESS "a+b" /* create/open binary file for append*/
|
|
322
311
|
# define PATH_SEPARATOR ";" /* semicolon as PATH separator */
|
|
323
312
|
# define OPEN_MODE 0666 /* default file creation mode */
|
|
324
|
-
# ifdef MACOS
|
|
325
|
-
# define FILE_R_ACCESS "r" /* open text file for reading */
|
|
326
|
-
# define FILE_RW_ACCESS "r+" /* open text file for writing and reading */
|
|
327
|
-
# define FILE_W_CREATE "w" /* create/open text file for write*/
|
|
328
|
-
# define FILE_A_ACCESS "a+" /* create/open text file for append*/
|
|
329
|
-
# define DIR_GLUE ":" /* glue string for directory/file */
|
|
330
|
-
# else
|
|
331
313
|
# define FILE_R_ACCESS "rt" /* open text file for reading */
|
|
332
314
|
# define FILE_RW_ACCESS "r+t" /* open text file for writing and reading */
|
|
333
315
|
# define FILE_W_CREATE "wt" /* create/open text file for write*/
|
|
@@ -335,7 +317,6 @@ typedef int32 centisec; /* centiseconds used for angles and times */
|
|
|
335
317
|
/* attention, all backslashes for msdos directry names must be written as \\,
|
|
336
318
|
because it is the C escape character */
|
|
337
319
|
# define DIR_GLUE "\\" /* glue string for directory/file */
|
|
338
|
-
# endif
|
|
339
320
|
#endif
|
|
340
321
|
|
|
341
322
|
#include <string.h>
|
package/swisseph/sweph.c
CHANGED
|
@@ -1316,6 +1316,7 @@ void CALL_CONV swe_set_ephe_path(const char *path)
|
|
|
1316
1316
|
{
|
|
1317
1317
|
int i, iflag;
|
|
1318
1318
|
char s[AS_MAXCH];
|
|
1319
|
+
char serr[AS_MAXCH];
|
|
1319
1320
|
char *sp;
|
|
1320
1321
|
double xx[6];
|
|
1321
1322
|
/* close all open files and delete all planetary data */
|
|
@@ -1343,7 +1344,7 @@ void CALL_CONV swe_set_ephe_path(const char *path)
|
|
|
1343
1344
|
* tidal acceleration of the Moon */
|
|
1344
1345
|
iflag = SEFLG_SWIEPH|SEFLG_J2000|SEFLG_TRUEPOS|SEFLG_ICRS;
|
|
1345
1346
|
swed.last_epheflag = 2;
|
|
1346
|
-
swe_calc(J2000, SE_MOON, iflag, xx,
|
|
1347
|
+
swe_calc(J2000, SE_MOON, iflag, xx, serr);
|
|
1347
1348
|
if (swed.fidat[SEI_FILE_MOON].fptr != NULL) {
|
|
1348
1349
|
swi_set_tid_acc(0, 0, swed.fidat[SEI_FILE_MOON].sweph_denum, NULL);
|
|
1349
1350
|
}
|
|
@@ -6210,7 +6211,7 @@ static int CMP_CALL_CONV fstar_node_compare(const void *node1, const void *node2
|
|
|
6210
6211
|
int32 fixstar_cut_string(char *srecord, char *star, struct fixed_star *stardata, char *serr)
|
|
6211
6212
|
{
|
|
6212
6213
|
int i;
|
|
6213
|
-
char s[AS_MAXCH];
|
|
6214
|
+
char s[AS_MAXCH + 20];
|
|
6214
6215
|
char *sde_d;
|
|
6215
6216
|
char *cpos[20];
|
|
6216
6217
|
double epoch, radv, parall, mag;
|
|
@@ -6256,6 +6257,7 @@ int32 fixstar_cut_string(char *srecord, char *star, struct fixed_star *stardata,
|
|
|
6256
6257
|
de_pm = atof(cpos[10]);
|
|
6257
6258
|
radv = atof(cpos[11]);
|
|
6258
6259
|
parall = atof(cpos[12]);
|
|
6260
|
+
if (parall < 0) parall = -parall; // to fix bug like old Rasalgheti
|
|
6259
6261
|
mag = atof(cpos[13]);
|
|
6260
6262
|
/****************************************
|
|
6261
6263
|
* position and speed (equinox)
|
|
@@ -6322,7 +6324,7 @@ int32 fixstar_cut_string(char *srecord, char *star, struct fixed_star *stardata,
|
|
|
6322
6324
|
static int32 load_all_fixed_stars(char *serr)
|
|
6323
6325
|
{
|
|
6324
6326
|
int32 retc = OK;
|
|
6325
|
-
int nstars = 0,
|
|
6327
|
+
int nstars = 0, nrecs = 0, nnamed = 0;
|
|
6326
6328
|
char s[AS_MAXCH], *sp;
|
|
6327
6329
|
char srecord[AS_MAXCH];
|
|
6328
6330
|
struct fixed_star fstdata;
|
|
@@ -6344,13 +6346,11 @@ static int32 load_all_fixed_stars(char *serr)
|
|
|
6344
6346
|
rewind(swed.fixfp);
|
|
6345
6347
|
swed.fixed_stars = NULL;
|
|
6346
6348
|
while (fgets(s, AS_MAXCH, swed.fixfp) != NULL) {
|
|
6347
|
-
fline++;
|
|
6348
6349
|
// skip comment lines
|
|
6349
6350
|
if (*s == '#') continue;
|
|
6350
6351
|
if (*s == '\n') continue;
|
|
6351
6352
|
if (*s == '\r') continue;
|
|
6352
6353
|
if (*s == '\0') continue;
|
|
6353
|
-
line++;
|
|
6354
6354
|
strcpy(srecord, s);
|
|
6355
6355
|
retc = fixstar_cut_string(srecord, NULL, &fstdata, serr);
|
|
6356
6356
|
if (retc == ERR) return ERR;
|
|
@@ -6388,7 +6388,7 @@ static int32 load_all_fixed_stars(char *serr)
|
|
|
6388
6388
|
swed.n_fixstars_real = nstars;
|
|
6389
6389
|
swed.n_fixstars_named = nnamed;
|
|
6390
6390
|
swed.n_fixstars_records = nrecs;
|
|
6391
|
-
//
|
|
6391
|
+
// fprintf(stderr, "nstars=%d, nrecords=%d\n", nstars, nrecs);
|
|
6392
6392
|
(void) qsort ((void *) swed.fixed_stars, (size_t) nrecs, sizeof (struct fixed_star),
|
|
6393
6393
|
(int (CMP_CALL_CONV *)(const void *,const void *))(fixedstar_name_compare));
|
|
6394
6394
|
return retc;
|
|
@@ -7266,7 +7266,7 @@ void CALL_CONV swe_set_topo(double geolon, double geolat, double geoalt)
|
|
|
7266
7266
|
swi_force_app_pos_etc();
|
|
7267
7267
|
}
|
|
7268
7268
|
|
|
7269
|
-
void swi_force_app_pos_etc()
|
|
7269
|
+
void swi_force_app_pos_etc(void)
|
|
7270
7270
|
{
|
|
7271
7271
|
int i;
|
|
7272
7272
|
for (i = 0; i < SEI_NPLANETS; i++)
|
package/swisseph/sweph.h
CHANGED
|
@@ -445,14 +445,14 @@ static const struct aya_init ayanamsa[SE_NSIDM_PREDEF] = {
|
|
|
445
445
|
/*************************/
|
|
446
446
|
/* 8: J.N. Bhasin; (David Cochrane)
|
|
447
447
|
We don't have any sources or detailed information about this ayanamsha. */
|
|
448
|
-
{J1900, 360 - 338.634444, FALSE, -1}, // Bhasin
|
|
448
|
+
{J1900, 360 - 338.634444, FALSE, -1}, // 8: Bhasin
|
|
449
449
|
/*************************/
|
|
450
450
|
/* 14 Sept. 2018: the following three ayanamshas have been wrong for
|
|
451
451
|
many years */
|
|
452
452
|
/* 9 - 11: Babylonian, Kugler */
|
|
453
|
-
{1684532.5, -5.66667, TRUE, -1},
|
|
454
|
-
{1684532.5, -4.26667, TRUE, -1},
|
|
455
|
-
{1684532.5, -3.41667, TRUE, -1},
|
|
453
|
+
{1684532.5, -5.66667, TRUE, -1}, // 9: Babylonian, Kugler 1
|
|
454
|
+
{1684532.5, -4.26667, TRUE, -1}, // 10: Babylonian, Kugler 2
|
|
455
|
+
{1684532.5, -3.41667, TRUE, -1}, // 11: Babylonian, Kugler 3
|
|
456
456
|
/*************************/
|
|
457
457
|
/* 12: Babylonian, Huber
|
|
458
458
|
P. Huber, "Über den Nullpunkt der babylonischen Ekliptik", in: Centaurus
|
|
@@ -464,7 +464,7 @@ static const struct aya_init ayanamsa[SE_NSIDM_PREDEF] = {
|
|
|
464
464
|
{1673941, -5.079167, TRUE, -1}, // 13: Babylonian, Mercier
|
|
465
465
|
/*************************/
|
|
466
466
|
/* 14: t0 is defined by Aldebaran at 15 Taurus in year -100 */
|
|
467
|
-
{1684532.5, -4.44138598, TRUE, 0},
|
|
467
|
+
{1684532.5, -4.44138598, TRUE, 0}, // 14: Babylonian/Aldebaran = 15 Tau
|
|
468
468
|
/*************************/
|
|
469
469
|
/* 15: Hipparchos */
|
|
470
470
|
{1674484.0, -9.33333, TRUE, -1}, // 15: Hipparchos
|
|
@@ -476,34 +476,34 @@ static const struct aya_init ayanamsa[SE_NSIDM_PREDEF] = {
|
|
|
476
476
|
{0, 0, FALSE, 0}, // 17: Galactic Center at 0 Sagittarius
|
|
477
477
|
/*************************/
|
|
478
478
|
/* 18: J2000 */
|
|
479
|
-
{J2000, 0, FALSE, 0},
|
|
479
|
+
{J2000, 0, FALSE, 0}, // 18: J2000
|
|
480
480
|
/*************************/
|
|
481
481
|
/* 19: J1900 */
|
|
482
|
-
{J1900, 0, FALSE, 0},
|
|
482
|
+
{J1900, 0, FALSE, 0}, // 19: J1900
|
|
483
483
|
/*************************/
|
|
484
484
|
/* 20: B1950 */
|
|
485
|
-
{B1950, 0, FALSE, 0},
|
|
485
|
+
{B1950, 0, FALSE, 0}, // 20: B1950
|
|
486
486
|
/*************************/
|
|
487
487
|
/* 21: Suryasiddhanta, assuming ingress of mean Sun into Aries at point of mean
|
|
488
488
|
equinox of date on 21.3.499, near noon, Ujjain (75.7684565 E)
|
|
489
489
|
= 7:30:31.57 UT = 12:33:36 LMT*/
|
|
490
|
-
{1903396.8128654, 0, TRUE, 0}, // 21:
|
|
490
|
+
{1903396.8128654, 0, TRUE, 0}, // 21: Suryasiddhanta
|
|
491
491
|
/*************************/
|
|
492
492
|
/* 22: Suryasiddhanta, assuming ingress of mean Sun into Aries at true position
|
|
493
493
|
of mean Sun at same epoch */
|
|
494
|
-
{1903396.8128654,-0.21463395, TRUE, 0}, // 22:
|
|
494
|
+
{1903396.8128654,-0.21463395, TRUE, 0}, // 22: Suryasiddhanta, mean Sun
|
|
495
495
|
/*************************/
|
|
496
496
|
/* 23: Aryabhata, same date, but UT 6:56:55.57 analogous to 21 */
|
|
497
|
-
{1903396.7895321, 0, TRUE, 0}, // 23:
|
|
497
|
+
{1903396.7895321, 0, TRUE, 0}, // 23: Aryabhata
|
|
498
498
|
/*************************/
|
|
499
499
|
/* 24: Aryabhata, analogous 22 */
|
|
500
|
-
{1903396.7895321,-0.23763238, TRUE, 0}, // 24:
|
|
500
|
+
{1903396.7895321,-0.23763238, TRUE, 0}, // 24: Aryabhata, mean Sun
|
|
501
501
|
/*************************/
|
|
502
502
|
/* 25: Suryasiddhanta, Revati/zePsc at polar long. 359°50'*/
|
|
503
|
-
{1903396.8128654,-0.79167046, TRUE, 0}, // 25:
|
|
503
|
+
{1903396.8128654,-0.79167046, TRUE, 0}, // 25: SS Revati
|
|
504
504
|
/*************************/
|
|
505
505
|
/* 26: Suryasiddhanta, Citra/Spica at polar long. 180° */
|
|
506
|
-
{1903396.8128654, 2.11070444, TRUE, 0}, // 26:
|
|
506
|
+
{1903396.8128654, 2.11070444, TRUE, 0}, // 26: SS Citra
|
|
507
507
|
/*************************/
|
|
508
508
|
/* 27: True Citra (Spica exactly at 0 Libra) */
|
|
509
509
|
{0, 0, FALSE, 0}, // 27: True Citra
|