swisseph-wasm 0.0.1
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/DOCUMENTATION.md +888 -0
- package/LICENSE +41 -0
- package/QUICK_REFERENCE.md +263 -0
- package/README.md +305 -0
- package/examples/README.md +239 -0
- package/examples/basic-usage.js +301 -0
- package/examples/birth-chart.js +386 -0
- package/examples/demo.html +543 -0
- package/package.json +75 -0
- package/src/swisseph.js +1092 -0
- package/types/index.d.ts +255 -0
- package/wsam/swisseph.data +0 -0
- package/wsam/swisseph.js +3412 -0
- package/wsam/swisseph.wasm +0 -0
package/src/swisseph.js
ADDED
|
@@ -0,0 +1,1092 @@
|
|
|
1
|
+
import WasamSwissEph from '../wsam/swisseph.js';
|
|
2
|
+
|
|
3
|
+
class SwissEph {
|
|
4
|
+
// #region Constants
|
|
5
|
+
SE_AUNIT_TO_KM = 149597870.7;
|
|
6
|
+
SE_AUNIT_TO_LIGHTYEAR = 1.5812507409819728411242766893179e-5; // = 1.0 / 63241.07708427
|
|
7
|
+
SE_AUNIT_TO_PARSEC = 4.8481368110952742659276431719005e-6; // = 1.0 / 206264.8062471
|
|
8
|
+
|
|
9
|
+
SE_MAX_STNAME = 256;
|
|
10
|
+
|
|
11
|
+
SE_SIDBITS = 256;
|
|
12
|
+
SE_SIDBIT_ECL_T0 = 256;
|
|
13
|
+
SE_SIDBIT_SSY_PLANE = 512;
|
|
14
|
+
SE_SIDBIT_USER_UT = 1024;
|
|
15
|
+
|
|
16
|
+
SE_BIT_DISC_CENTER = 256;
|
|
17
|
+
SE_BIT_DISC_BOTTOM = 8192;
|
|
18
|
+
SE_BIT_GEOCTR_NO_ECL_LAT = 128;
|
|
19
|
+
SE_BIT_NO_REFRACTION = 512;
|
|
20
|
+
SE_BIT_CIVIL_TWILIGHT = 1024;
|
|
21
|
+
SE_BIT_NAUTIC_TWILIGHT = 2048;
|
|
22
|
+
SE_BIT_ASTRO_TWILIGHT = 4096;
|
|
23
|
+
SE_BIT_FIXED_DISC_SIZE = 16384; // = 16 * 1024
|
|
24
|
+
|
|
25
|
+
TJD_INVALID = 99999999.0;
|
|
26
|
+
SIMULATE_VICTORVB = 1;
|
|
27
|
+
|
|
28
|
+
SE_PHOTOPIC_FLAG = 0;
|
|
29
|
+
SE_SCOTOPIC_FLAG = 1;
|
|
30
|
+
SE_MIXEDOPIC_FLAG = 2;
|
|
31
|
+
|
|
32
|
+
ephemeris= {
|
|
33
|
+
swisseph: 2, // = SEFLG_SWIEPH
|
|
34
|
+
moshier: 4, // = SEFLG_MOSEPH
|
|
35
|
+
de200: "de200.eph",
|
|
36
|
+
de405: "de405.eph",
|
|
37
|
+
de406: "de406.eph",
|
|
38
|
+
de406e: "de406e.eph",
|
|
39
|
+
de414: "de414.eph",
|
|
40
|
+
de421: "de421.eph",
|
|
41
|
+
de422: "de422.eph",
|
|
42
|
+
de430: "de430.eph",
|
|
43
|
+
de431: "de431.eph",
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// Calendar types
|
|
47
|
+
SE_JUL_CAL = 0;
|
|
48
|
+
SE_GREG_CAL = 1;
|
|
49
|
+
|
|
50
|
+
// Planet numbers
|
|
51
|
+
SE_SUN = 0;
|
|
52
|
+
SE_MOON = 1;
|
|
53
|
+
SE_MERCURY = 2;
|
|
54
|
+
SE_VENUS = 3;
|
|
55
|
+
SE_EARTH = 14;
|
|
56
|
+
SE_MARS = 4;
|
|
57
|
+
SE_JUPITER = 5;
|
|
58
|
+
SE_SATURN = 6;
|
|
59
|
+
SE_URANUS = 7;
|
|
60
|
+
SE_NEPTUNE = 8;
|
|
61
|
+
SE_PLUTO = 9;
|
|
62
|
+
|
|
63
|
+
// Moon nodes
|
|
64
|
+
SE_MEAN_NODE = 10;
|
|
65
|
+
SE_TRUE_NODE = 11;
|
|
66
|
+
SE_MEAN_APOG = 12;
|
|
67
|
+
SE_OSCU_APOG = 13;
|
|
68
|
+
SE_INTP_APOG = 21;
|
|
69
|
+
SE_INTP_PERG = 22;
|
|
70
|
+
|
|
71
|
+
// Base asteroids
|
|
72
|
+
SE_CHIRON = 15;
|
|
73
|
+
SE_PHOLUS = 16;
|
|
74
|
+
SE_CERES = 17;
|
|
75
|
+
SE_PALLAS = 18;
|
|
76
|
+
SE_JUNO = 19;
|
|
77
|
+
SE_VESTA = 20;
|
|
78
|
+
|
|
79
|
+
SE_NPLANETS = 23;
|
|
80
|
+
SE_AST_OFFSET = 10000;
|
|
81
|
+
SE_VARUNA = 30000; // = SE_AST_OFFSET + 20000
|
|
82
|
+
SE_FICT_OFFSET = 40;
|
|
83
|
+
SE_FICT_OFFSET_1 = 39;
|
|
84
|
+
SE_FICT_MAX = 999;
|
|
85
|
+
SE_NFICT_ELEM = 15;
|
|
86
|
+
SE_COMET_OFFSET = 1000;
|
|
87
|
+
SE_NALL_NAT_POINTS = 38; // = SE_NPLANETS + SE_NFICT_ELEM
|
|
88
|
+
|
|
89
|
+
// Hamburger or Uranian "planets"
|
|
90
|
+
SE_CUPIDO = 40;
|
|
91
|
+
SE_HADES = 41;
|
|
92
|
+
SE_ZEUS = 42;
|
|
93
|
+
SE_KRONOS = 43;
|
|
94
|
+
SE_APOLLON = 44;
|
|
95
|
+
SE_ADMETOS = 45;
|
|
96
|
+
SE_VULKANUS = 46;
|
|
97
|
+
SE_POSEIDON = 47;
|
|
98
|
+
|
|
99
|
+
// Other fictitious bodies
|
|
100
|
+
SE_ISIS = 48;
|
|
101
|
+
SE_NIBIRU = 49;
|
|
102
|
+
SE_HARRINGTON = 50;
|
|
103
|
+
SE_NEPTUNE_LEVERRIER = 51;
|
|
104
|
+
SE_NEPTUNE_ADAMS = 52;
|
|
105
|
+
SE_PLUTO_LOWELL = 53;
|
|
106
|
+
SE_PLUTO_PICKERING = 54;
|
|
107
|
+
SE_VULCAN = 55;
|
|
108
|
+
SE_WHITE_MOON = 56;
|
|
109
|
+
SE_PROSERPINA = 57;
|
|
110
|
+
SE_WALDEMATH = 58;
|
|
111
|
+
|
|
112
|
+
SE_FIXSTAR = -10;
|
|
113
|
+
SE_ASC = 0;
|
|
114
|
+
SE_MC = 1;
|
|
115
|
+
SE_ARMC = 2;
|
|
116
|
+
SE_VERTEX = 3;
|
|
117
|
+
SE_EQUASC = 4;
|
|
118
|
+
SE_COASC1 = 5;
|
|
119
|
+
SE_COASC2 = 6;
|
|
120
|
+
SE_POLASC = 7;
|
|
121
|
+
SE_NASCMC = 8;
|
|
122
|
+
|
|
123
|
+
// Flag bits for "iflag" parameter of the "swe_calc" functions
|
|
124
|
+
SEFLG_JPLEPH = 1;
|
|
125
|
+
SEFLG_SWIEPH = 2;
|
|
126
|
+
SEFLG_MOSEPH = 4;
|
|
127
|
+
SEFLG_HELCTR = 8;
|
|
128
|
+
SEFLG_TRUEPOS = 16;
|
|
129
|
+
SEFLG_J2000 = 32;
|
|
130
|
+
SEFLG_NONUT = 64;
|
|
131
|
+
SEFLG_SPEED3 = 128;
|
|
132
|
+
SEFLG_SPEED = 256;
|
|
133
|
+
SEFLG_NOGDEFL = 512;
|
|
134
|
+
SEFLG_NOABERR = 1024;
|
|
135
|
+
SEFLG_ASTROMETRIC = 1536; // = SEFLG_NOABERR | SEFLG_NOGDEFL
|
|
136
|
+
SEFLG_EQUATORIAL = 2048; // = 2 *1024
|
|
137
|
+
SEFLG_XYZ = 4096; // = 4 * 1024
|
|
138
|
+
SEFLG_RADIANS = 8192; // = 8 * 1024
|
|
139
|
+
SEFLG_BARYCTR = 16384; // = 16 * 1024
|
|
140
|
+
SEFLG_TOPOCTR = 32768; // = 32 * 1024
|
|
141
|
+
SEFLG_ORBEL_AA = 32768; // = SEFLG_TOPOCTR
|
|
142
|
+
SEFLG_SIDEREAL = 65536; // = 64 * 1024
|
|
143
|
+
SEFLG_ICRS = 131072; // = 128 * 1024
|
|
144
|
+
SEFLG_DPSIDEPS_1980 = 262144; // = 256*1024
|
|
145
|
+
SEFLG_JPLHOR = 262144; // = SEFLG_DPSIDEPS_1980
|
|
146
|
+
SEFLG_JPLHOR_APPROX = 524288; // = 512*1024
|
|
147
|
+
SEFLG_DEFAULTEPH = 2; // = SEFLG_SWIEPH
|
|
148
|
+
|
|
149
|
+
// Sidereal modes
|
|
150
|
+
SE_SIDM_FAGAN_BRADLEY = 0;
|
|
151
|
+
SE_SIDM_LAHIRI = 1;
|
|
152
|
+
SE_SIDM_DELUCE = 2;
|
|
153
|
+
SE_SIDM_RAMAN = 3;
|
|
154
|
+
SE_SIDM_USHASHASHI = 4;
|
|
155
|
+
SE_SIDM_KRISHNAMURTI = 5;
|
|
156
|
+
SE_SIDM_DJWHAL_KHUL = 6;
|
|
157
|
+
SE_SIDM_YUKTESHWAR = 7;
|
|
158
|
+
SE_SIDM_JN_BHASIN = 8;
|
|
159
|
+
SE_SIDM_BABYL_KUGLER1 = 9;
|
|
160
|
+
SE_SIDM_BABYL_KUGLER2 = 10;
|
|
161
|
+
SE_SIDM_BABYL_KUGLER3 = 11;
|
|
162
|
+
SE_SIDM_BABYL_HUBER = 12;
|
|
163
|
+
SE_SIDM_BABYL_ETPSC = 13;
|
|
164
|
+
SE_SIDM_ALDEBARAN_15TAU = 14;
|
|
165
|
+
SE_SIDM_HIPPARCHOS = 15;
|
|
166
|
+
SE_SIDM_SASSANIAN = 16;
|
|
167
|
+
SE_SIDM_GALCENT_0SAG = 17;
|
|
168
|
+
SE_SIDM_J2000 = 18;
|
|
169
|
+
SE_SIDM_J1900 = 19;
|
|
170
|
+
SE_SIDM_B1950 = 20;
|
|
171
|
+
SE_SIDM_SURYASIDDHANTA = 21;
|
|
172
|
+
SE_SIDM_SURYASIDDHANTA_MSUN = 22;
|
|
173
|
+
SE_SIDM_ARYABHATA = 23;
|
|
174
|
+
SE_SIDM_ARYABHATA_MSUN = 24;
|
|
175
|
+
SE_SIDM_SS_REVATI = 25;
|
|
176
|
+
SE_SIDM_SS_CITRA = 26;
|
|
177
|
+
SE_SIDM_TRUE_CITRA = 27;
|
|
178
|
+
SE_SIDM_TRUE_REVATI = 28;
|
|
179
|
+
SE_SIDM_TRUE_PUSHYA = 29;
|
|
180
|
+
SE_SIDM_GALCENT_RGILBRAND = 30;
|
|
181
|
+
SE_SIDM_GALEQU_IAU1958 = 31;
|
|
182
|
+
SE_SIDM_GALEQU_TRUE = 32;
|
|
183
|
+
SE_SIDM_GALEQU_MULA = 33;
|
|
184
|
+
SE_SIDM_GALALIGN_MARDYKS = 34;
|
|
185
|
+
SE_SIDM_TRUE_MULA = 35;
|
|
186
|
+
SE_SIDM_GALCENT_MULA_WILHELM = 36;
|
|
187
|
+
SE_SIDM_ARYABHATA_522 = 37;
|
|
188
|
+
SE_SIDM_BABYL_BRITTON = 38;
|
|
189
|
+
SE_SIDM_TRUE_SHEORAN = 39;
|
|
190
|
+
SE_SIDM_GALCENT_COCHRANE = 40;
|
|
191
|
+
SE_SIDM_GALEQU_FIORENZA = 41;
|
|
192
|
+
SE_SIDM_VALENS_MOON = 42;
|
|
193
|
+
SE_SIDM_USER = 255;
|
|
194
|
+
SE_NSIDM_PREDEF = 43;
|
|
195
|
+
|
|
196
|
+
// Used for "swe_nod_aps" function
|
|
197
|
+
SE_NODBIT_MEAN = 1;
|
|
198
|
+
SE_NODBIT_OSCU = 2;
|
|
199
|
+
SE_NODBIT_OSCU_BAR = 4;
|
|
200
|
+
SE_NODBIT_FOPOINT = 256;
|
|
201
|
+
|
|
202
|
+
// Used for eclipse computations
|
|
203
|
+
SE_ECL_NUT = -1;
|
|
204
|
+
SE_ECL_CENTRAL = 1;
|
|
205
|
+
SE_ECL_NONCENTRAL = 2;
|
|
206
|
+
SE_ECL_TOTAL = 4;
|
|
207
|
+
SE_ECL_ANNULAR = 8;
|
|
208
|
+
SE_ECL_PARTIAL = 16;
|
|
209
|
+
SE_ECL_ANNULAR_TOTAL = 32;
|
|
210
|
+
SE_ECL_PENUMBRAL = 64;
|
|
211
|
+
SE_ECL_ALLTYPES_SOLAR = 63; // = SE_ECL_CENTRAL | SE_ECL_NONCENTRAL | SE_ECL_TOTAL | SE_ECL_ANNULAR | SE_ECL_PARTIAL | SE_ECL_ANNULAR_TOTAL
|
|
212
|
+
SE_ECL_ALLTYPES_LUNAR = 84; // = SE_ECL_TOTAL | SE_ECL_PARTIAL | SE_ECL_PENUMBRAL
|
|
213
|
+
SE_ECL_VISIBLE = 128;
|
|
214
|
+
SE_ECL_MAX_VISIBLE = 256;
|
|
215
|
+
SE_ECL_1ST_VISIBLE = 512;
|
|
216
|
+
SE_ECL_PARTBEG_VISIBLE = 512;
|
|
217
|
+
SE_ECL_2ND_VISIBLE = 1024;
|
|
218
|
+
SE_ECL_TOTBEG_VISIBLE = 1024;
|
|
219
|
+
SE_ECL_3RD_VISIBLE = 2048;
|
|
220
|
+
SE_ECL_TOTEND_VISIBLE = 2048;
|
|
221
|
+
SE_ECL_4TH_VISIBLE = 4096;
|
|
222
|
+
SE_ECL_PARTEND_VISIBLE = 4096;
|
|
223
|
+
SE_ECL_PENUMBBEG_VISIBLE = 8192;
|
|
224
|
+
SE_ECL_PENUMBEND_VISIBLE = 16384;
|
|
225
|
+
SE_ECL_OCC_BEG_DAYLIGHT = 8192;
|
|
226
|
+
SE_ECL_OCC_END_DAYLIGHT = 16384;
|
|
227
|
+
SE_ECL_ONE_TRY = 32768; // = 32 * 1024
|
|
228
|
+
|
|
229
|
+
// Used for "swe_rise_transit"
|
|
230
|
+
SE_CALC_RISE = 1;
|
|
231
|
+
SE_CALC_SET = 2;
|
|
232
|
+
SE_CALC_MTRANSIT = 4;
|
|
233
|
+
SE_CALC_ITRANSIT = 8;
|
|
234
|
+
|
|
235
|
+
// Used for "swe_azalt" and "swe_azalt_rev" functions
|
|
236
|
+
SE_ECL2HOR = 0;
|
|
237
|
+
SE_EQU2HOR = 1;
|
|
238
|
+
SE_HOR2ECL = 0;
|
|
239
|
+
SE_HOR2EQU = 1;
|
|
240
|
+
|
|
241
|
+
// Used for "swe_refrac" function
|
|
242
|
+
SE_TRUE_TO_APP = 0;
|
|
243
|
+
SE_APP_TO_TRUE = 1;
|
|
244
|
+
|
|
245
|
+
// Rounding flags for "swe_split_deg" function
|
|
246
|
+
SE_SPLIT_DEG_ROUND_SEC = 1;
|
|
247
|
+
SE_SPLIT_DEG_ROUND_MIN = 2;
|
|
248
|
+
SE_SPLIT_DEG_ROUND_DEG = 4;
|
|
249
|
+
SE_SPLIT_DEG_ZODIACAL = 8;
|
|
250
|
+
SE_SPLIT_DEG_KEEP_SIGN = 16;
|
|
251
|
+
SE_SPLIT_DEG_KEEP_DEG= 32;
|
|
252
|
+
SE_SPLIT_DEG_NAKSHATRA = 1024;
|
|
253
|
+
|
|
254
|
+
// Used for heliacal functions
|
|
255
|
+
SE_HELIACAL_RISING = 1;
|
|
256
|
+
SE_HELIACAL_SETTING = 2;
|
|
257
|
+
SE_MORNING_FIRST = 1; // = SE_HELIACAL_RISING
|
|
258
|
+
SE_EVENING_LAST = 2; // = SE_HELIACAL_SETTING
|
|
259
|
+
SE_EVENING_FIRST = 3;
|
|
260
|
+
SE_MORNING_LAST = 4;
|
|
261
|
+
SE_ACRONYCHAL_RISING = 5;
|
|
262
|
+
SE_ACRONYCHAL_SETTING = 6;
|
|
263
|
+
SE_COSMICAL_SETTING = 6; // = SE_ACRONYCHAL_SETTING
|
|
264
|
+
|
|
265
|
+
SE_HELFLAG_LONG_SEARCH = 128;
|
|
266
|
+
SE_HELFLAG_HIGH_PRECISION = 256;
|
|
267
|
+
SE_HELFLAG_OPTICAL_PARAMS = 512;
|
|
268
|
+
SE_HELFLAG_NO_DETAILS = 1024;
|
|
269
|
+
SE_HELFLAG_SEARCH_1_PERIOD = 2048; // = 1 << 11
|
|
270
|
+
SE_HELFLAG_VISLIM_DARK = 4096; // = 1 << 12
|
|
271
|
+
SE_HELFLAG_VISLIM_NOMOON = 8192; // = 1 << 13
|
|
272
|
+
SE_HELFLAG_VISLIM_PHOTOPIC = 16384; // = 1 << 14
|
|
273
|
+
SE_HELFLAG_AVKIND_VR = 32768; // = 1 << 15
|
|
274
|
+
SE_HELFLAG_AVKIND_PTO = 65536; // = 1 << 16
|
|
275
|
+
SE_HELFLAG_AVKIND_MIN7 = 131072; // = 1 << 17
|
|
276
|
+
SE_HELFLAG_AVKIND_MIN9 = 262144; // = 1 << 18
|
|
277
|
+
SE_HELFLAG_AVKIND = 491520; // = SE_HELFLAG_AVKIND_VR | SE_HELFLAG_AVKIND_PTO | SE_HELFLAG_AVKIND_MIN7 | SE_HELFLAG_AVKIND_MIN9
|
|
278
|
+
// #endregion Constants
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
// Initializes the Swiss Ephemeris WebAssembly module
|
|
282
|
+
async initSwissEph() {
|
|
283
|
+
this.SweModule = await WasamSwissEph();
|
|
284
|
+
this.set_ephe_path('sweph');
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
set_ephe_path(path) {
|
|
288
|
+
return this.SweModule.ccall('swe_set_ephe_path', 'string', ['string'], [path]);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
house_pos(armc, geoLat, eps, hsys, lon, lat) {
|
|
292
|
+
return this.SweModule.ccall('swe_houses_pos', 'number', ['number', 'number', 'number', 'string', 'number', 'number'], [armc, geoLat, eps, hsys, lon, lat]);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
julday(year, month, day, hour) {
|
|
296
|
+
return this.SweModule.ccall('swe_julday', 'number', ['number', 'number', 'number', 'number', 'number'], [year, month, day, hour, 1]);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
calc_ut(julianDay, body, flags) {
|
|
300
|
+
const buffer = this.SweModule._malloc(4 * Float64Array.BYTES_PER_ELEMENT);
|
|
301
|
+
this.SweModule.ccall('swe_calc_ut', 'number', ['number', 'number', 'number','pointer'], [julianDay, body, flags,buffer]);
|
|
302
|
+
const result = new Float64Array(this.SweModule.HEAPF64.buffer, buffer, 4);
|
|
303
|
+
this.SweModule._free(buffer);
|
|
304
|
+
return result;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
deltat(julianDay) {
|
|
308
|
+
return this.SweModule.ccall('swe_deltat', 'number', ['number'], [julianDay]);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
time_equ(julianDay) {
|
|
312
|
+
return this.SweModule.ccall('swe_time_equ', 'number', ['number'], [julianDay]);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
sidtime0(julianDay, eps, nut) {
|
|
316
|
+
return this.SweModule.ccall('swe_sidtime0', 'number', ['number', 'number', 'number'], [julianDay, eps, nut]);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
sidtime(julianDay) {
|
|
320
|
+
return this.SweModule.ccall('swe_sidtime', 'number', ['number'], [julianDay]);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
cotrans(xpo, eps) {
|
|
324
|
+
return this.SweModule.ccall('swe_cotrans', 'void', ['array', 'number'], [xpo, eps]);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
cotrans_sp(xpo, eps) {
|
|
328
|
+
return this.SweModule.ccall('swe_cotrans_sp', 'void', ['array', 'number'], [xpo, eps]);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
get_tid_acc() {
|
|
332
|
+
return this.SweModule.ccall('swe_get_tid_acc', 'number', [], []);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
set_tid_acc(acceleration) {
|
|
336
|
+
this.SweModule.ccall('swe_set_tid_acc', 'void', ['number'], [acceleration]);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
degnorm(x) {
|
|
340
|
+
return this.SweModule.ccall('swe_degnorm', 'number', ['number'], [x]);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
radnorm(x) {
|
|
344
|
+
return this.SweModule.ccall('swe_radnorm', 'number', ['number'], [x]);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
rad_midp(x1, x2) {
|
|
348
|
+
return this.SweModule.ccall('swe_rad_midp', 'number', ['number', 'number'], [x1, x2]);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
deg_midp(x1, x2) {
|
|
352
|
+
return this.SweModule.ccall('swe_deg_midp', 'number', ['number', 'number'], [x1, x2]);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
split_deg(ddeg, roundFlag) {
|
|
356
|
+
const resultPtr = this.SweModule._malloc(5 * Float64Array.BYTES_PER_ELEMENT);
|
|
357
|
+
this.SweModule.ccall('swe_split_deg', 'void', ['number', 'number', 'pointer'], [ddeg, roundFlag, resultPtr]);
|
|
358
|
+
const result = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 5);
|
|
359
|
+
this.SweModule._free(resultPtr);
|
|
360
|
+
return {
|
|
361
|
+
degree: result[0],
|
|
362
|
+
min: result[1],
|
|
363
|
+
second: result[2],
|
|
364
|
+
fraction: result[3],
|
|
365
|
+
sign: result[4],
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
csnorm(p) {
|
|
370
|
+
return this.SweModule.ccall('swe_csnorm', 'number', ['number'], [p]);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
difcsn(p1, p2) {
|
|
374
|
+
return this.SweModule.ccall('swe_difcsn', 'number', ['number', 'number'], [p1, p2]);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
difdegn(p1, p2) {
|
|
378
|
+
return this.SweModule.ccall('swe_difdegn', 'number', ['number', 'number'], [p1, p2]);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
difcs2n(p1, p2) {
|
|
382
|
+
return this.SweModule.ccall('swe_difcs2n', 'number', ['number', 'number'], [p1, p2]);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
difdeg2n(p1, p2) {
|
|
386
|
+
return this.SweModule.ccall('swe_difdeg2n', 'number', ['number', 'number'], [p1, p2]);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
difrad2n(p1, p2) {
|
|
390
|
+
return this.SweModule.ccall('swe_difrad2n', 'number', ['number', 'number'], [p1, p2]);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
csroundsec(x) {
|
|
394
|
+
return this.SweModule.ccall('swe_csroundsec', 'number', ['number'], [x]);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
d2l(x) {
|
|
398
|
+
return this.SweModule.ccall('swe_d2l', 'number', ['number'], [x]);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
day_of_week(julianDay) {
|
|
402
|
+
return this.SweModule.ccall('swe_day_of_week', 'number', ['number'], [julianDay]);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
cs2timestr(t, sep, suppressZero) {
|
|
406
|
+
return this.SweModule.ccall('swe_cs2timestr', 'string', ['number', 'number', 'number'], [t, sep, suppressZero]);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
cs2lonlatstr(t, pChar, mChar) {
|
|
410
|
+
return this.SweModule.ccall('swe_cs2lonlatstr', 'string', ['number', 'string', 'string'], [t, pChar, mChar]);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
cs2degstr(t) {
|
|
414
|
+
return this.SweModule.ccall('swe_cs2degstr', 'string', ['number'], [t]);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
date_conversion(year, month, day, hour, gregflag) {
|
|
418
|
+
const julianDay = this.SweModule.ccall(
|
|
419
|
+
'swe_date_conversion',
|
|
420
|
+
'number',
|
|
421
|
+
['number', 'number', 'number', 'number', 'number'],
|
|
422
|
+
[year, month, day, hour, gregflag]
|
|
423
|
+
);
|
|
424
|
+
return julianDay;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
revjul(julianDay, gregflag) {
|
|
428
|
+
const buffer = this.SweModule._malloc(4 * Float64Array.BYTES_PER_ELEMENT);
|
|
429
|
+
this.SweModule.ccall(
|
|
430
|
+
'swe_revjul',
|
|
431
|
+
'void',
|
|
432
|
+
['number', 'number', 'pointer'],
|
|
433
|
+
[julianDay, gregflag, buffer]
|
|
434
|
+
);
|
|
435
|
+
const result = new Float64Array(this.SweModule.HEAPF64.buffer, buffer, 4);
|
|
436
|
+
this.SweModule._free(buffer);
|
|
437
|
+
return {
|
|
438
|
+
year: result[0],
|
|
439
|
+
month: result[1],
|
|
440
|
+
day: result[2],
|
|
441
|
+
hour: result[3],
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
utc_to_jd(year, month, day, hour, minute, second, gregflag) {
|
|
446
|
+
const resultPtr = this.SweModule._malloc(2 * Float64Array.BYTES_PER_ELEMENT);
|
|
447
|
+
this.SweModule.ccall(
|
|
448
|
+
'swe_utc_to_jd',
|
|
449
|
+
'void',
|
|
450
|
+
['number', 'number', 'number', 'number', 'number', 'number', 'number', 'pointer'],
|
|
451
|
+
[year, month, day, hour, minute, second, gregflag, resultPtr]
|
|
452
|
+
);
|
|
453
|
+
const result = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 2);
|
|
454
|
+
this.SweModule._free(resultPtr);
|
|
455
|
+
return {
|
|
456
|
+
julianDayET: result[0],
|
|
457
|
+
julianDayUT: result[1],
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
jdet_to_utc(julianDay, gregflag) {
|
|
462
|
+
const resultPtr = this.SweModule._malloc(6 * Float64Array.BYTES_PER_ELEMENT);
|
|
463
|
+
this.SweModule.ccall(
|
|
464
|
+
'swe_jdet_to_utc',
|
|
465
|
+
'void',
|
|
466
|
+
['number', 'number', 'pointer'],
|
|
467
|
+
[julianDay, gregflag, resultPtr]
|
|
468
|
+
);
|
|
469
|
+
const result = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 6);
|
|
470
|
+
this.SweModule._free(resultPtr);
|
|
471
|
+
return {
|
|
472
|
+
year: result[0],
|
|
473
|
+
month: result[1],
|
|
474
|
+
day: result[2],
|
|
475
|
+
hour: result[3],
|
|
476
|
+
minute: result[4],
|
|
477
|
+
second: result[5],
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
jdut1_to_utc(julianDay, gregflag) {
|
|
482
|
+
const resultPtr = this.SweModule._malloc(6 * Float64Array.BYTES_PER_ELEMENT);
|
|
483
|
+
this.SweModule.ccall(
|
|
484
|
+
'swe_jdut1_to_utc',
|
|
485
|
+
'void',
|
|
486
|
+
['number', 'number', 'pointer'],
|
|
487
|
+
[julianDay, gregflag, resultPtr]
|
|
488
|
+
);
|
|
489
|
+
const result = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 6);
|
|
490
|
+
this.SweModule._free(resultPtr);
|
|
491
|
+
return {
|
|
492
|
+
year: result[0],
|
|
493
|
+
month: result[1],
|
|
494
|
+
day: result[2],
|
|
495
|
+
hour: result[3],
|
|
496
|
+
minute: result[4],
|
|
497
|
+
second: result[5],
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
utc_time_zone(year, month, day, hour, minute, second, timezone) {
|
|
502
|
+
const resultPtr = this.SweModule._malloc(6 * Float64Array.BYTES_PER_ELEMENT);
|
|
503
|
+
this.SweModule.ccall(
|
|
504
|
+
'swe_utc_time_zone',
|
|
505
|
+
'void',
|
|
506
|
+
['number', 'number', 'number', 'number', 'number', 'number', 'number', 'pointer'],
|
|
507
|
+
[year, month, day, hour, minute, second, timezone, resultPtr]
|
|
508
|
+
);
|
|
509
|
+
const result = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 6);
|
|
510
|
+
this.SweModule._free(resultPtr);
|
|
511
|
+
return {
|
|
512
|
+
year: result[0],
|
|
513
|
+
month: result[1],
|
|
514
|
+
day: result[2],
|
|
515
|
+
hour: result[3],
|
|
516
|
+
minute: result[4],
|
|
517
|
+
second: result[5],
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
version() {
|
|
522
|
+
return this.SweModule.ccall('swe_version', 'string', [], []);
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
calc(julianDay, body, flags) {
|
|
526
|
+
const resultPtr = this.SweModule._malloc(6 * Float64Array.BYTES_PER_ELEMENT);
|
|
527
|
+
const errorBuffer = this.SweModule._malloc(256);
|
|
528
|
+
const retFlag = this.SweModule.ccall(
|
|
529
|
+
'swe_calc',
|
|
530
|
+
'number',
|
|
531
|
+
['number', 'number', 'number', 'pointer', 'pointer'],
|
|
532
|
+
[julianDay, body, flags, resultPtr, errorBuffer]
|
|
533
|
+
);
|
|
534
|
+
if (retFlag < 0) {
|
|
535
|
+
const error = this.SweModule.UTF8ToString(errorBuffer);
|
|
536
|
+
this.SweModule._free(resultPtr);
|
|
537
|
+
this.SweModule._free(errorBuffer);
|
|
538
|
+
throw new Error(`Error in swe_calc: ${error}`);
|
|
539
|
+
}
|
|
540
|
+
const results = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 6);
|
|
541
|
+
this.SweModule._free(resultPtr);
|
|
542
|
+
this.SweModule._free(errorBuffer);
|
|
543
|
+
return {
|
|
544
|
+
longitude: results[0],
|
|
545
|
+
latitude: results[1],
|
|
546
|
+
distance: results[2],
|
|
547
|
+
longitudeSpeed: results[3],
|
|
548
|
+
latitudeSpeed: results[4],
|
|
549
|
+
distanceSpeed: results[5],
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
fixstar(star, julianDay, flags) {
|
|
554
|
+
const resultPtr = this.SweModule._malloc(6 * Float64Array.BYTES_PER_ELEMENT);
|
|
555
|
+
const starBuffer = this.SweModule._malloc(star.length + 1);
|
|
556
|
+
this.SweModule.stringToUTF8(star, starBuffer, star.length + 1);
|
|
557
|
+
const retFlag = this.SweModule.ccall(
|
|
558
|
+
'swe_fixstar',
|
|
559
|
+
'number',
|
|
560
|
+
['pointer', 'number', 'number', 'pointer'],
|
|
561
|
+
[starBuffer, julianDay, flags, resultPtr]
|
|
562
|
+
);
|
|
563
|
+
const results = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 6);
|
|
564
|
+
this.SweModule._free(starBuffer);
|
|
565
|
+
this.SweModule._free(resultPtr);
|
|
566
|
+
return retFlag < 0 ? null : results;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
fixstar_mag(star) {
|
|
570
|
+
const magBuffer = this.SweModule._malloc(8);
|
|
571
|
+
const starBuffer = this.SweModule._malloc(star.length + 1);
|
|
572
|
+
this.SweModule.stringToUTF8(star, starBuffer, star.length + 1);
|
|
573
|
+
const retFlag = this.SweModule.ccall(
|
|
574
|
+
'swe_fixstar_mag',
|
|
575
|
+
'number',
|
|
576
|
+
['pointer', 'pointer'],
|
|
577
|
+
[starBuffer, magBuffer]
|
|
578
|
+
);
|
|
579
|
+
const magnitude = this.SweModule.HEAPF64[magBuffer / 8];
|
|
580
|
+
this.SweModule._free(starBuffer);
|
|
581
|
+
this.SweModule._free(magBuffer);
|
|
582
|
+
return retFlag < 0 ? null : magnitude;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
fixstar2(star, julianDay, flags) {
|
|
586
|
+
const resultPtr = this.SweModule._malloc(6 * Float64Array.BYTES_PER_ELEMENT);
|
|
587
|
+
const starBuffer = this.SweModule._malloc(star.length + 1);
|
|
588
|
+
this.SweModule.stringToUTF8(star, starBuffer, star.length + 1);
|
|
589
|
+
const retFlag = this.SweModule.ccall(
|
|
590
|
+
'swe_fixstar2',
|
|
591
|
+
'number',
|
|
592
|
+
['pointer', 'number', 'number', 'pointer'],
|
|
593
|
+
[starBuffer, julianDay, flags, resultPtr]
|
|
594
|
+
);
|
|
595
|
+
const results = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 6);
|
|
596
|
+
this.SweModule._free(starBuffer);
|
|
597
|
+
this.SweModule._free(resultPtr);
|
|
598
|
+
return retFlag < 0 ? null : results;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
fixstar2_ut(star, julianDay, flags) {
|
|
602
|
+
const resultPtr = this.SweModule._malloc(6 * Float64Array.BYTES_PER_ELEMENT);
|
|
603
|
+
const starBuffer = this.SweModule._malloc(star.length + 1);
|
|
604
|
+
this.SweModule.stringToUTF8(star, starBuffer, star.length + 1);
|
|
605
|
+
const retFlag = this.SweModule.ccall(
|
|
606
|
+
'swe_fixstar2_ut',
|
|
607
|
+
'number',
|
|
608
|
+
['pointer', 'number', 'number', 'pointer'],
|
|
609
|
+
[starBuffer, julianDay, flags, resultPtr]
|
|
610
|
+
);
|
|
611
|
+
const results = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 6);
|
|
612
|
+
this.SweModule._free(starBuffer);
|
|
613
|
+
this.SweModule._free(resultPtr);
|
|
614
|
+
return retFlag < 0 ? null : results;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
fixstar2_mag(star) {
|
|
618
|
+
const magBuffer = this.SweModule._malloc(8);
|
|
619
|
+
const starBuffer = this.SweModule._malloc(star.length + 1);
|
|
620
|
+
this.SweModule.stringToUTF8(star, starBuffer, star.length + 1);
|
|
621
|
+
const retFlag = this.SweModule.ccall(
|
|
622
|
+
'swe_fixstar2_mag',
|
|
623
|
+
'number',
|
|
624
|
+
['pointer', 'pointer'],
|
|
625
|
+
[starBuffer, magBuffer]
|
|
626
|
+
);
|
|
627
|
+
const magnitude = this.SweModule.HEAPF64[magBuffer / 8];
|
|
628
|
+
this.SweModule._free(starBuffer);
|
|
629
|
+
this.SweModule._free(magBuffer);
|
|
630
|
+
return retFlag < 0 ? null : magnitude;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
close() {
|
|
634
|
+
this.SweModule.ccall('swe_close', 'void', [], []);
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
set_jpl_file(filename) {
|
|
638
|
+
const fileBuffer = this.SweModule._malloc(filename.length + 1);
|
|
639
|
+
this.SweModule.stringToUTF8(filename, fileBuffer, filename.length + 1);
|
|
640
|
+
const result = this.SweModule.ccall(
|
|
641
|
+
'swe_set_jpl_file',
|
|
642
|
+
'string',
|
|
643
|
+
['pointer'],
|
|
644
|
+
[fileBuffer]
|
|
645
|
+
);
|
|
646
|
+
this.SweModule._free(fileBuffer);
|
|
647
|
+
return result;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
get_planet_name(planetId) {
|
|
651
|
+
return this.SweModule.ccall(
|
|
652
|
+
'swe_get_planet_name',
|
|
653
|
+
'string',
|
|
654
|
+
['number'],
|
|
655
|
+
[planetId]
|
|
656
|
+
);
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
set_topo(longitude, latitude, altitude) {
|
|
660
|
+
this.SweModule.ccall(
|
|
661
|
+
'swe_set_topo',
|
|
662
|
+
'void',
|
|
663
|
+
['number', 'number', 'number'],
|
|
664
|
+
[longitude, latitude, altitude]
|
|
665
|
+
);
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
set_sid_mode(sidMode, t0, ayanT0) {
|
|
669
|
+
this.SweModule.ccall(
|
|
670
|
+
'swe_set_sid_mode',
|
|
671
|
+
'void',
|
|
672
|
+
['number', 'number', 'number'],
|
|
673
|
+
[sidMode, t0, ayanT0]
|
|
674
|
+
);
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
get_ayanamsa(julianDay) {
|
|
678
|
+
return this.SweModule.ccall(
|
|
679
|
+
'swe_get_ayanamsa',
|
|
680
|
+
'number',
|
|
681
|
+
['number'],
|
|
682
|
+
[julianDay]
|
|
683
|
+
);
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
get_ayanamsa_ut(julianDay) {
|
|
687
|
+
return this.SweModule.ccall(
|
|
688
|
+
'swe_get_ayanamsa_ut',
|
|
689
|
+
'number',
|
|
690
|
+
['number'],
|
|
691
|
+
[julianDay]
|
|
692
|
+
);
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
get_ayanamsa_ex(julianDay, ephemerisFlag) {
|
|
696
|
+
const resultPtr = this.SweModule._malloc(8);
|
|
697
|
+
const retFlag = this.SweModule.ccall(
|
|
698
|
+
'swe_get_ayanamsa_ex',
|
|
699
|
+
'number',
|
|
700
|
+
['number', 'number', 'pointer'],
|
|
701
|
+
[julianDay, ephemerisFlag, resultPtr]
|
|
702
|
+
);
|
|
703
|
+
const result = this.SweModule.HEAPF64[resultPtr / 8];
|
|
704
|
+
this.SweModule._free(resultPtr);
|
|
705
|
+
return retFlag < 0 ? null : result;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
get_ayanamsa_ex_ut(julianDay, ephemerisFlag) {
|
|
709
|
+
const resultPtr = this.SweModule._malloc(8);
|
|
710
|
+
const retFlag = this.SweModule.ccall(
|
|
711
|
+
'swe_get_ayanamsa_ex_ut',
|
|
712
|
+
'number',
|
|
713
|
+
['number', 'number', 'pointer'],
|
|
714
|
+
[julianDay, ephemerisFlag, resultPtr]
|
|
715
|
+
);
|
|
716
|
+
const result = this.SweModule.HEAPF64[resultPtr / 8];
|
|
717
|
+
this.SweModule._free(resultPtr);
|
|
718
|
+
return retFlag < 0 ? null : result;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
get_ayanamsa_name(siderealMode) {
|
|
722
|
+
return this.SweModule.ccall(
|
|
723
|
+
'swe_get_ayanamsa_name',
|
|
724
|
+
'string',
|
|
725
|
+
['number'],
|
|
726
|
+
[siderealMode]
|
|
727
|
+
);
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
nod_aps(julianDay, planet, flags, method) {
|
|
731
|
+
return this.SweModule.ccall(
|
|
732
|
+
'swe_nod_aps',
|
|
733
|
+
'number',
|
|
734
|
+
['number', 'number', 'number', 'number'],
|
|
735
|
+
[julianDay, planet, flags, method]
|
|
736
|
+
);
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
nod_aps_ut(julianDay, planet, flags, method) {
|
|
740
|
+
return this.SweModule.ccall(
|
|
741
|
+
'swe_nod_aps_ut',
|
|
742
|
+
'number',
|
|
743
|
+
['number', 'number', 'number', 'number'],
|
|
744
|
+
[julianDay, planet, flags, method]
|
|
745
|
+
);
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
get_orbital_elements(julianDay, planet, flags) {
|
|
749
|
+
return this.SweModule.ccall(
|
|
750
|
+
'swe_get_orbital_elements',
|
|
751
|
+
'number',
|
|
752
|
+
['number', 'number', 'number'],
|
|
753
|
+
[julianDay, planet, flags]
|
|
754
|
+
);
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
orbit_max_min_true_distance(julianDay, planet, flags) {
|
|
758
|
+
return this.SweModule.ccall(
|
|
759
|
+
'swe_orbit_max_min_true_distance',
|
|
760
|
+
'number',
|
|
761
|
+
['number', 'number', 'number'],
|
|
762
|
+
[julianDay, planet, flags]
|
|
763
|
+
);
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
heliacal_ut(julianDayStart, geoPos, atmosData, observerData, objectName, eventType, flags) {
|
|
767
|
+
return this.SweModule.ccall(
|
|
768
|
+
'swe_heliacal_ut',
|
|
769
|
+
'number',
|
|
770
|
+
['number', 'array', 'array', 'array', 'string', 'number', 'number'],
|
|
771
|
+
[julianDayStart, geoPos, atmosData, observerData, objectName, eventType, flags]
|
|
772
|
+
);
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
heliacal_pheno_ut(julianDay, geoPos, atmosData, observerData, objectName, eventType, heliacalFlag) {
|
|
776
|
+
return this.SweModule.ccall(
|
|
777
|
+
'swe_heliacal_pheno_ut',
|
|
778
|
+
'number',
|
|
779
|
+
['number', 'array', 'array', 'array', 'string', 'number', 'number'],
|
|
780
|
+
[julianDay, geoPos, atmosData, observerData, objectName, eventType, heliacalFlag]
|
|
781
|
+
);
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
vis_limit_mag(julianDay, geoPos, atmosData, observerData, objectName, heliacalFlag) {
|
|
785
|
+
return this.SweModule.ccall(
|
|
786
|
+
'swe_vis_limit_mag',
|
|
787
|
+
'number',
|
|
788
|
+
['number', 'array', 'array', 'array', 'string', 'number'],
|
|
789
|
+
[julianDay, geoPos, atmosData, observerData, objectName, heliacalFlag]
|
|
790
|
+
);
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
houses(julianDay, geoLat, geoLon, houseSystem) {
|
|
794
|
+
return this.SweModule.ccall(
|
|
795
|
+
'swe_houses',
|
|
796
|
+
'number',
|
|
797
|
+
['number', 'number', 'number', 'string'],
|
|
798
|
+
[julianDay, geoLat, geoLon, houseSystem]
|
|
799
|
+
);
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
houses_ex(julianDay, iflag, geoLat, geoLon, houseSystem) {
|
|
803
|
+
return this.SweModule.ccall(
|
|
804
|
+
'swe_houses_ex',
|
|
805
|
+
'number',
|
|
806
|
+
['number', 'number', 'number', 'number', 'string'],
|
|
807
|
+
[julianDay, iflag, geoLat, geoLon, houseSystem]
|
|
808
|
+
);
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
houses_ex2(julianDay, iflag, geoLat, geoLon, houseSystem) {
|
|
812
|
+
return this.SweModule.ccall(
|
|
813
|
+
'swe_houses_ex2',
|
|
814
|
+
'number',
|
|
815
|
+
['number', 'number', 'number', 'number', 'string'],
|
|
816
|
+
[julianDay, iflag, geoLat, geoLon, houseSystem]
|
|
817
|
+
);
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
houses_armc(armc, geoLat, eps, houseSystem) {
|
|
821
|
+
return this.SweModule.ccall(
|
|
822
|
+
'swe_houses_armc',
|
|
823
|
+
'number',
|
|
824
|
+
['number', 'number', 'number', 'string'],
|
|
825
|
+
[armc, geoLat, eps, houseSystem]
|
|
826
|
+
);
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
houses_armc_ex2(armc, geoLat, eps, houseSystem) {
|
|
830
|
+
return this.SweModule.ccall(
|
|
831
|
+
'swe_houses_armc_ex2',
|
|
832
|
+
'number',
|
|
833
|
+
['number', 'number', 'number', 'string'],
|
|
834
|
+
[armc, geoLat, eps, houseSystem]
|
|
835
|
+
);
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
sol_eclipse_where(julianDay, flags) {
|
|
839
|
+
const resultPtr = this.SweModule._malloc(8 * Float64Array.BYTES_PER_ELEMENT);
|
|
840
|
+
const retFlag = this.SweModule.ccall(
|
|
841
|
+
'swe_sol_eclipse_where',
|
|
842
|
+
'number',
|
|
843
|
+
['number', 'number', 'pointer'],
|
|
844
|
+
[julianDay, flags, resultPtr]
|
|
845
|
+
);
|
|
846
|
+
const results = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 8);
|
|
847
|
+
this.SweModule._free(resultPtr);
|
|
848
|
+
return retFlag < 0 ? null : results;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
lun_occult_where(julianDay, planet, starName, flags) {
|
|
852
|
+
const resultPtr = this.SweModule._malloc(8 * Float64Array.BYTES_PER_ELEMENT);
|
|
853
|
+
const starBuffer = this.SweModule._malloc(starName.length + 1);
|
|
854
|
+
this.SweModule.stringToUTF8(starName, starBuffer, starName.length + 1);
|
|
855
|
+
const retFlag = this.SweModule.ccall(
|
|
856
|
+
'swe_lun_occult_where',
|
|
857
|
+
'number',
|
|
858
|
+
['number', 'number', 'pointer', 'number', 'pointer'],
|
|
859
|
+
[julianDay, planet, starBuffer, flags, resultPtr]
|
|
860
|
+
);
|
|
861
|
+
const results = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 8);
|
|
862
|
+
this.SweModule._free(starBuffer);
|
|
863
|
+
this.SweModule._free(resultPtr);
|
|
864
|
+
return retFlag < 0 ? null : results;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
sol_eclipse_how(julianDay, flags, longitude, latitude, altitude) {
|
|
868
|
+
const resultPtr = this.SweModule._malloc(8 * Float64Array.BYTES_PER_ELEMENT);
|
|
869
|
+
const retFlag = this.SweModule.ccall(
|
|
870
|
+
'swe_sol_eclipse_how',
|
|
871
|
+
'number',
|
|
872
|
+
['number', 'number', 'number', 'number', 'number', 'pointer'],
|
|
873
|
+
[julianDay, flags, longitude, latitude, altitude, resultPtr]
|
|
874
|
+
);
|
|
875
|
+
const results = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 8);
|
|
876
|
+
this.SweModule._free(resultPtr);
|
|
877
|
+
return retFlag < 0 ? null : results;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
sol_eclipse_when_loc(julianDayStart, flags, longitude, latitude, altitude, backward) {
|
|
881
|
+
const resultPtr = this.SweModule._malloc(8 * Float64Array.BYTES_PER_ELEMENT);
|
|
882
|
+
const retFlag = this.SweModule.ccall(
|
|
883
|
+
'swe_sol_eclipse_when_loc',
|
|
884
|
+
'number',
|
|
885
|
+
['number', 'number', 'number', 'number', 'number', 'number', 'pointer'],
|
|
886
|
+
[julianDayStart, flags, longitude, latitude, altitude, backward, resultPtr]
|
|
887
|
+
);
|
|
888
|
+
const results = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 8);
|
|
889
|
+
this.SweModule._free(resultPtr);
|
|
890
|
+
return retFlag < 0 ? null : results;
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
lun_occult_when_loc(julianDayStart, planet, starName, flags, longitude, latitude, altitude, backward) {
|
|
894
|
+
const resultPtr = this.SweModule._malloc(8 * Float64Array.BYTES_PER_ELEMENT);
|
|
895
|
+
const starBuffer = this.SweModule._malloc(starName.length + 1);
|
|
896
|
+
this.SweModule.stringToUTF8(starName, starBuffer, starName.length + 1);
|
|
897
|
+
const retFlag = this.SweModule.ccall(
|
|
898
|
+
'swe_lun_occult_when_loc',
|
|
899
|
+
'number',
|
|
900
|
+
['number', 'number', 'pointer', 'number', 'number', 'number', 'number', 'number', 'pointer'],
|
|
901
|
+
[julianDayStart, planet, starBuffer, flags, longitude, latitude, altitude, backward, resultPtr]
|
|
902
|
+
);
|
|
903
|
+
const results = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 8);
|
|
904
|
+
this.SweModule._free(starBuffer);
|
|
905
|
+
this.SweModule._free(resultPtr);
|
|
906
|
+
return retFlag < 0 ? null : results;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
sol_eclipse_when_glob(julianDayStart, flags, eclipseType, backward) {
|
|
910
|
+
const resultPtr = this.SweModule._malloc(8 * Float64Array.BYTES_PER_ELEMENT);
|
|
911
|
+
const retFlag = this.SweModule.ccall(
|
|
912
|
+
'swe_sol_eclipse_when_glob',
|
|
913
|
+
'number',
|
|
914
|
+
['number', 'number', 'number', 'number', 'pointer'],
|
|
915
|
+
[julianDayStart, flags, eclipseType, backward, resultPtr]
|
|
916
|
+
);
|
|
917
|
+
const results = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 8);
|
|
918
|
+
this.SweModule._free(resultPtr);
|
|
919
|
+
return retFlag < 0 ? null : results;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
lun_occult_when_glob(julianDayStart, planet, starName, flags, eclipseType, backward) {
|
|
923
|
+
const resultPtr = this.SweModule._malloc(8 * Float64Array.BYTES_PER_ELEMENT);
|
|
924
|
+
const starBuffer = this.SweModule._malloc(starName.length + 1);
|
|
925
|
+
this.SweModule.stringToUTF8(starName, starBuffer, starName.length + 1);
|
|
926
|
+
const retFlag = this.SweModule.ccall(
|
|
927
|
+
'swe_lun_occult_when_glob',
|
|
928
|
+
'number',
|
|
929
|
+
['number', 'number', 'pointer', 'number', 'number', 'number', 'pointer'],
|
|
930
|
+
[julianDayStart, planet, starBuffer, flags, eclipseType, backward, resultPtr]
|
|
931
|
+
);
|
|
932
|
+
const results = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 8);
|
|
933
|
+
this.SweModule._free(starBuffer);
|
|
934
|
+
this.SweModule._free(resultPtr);
|
|
935
|
+
return retFlag < 0 ? null : results;
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
lun_eclipse_how(julianDay, flags, longitude, latitude, altitude) {
|
|
939
|
+
const resultPtr = this.SweModule._malloc(8 * Float64Array.BYTES_PER_ELEMENT);
|
|
940
|
+
const retFlag = this.SweModule.ccall(
|
|
941
|
+
'swe_lun_eclipse_how',
|
|
942
|
+
'number',
|
|
943
|
+
['number', 'number', 'number', 'number', 'number', 'pointer'],
|
|
944
|
+
[julianDay, flags, longitude, latitude, altitude, resultPtr]
|
|
945
|
+
);
|
|
946
|
+
const results = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 8);
|
|
947
|
+
this.SweModule._free(resultPtr);
|
|
948
|
+
return retFlag < 0 ? null : results;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
lun_eclipse_when(julianDayStart, flags, eclipseType, backward) {
|
|
952
|
+
const resultPtr = this.SweModule._malloc(8 * Float64Array.BYTES_PER_ELEMENT);
|
|
953
|
+
const retFlag = this.SweModule.ccall(
|
|
954
|
+
'swe_lun_eclipse_when',
|
|
955
|
+
'number',
|
|
956
|
+
['number', 'number', 'number', 'number', 'pointer'],
|
|
957
|
+
[julianDayStart, flags, eclipseType, backward, resultPtr]
|
|
958
|
+
);
|
|
959
|
+
const results = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 8);
|
|
960
|
+
this.SweModule._free(resultPtr);
|
|
961
|
+
return retFlag < 0 ? null : results;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
lun_eclipse_when_loc(julianDayStart, flags, longitude, latitude, altitude, backward) {
|
|
965
|
+
const resultPtr = this.SweModule._malloc(8 * Float64Array.BYTES_PER_ELEMENT);
|
|
966
|
+
const retFlag = this.SweModule.ccall(
|
|
967
|
+
'swe_lun_eclipse_when_loc',
|
|
968
|
+
'number',
|
|
969
|
+
['number', 'number', 'number', 'number', 'number', 'number', 'pointer'],
|
|
970
|
+
[julianDayStart, flags, longitude, latitude, altitude, backward, resultPtr]
|
|
971
|
+
);
|
|
972
|
+
const results = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 8);
|
|
973
|
+
this.SweModule._free(resultPtr);
|
|
974
|
+
return retFlag < 0 ? null : results;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
pheno(julianDay, planet, flags) {
|
|
978
|
+
const resultPtr = this.SweModule._malloc(8 * Float64Array.BYTES_PER_ELEMENT);
|
|
979
|
+
const retFlag = this.SweModule.ccall(
|
|
980
|
+
'swe_pheno',
|
|
981
|
+
'number',
|
|
982
|
+
['number', 'number', 'number', 'pointer'],
|
|
983
|
+
[julianDay, planet, flags, resultPtr]
|
|
984
|
+
);
|
|
985
|
+
const results = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 8);
|
|
986
|
+
this.SweModule._free(resultPtr);
|
|
987
|
+
return retFlag < 0 ? null : results;
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
pheno_ut(julianDay, planet, flags) {
|
|
991
|
+
const resultPtr = this.SweModule._malloc(8 * Float64Array.BYTES_PER_ELEMENT);
|
|
992
|
+
const retFlag = this.SweModule.ccall(
|
|
993
|
+
'swe_pheno_ut',
|
|
994
|
+
'number',
|
|
995
|
+
['number', 'number', 'number', 'pointer'],
|
|
996
|
+
[julianDay, planet, flags, resultPtr]
|
|
997
|
+
);
|
|
998
|
+
const results = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 8);
|
|
999
|
+
this.SweModule._free(resultPtr);
|
|
1000
|
+
return retFlag < 0 ? null : results;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
refrac(julianDay, geoLat, geoLon, altitude, pressure, temperature) {
|
|
1004
|
+
const resultPtr = this.SweModule._malloc(4 * Float64Array.BYTES_PER_ELEMENT);
|
|
1005
|
+
const retFlag = this.SweModule.ccall(
|
|
1006
|
+
'swe_refrac',
|
|
1007
|
+
'number',
|
|
1008
|
+
['number', 'number', 'number', 'number', 'number', 'number', 'pointer'],
|
|
1009
|
+
[julianDay, geoLat, geoLon, altitude, pressure, temperature, resultPtr]
|
|
1010
|
+
);
|
|
1011
|
+
const results = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 4);
|
|
1012
|
+
this.SweModule._free(resultPtr);
|
|
1013
|
+
return retFlag < 0 ? null : results;
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
refrac_extended(julianDay, geoLat, geoLon, altitude, pressure, temperature, distance) {
|
|
1017
|
+
const resultPtr = this.SweModule._malloc(4 * Float64Array.BYTES_PER_ELEMENT);
|
|
1018
|
+
const retFlag = this.SweModule.ccall(
|
|
1019
|
+
'swe_refrac_extended',
|
|
1020
|
+
'number',
|
|
1021
|
+
['number', 'number', 'number', 'number', 'number', 'number', 'number', 'pointer'],
|
|
1022
|
+
[julianDay, geoLat, geoLon, altitude, pressure, temperature, distance, resultPtr]
|
|
1023
|
+
);
|
|
1024
|
+
const results = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 4);
|
|
1025
|
+
this.SweModule._free(resultPtr);
|
|
1026
|
+
return retFlag < 0 ? null : results;
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
set_lapse_rate(lapseRate) {
|
|
1030
|
+
this.SweModule.ccall(
|
|
1031
|
+
'swe_set_lapse_rate',
|
|
1032
|
+
'void',
|
|
1033
|
+
['number'],
|
|
1034
|
+
[lapseRate]
|
|
1035
|
+
);
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
azal(julianDay, geoLat, geoLon, altitude, planet) {
|
|
1039
|
+
const resultPtr = this.SweModule._malloc(4 * Float64Array.BYTES_PER_ELEMENT);
|
|
1040
|
+
const retFlag = this.SweModule.ccall(
|
|
1041
|
+
'swe_azalt',
|
|
1042
|
+
'number',
|
|
1043
|
+
['number', 'number', 'number', 'number', 'number', 'pointer'],
|
|
1044
|
+
[julianDay, geoLat, geoLon, altitude, planet, resultPtr]
|
|
1045
|
+
);
|
|
1046
|
+
const results = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 4);
|
|
1047
|
+
this.SweModule._free(resultPtr);
|
|
1048
|
+
return retFlag < 0 ? null : results;
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
azal_rev(julianDay, geoLat, geoLon, altitude, planet) {
|
|
1052
|
+
const resultPtr = this.SweModule._malloc(4 * Float64Array.BYTES_PER_ELEMENT);
|
|
1053
|
+
const retFlag = this.SweModule.ccall(
|
|
1054
|
+
'swe_azalt_rev',
|
|
1055
|
+
'number',
|
|
1056
|
+
['number', 'number', 'number', 'number', 'number', 'pointer'],
|
|
1057
|
+
[julianDay, geoLat, geoLon, altitude, planet, resultPtr]
|
|
1058
|
+
);
|
|
1059
|
+
const results = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 4);
|
|
1060
|
+
this.SweModule._free(resultPtr);
|
|
1061
|
+
return retFlag < 0 ? null : results;
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
rise_trans(julianDay, planet, longitude, latitude, altitude, flags) {
|
|
1065
|
+
const resultPtr = this.SweModule._malloc(4 * Float64Array.BYTES_PER_ELEMENT);
|
|
1066
|
+
const retFlag = this.SweModule.ccall(
|
|
1067
|
+
'swe_rise_trans',
|
|
1068
|
+
'number',
|
|
1069
|
+
['number', 'number', 'number', 'number', 'number', 'number', 'pointer'],
|
|
1070
|
+
[julianDay, planet, longitude, latitude, altitude, flags, resultPtr]
|
|
1071
|
+
);
|
|
1072
|
+
const results = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 4);
|
|
1073
|
+
this.SweModule._free(resultPtr);
|
|
1074
|
+
return retFlag < 0 ? null : results;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
rise_trans_true_hor(julianDay, planet, longitude, latitude, altitude, flags) {
|
|
1078
|
+
const resultPtr = this.SweModule._malloc(4 * Float64Array.BYTES_PER_ELEMENT);
|
|
1079
|
+
const retFlag = this.SweModule.ccall(
|
|
1080
|
+
'swe_rise_trans_true_hor',
|
|
1081
|
+
'number',
|
|
1082
|
+
['number', 'number', 'number', 'number', 'number', 'number', 'pointer'],
|
|
1083
|
+
[julianDay, planet, longitude, latitude, altitude, flags, resultPtr]
|
|
1084
|
+
);
|
|
1085
|
+
const results = new Float64Array(this.SweModule.HEAPF64.buffer, resultPtr, 4);
|
|
1086
|
+
this.SweModule._free(resultPtr);
|
|
1087
|
+
return retFlag < 0 ? null : results;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
export default SwissEph;
|