sweph 2.10.3-5 → 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 +6 -6
- package/index.d.ts +163 -87
- package/index.mjs +4 -0
- package/package.json +2 -2
- 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/README.md
CHANGED
|
@@ -38,8 +38,8 @@ This library is version locked to the Swiss Ephemeris in addition to its own rev
|
|
|
38
38
|
|
|
39
39
|
Updates to this library will be released under new revisions, while updates to Swiss Ephemeris will be released under matching SemVer versions.
|
|
40
40
|
|
|
41
|
-
**Current Version: 2.10.3-
|
|
42
|
-
**Equivalent to Swiss Ephemeris version: 2.10.
|
|
41
|
+
**Current Version: 2.10.3-6**
|
|
42
|
+
**Equivalent to Swiss Ephemeris version: 2.10.03 revision 6**
|
|
43
43
|
|
|
44
44
|
## Documentation
|
|
45
45
|
|
|
@@ -49,7 +49,7 @@ This library is fully typed and documented via intellisense. To access its docum
|
|
|
49
49
|
|
|
50
50
|
## Ephemeris files
|
|
51
51
|
|
|
52
|
-
Ephemeris files are required to enable high precision calculations for planets and asteroids. This library does not include any ephemeris files by default, but you can download them from the official Swiss Ephemeris Github repository (main planets only) or the official Astrodienst
|
|
52
|
+
Ephemeris files are required to enable high precision calculations for planets and asteroids. This library does not include any ephemeris files by default, but you can download them from the official Swiss Ephemeris Github repository (main planets only) or the official Astrodienst Dropbox folder (all files):
|
|
53
53
|
|
|
54
54
|
* Swiss Ephemeris Github: [https://github.com/aloistr/swisseph/tree/master/ephe](https://github.com/aloistr/swisseph/tree/master/ephe)
|
|
55
55
|
* Astrodienst Dropbox [https://www.dropbox.com/scl/fo/y3naz62gy6f6qfrhquu7u/h?rlkey=ejltdhb262zglm7eo6yfj2940&dl=0](https://www.dropbox.com/scl/fo/y3naz62gy6f6qfrhquu7u/h?rlkey=ejltdhb262zglm7eo6yfj2940&dl=0)
|
|
@@ -82,10 +82,10 @@ If you find any inaccuracy or bug in this library, or if you find an upstream up
|
|
|
82
82
|
|
|
83
83
|
* While worker_threads are supported, the underlying C library is single threaded and contains process-wide settings. Functions such as `set_ephe_path()` or `set_sid_mode()` will affect the entire process, including all worker_threads. While you can still use worker_threads as long as you don't change settings from other threads in the middle of calculations, true thread-safe multithreading can only be achieved using child_process.
|
|
84
84
|
|
|
85
|
-
* This library is a C/C++ add-on designed for Node.JS only, it will not work in browsers, other JS engines or in any other environment that does not support native C/C++ add-ons made with Node's N-API.
|
|
85
|
+
* This library is a C/C++ add-on designed for Node.JS only, it will not work in browsers, other JS engines or in any other environment that does not support native C/C++ add-ons made with Node's N-API. Prebuilt binaries are included for supported platforms. If no matching prebuild is available for the target system, installation falls back to a native build and requires the necessary build tools, such as `python`, `make` and `gcc` on Linux, `xcode` on Mac, `visual c++ build tools` on Windows, and/or other equivalent solutions.
|
|
86
86
|
|
|
87
87
|
## Copyright
|
|
88
88
|
|
|
89
|
-
Copyright © 2021-
|
|
89
|
+
Copyright © 2021-2026, Timotej Valentin Rojko
|
|
90
90
|
|
|
91
|
-
This library is offered free of charge for any type of use, including commercial use
|
|
91
|
+
This library is offered free of charge for any type of use, including commercial use. If you rely on it in personal or commercial projects, consider sponsoring the project to help fund maintenance, updates, and support.
|
package/index.d.ts
CHANGED
|
@@ -2098,13 +2098,13 @@ declare module "sweph" {
|
|
|
2098
2098
|
* ```
|
|
2099
2099
|
* string
|
|
2100
2100
|
* ```
|
|
2101
|
-
* ### Example
|
|
2102
|
-
* ```
|
|
2103
|
-
* const time = cs2timestr(2345464, ":", true); // "
|
|
2104
|
-
* ```
|
|
2105
|
-
*
|
|
2106
|
-
*/
|
|
2107
|
-
export function cs2timestr(csec: number, sep: string, suppresszero: boolean): string;
|
|
2101
|
+
* ### Example
|
|
2102
|
+
* ```
|
|
2103
|
+
* const time = cs2timestr(2345464, ":", true); // "06:30:55"
|
|
2104
|
+
* ```
|
|
2105
|
+
*
|
|
2106
|
+
*/
|
|
2107
|
+
export function cs2timestr(csec: number, sep: string, suppresszero: boolean): string;
|
|
2108
2108
|
|
|
2109
2109
|
/**
|
|
2110
2110
|
* ### Description
|
|
@@ -2242,15 +2242,16 @@ declare module "sweph" {
|
|
|
2242
2242
|
* Object {
|
|
2243
2243
|
* error: string // Warning message if any
|
|
2244
2244
|
* data: number // Delta T value
|
|
2245
|
-
* }
|
|
2246
|
-
* ```
|
|
2247
|
-
* ### Example
|
|
2248
|
-
* ```
|
|
2249
|
-
* const
|
|
2250
|
-
*
|
|
2251
|
-
*
|
|
2252
|
-
|
|
2253
|
-
|
|
2245
|
+
* }
|
|
2246
|
+
* ```
|
|
2247
|
+
* ### Example
|
|
2248
|
+
* ```
|
|
2249
|
+
* const result = deltat_ex(2431232, constants.SEFLG_MOSEPH);
|
|
2250
|
+
* console.log(result.data); // 0.0003093125751840641
|
|
2251
|
+
* ```
|
|
2252
|
+
*
|
|
2253
|
+
*/
|
|
2254
|
+
export function deltat_ex(tjd: number, ephe: number): DeltaT;
|
|
2254
2255
|
|
|
2255
2256
|
/**
|
|
2256
2257
|
* ### Description
|
|
@@ -2261,15 +2262,15 @@ declare module "sweph" {
|
|
|
2261
2262
|
* ```
|
|
2262
2263
|
* ### Returns
|
|
2263
2264
|
* ```
|
|
2264
|
-
* number // Delta T value
|
|
2265
|
-
* ```
|
|
2266
|
-
* ### Example
|
|
2267
|
-
* ```
|
|
2268
|
-
* const deltaT = deltat(2431232); // 0.
|
|
2269
|
-
* ```
|
|
2270
|
-
*
|
|
2271
|
-
*/
|
|
2272
|
-
export function deltat(tjd: number): number;
|
|
2265
|
+
* number // Delta T value
|
|
2266
|
+
* ```
|
|
2267
|
+
* ### Example
|
|
2268
|
+
* ```
|
|
2269
|
+
* const deltaT = deltat(2431232); // 0.0003093386847061279
|
|
2270
|
+
* ```
|
|
2271
|
+
*
|
|
2272
|
+
*/
|
|
2273
|
+
export function deltat(tjd: number): number;
|
|
2273
2274
|
|
|
2274
2275
|
/**
|
|
2275
2276
|
* ### Description
|
|
@@ -2333,7 +2334,67 @@ declare module "sweph" {
|
|
|
2333
2334
|
|
|
2334
2335
|
/**
|
|
2335
2336
|
* ### Description
|
|
2336
|
-
* Arc distance between two points in
|
|
2337
|
+
* Arc distance between two points in radians normalized to the range -PI to PI
|
|
2338
|
+
* ### Params
|
|
2339
|
+
* ```
|
|
2340
|
+
* • rad1: number // First point in radians
|
|
2341
|
+
* • rad2: number // Second point in radians
|
|
2342
|
+
* ```
|
|
2343
|
+
* ### Returns
|
|
2344
|
+
* ```
|
|
2345
|
+
* number // Distance in radians from -PI to PI
|
|
2346
|
+
* ```
|
|
2347
|
+
* ### Example
|
|
2348
|
+
* ```
|
|
2349
|
+
* const distance = difrad2n(Math.PI / 2, 0); // 1.5707963267948966
|
|
2350
|
+
* ```
|
|
2351
|
+
*
|
|
2352
|
+
*/
|
|
2353
|
+
export function difrad2n(rad1: number, rad2: number): number;
|
|
2354
|
+
|
|
2355
|
+
/**
|
|
2356
|
+
* ### Description
|
|
2357
|
+
* Midpoint between two points in degrees
|
|
2358
|
+
* ### Params
|
|
2359
|
+
* ```
|
|
2360
|
+
* • deg1: number // First point in degrees
|
|
2361
|
+
* • deg2: number // Second point in degrees
|
|
2362
|
+
* ```
|
|
2363
|
+
* ### Returns
|
|
2364
|
+
* ```
|
|
2365
|
+
* number // Midpoint in degrees
|
|
2366
|
+
* ```
|
|
2367
|
+
* ### Example
|
|
2368
|
+
* ```
|
|
2369
|
+
* const mid = deg_midp(10, 350); // 0
|
|
2370
|
+
* ```
|
|
2371
|
+
*
|
|
2372
|
+
*/
|
|
2373
|
+
export function deg_midp(deg1: number, deg2: number): number;
|
|
2374
|
+
|
|
2375
|
+
/**
|
|
2376
|
+
* ### Description
|
|
2377
|
+
* Midpoint between two points in radians
|
|
2378
|
+
* ### Params
|
|
2379
|
+
* ```
|
|
2380
|
+
* • rad1: number // First point in radians
|
|
2381
|
+
* • rad2: number // Second point in radians
|
|
2382
|
+
* ```
|
|
2383
|
+
* ### Returns
|
|
2384
|
+
* ```
|
|
2385
|
+
* number // Midpoint in radians
|
|
2386
|
+
* ```
|
|
2387
|
+
* ### Example
|
|
2388
|
+
* ```
|
|
2389
|
+
* const mid = rad_midp(0.1, 6.2); // 0.00840734641020724
|
|
2390
|
+
* ```
|
|
2391
|
+
*
|
|
2392
|
+
*/
|
|
2393
|
+
export function rad_midp(rad1: number, rad2: number): number;
|
|
2394
|
+
|
|
2395
|
+
/**
|
|
2396
|
+
* ### Description
|
|
2397
|
+
* Arc distance between two points in degrees in a single direction
|
|
2337
2398
|
* ### Params
|
|
2338
2399
|
* ```
|
|
2339
2400
|
* • deg1: number // First point in degrees
|
|
@@ -2365,15 +2426,15 @@ declare module "sweph" {
|
|
|
2365
2426
|
* error: string, // Error message in case of ERR
|
|
2366
2427
|
* name: string, // The name of the matched star from the sefstars.txt file
|
|
2367
2428
|
* data: number // The star's magnitude value
|
|
2368
|
-
* }
|
|
2369
|
-
* ```
|
|
2370
|
-
* ### Example
|
|
2371
|
-
* ```
|
|
2372
|
-
* const result =
|
|
2373
|
-
* if(result.flag !== constants.OK) { throw new Error(result.error); }
|
|
2374
|
-
* console.log(`
|
|
2375
|
-
* Star: ${result.name}
|
|
2376
|
-
* Magnitude: ${result.data}
|
|
2429
|
+
* }
|
|
2430
|
+
* ```
|
|
2431
|
+
* ### Example
|
|
2432
|
+
* ```
|
|
2433
|
+
* const result = fixstar_mag("Aldebaran");
|
|
2434
|
+
* if(result.flag !== constants.OK) { throw new Error(result.error); }
|
|
2435
|
+
* console.log(`
|
|
2436
|
+
* Star: ${result.name}
|
|
2437
|
+
* Magnitude: ${result.data}
|
|
2377
2438
|
* `)
|
|
2378
2439
|
* ```
|
|
2379
2440
|
*
|
|
@@ -2474,15 +2535,15 @@ declare module "sweph" {
|
|
|
2474
2535
|
* error: string, // Error message in case of ERR
|
|
2475
2536
|
* name: string, // The name of the matched star from the sefstars.txt file
|
|
2476
2537
|
* data: number // The star's magnitude value
|
|
2477
|
-
* }
|
|
2478
|
-
* ```
|
|
2479
|
-
* ### Example
|
|
2480
|
-
* ```
|
|
2481
|
-
* const result =
|
|
2482
|
-
* if(result.flag !== constants.OK) { throw new Error(result.error); }
|
|
2483
|
-
* console.log(`
|
|
2484
|
-
* Star: ${result.name}
|
|
2485
|
-
* Magnitude: ${result.data}
|
|
2538
|
+
* }
|
|
2539
|
+
* ```
|
|
2540
|
+
* ### Example
|
|
2541
|
+
* ```
|
|
2542
|
+
* const result = fixstar2_mag("Aldebaran");
|
|
2543
|
+
* if(result.flag !== constants.OK) { throw new Error(result.error); }
|
|
2544
|
+
* console.log(`
|
|
2545
|
+
* Star: ${result.name}
|
|
2546
|
+
* Magnitude: ${result.data}
|
|
2486
2547
|
* `)
|
|
2487
2548
|
* ```
|
|
2488
2549
|
*
|
|
@@ -3302,16 +3363,16 @@ declare module "sweph" {
|
|
|
3302
3363
|
* hour: number; // Hour (0-23)
|
|
3303
3364
|
* minute: number; // Minute (0-59)
|
|
3304
3365
|
* second: number; // Second including fraction (0-59.99999)
|
|
3305
|
-
* }
|
|
3306
|
-
* ```
|
|
3307
|
-
* ### Example
|
|
3308
|
-
* ```
|
|
3309
|
-
* const date = jdet_to_utc(2415423, constants.
|
|
3310
|
-
* console.log(date);
|
|
3311
|
-
* ```
|
|
3312
|
-
*
|
|
3313
|
-
*/
|
|
3314
|
-
export function jdet_to_utc(tjd_et: number, gregflag: number): DateObject2;
|
|
3366
|
+
* }
|
|
3367
|
+
* ```
|
|
3368
|
+
* ### Example
|
|
3369
|
+
* ```
|
|
3370
|
+
* const date = jdet_to_utc(2415423, constants.SE_GREG_CAL);
|
|
3371
|
+
* console.log(date);
|
|
3372
|
+
* ```
|
|
3373
|
+
*
|
|
3374
|
+
*/
|
|
3375
|
+
export function jdet_to_utc(tjd_et: number, gregflag: number): DateObject2;
|
|
3315
3376
|
|
|
3316
3377
|
/**
|
|
3317
3378
|
* ### Description
|
|
@@ -3330,16 +3391,16 @@ declare module "sweph" {
|
|
|
3330
3391
|
* hour: number; // Hour (0-23)
|
|
3331
3392
|
* minute: number; // Minute (0-59)
|
|
3332
3393
|
* second: number; // Second including fraction (0-59.99999)
|
|
3333
|
-
* }
|
|
3334
|
-
* ```
|
|
3335
|
-
* ### Example
|
|
3336
|
-
* ```
|
|
3337
|
-
* const date = jdut1_to_utc(2415423, constants.
|
|
3338
|
-
* console.log(date);
|
|
3339
|
-
* ```
|
|
3340
|
-
*
|
|
3341
|
-
*/
|
|
3342
|
-
export function jdut1_to_utc(tjd_ut: number, gregflag: number): DateObject2;
|
|
3394
|
+
* }
|
|
3395
|
+
* ```
|
|
3396
|
+
* ### Example
|
|
3397
|
+
* ```
|
|
3398
|
+
* const date = jdut1_to_utc(2415423, constants.SE_GREG_CAL);
|
|
3399
|
+
* console.log(date);
|
|
3400
|
+
* ```
|
|
3401
|
+
*
|
|
3402
|
+
*/
|
|
3403
|
+
export function jdut1_to_utc(tjd_ut: number, gregflag: number): DateObject2;
|
|
3343
3404
|
|
|
3344
3405
|
/**
|
|
3345
3406
|
* ### Description
|
|
@@ -4052,9 +4113,9 @@ declare module "sweph" {
|
|
|
4052
4113
|
*/
|
|
4053
4114
|
export function radnorm(drad: number): number;
|
|
4054
4115
|
|
|
4055
|
-
/**
|
|
4056
|
-
* ### Description
|
|
4057
|
-
* Calculate true altitude from the apparent altitude or apparent altitude from true altitude
|
|
4116
|
+
/**
|
|
4117
|
+
* ### Description
|
|
4118
|
+
* Calculate true altitude from the apparent altitude or apparent altitude from true altitude
|
|
4058
4119
|
* Extended function also supports negative heights and more
|
|
4059
4120
|
* ### Params
|
|
4060
4121
|
* ```
|
|
@@ -4188,17 +4249,17 @@ declare module "sweph" {
|
|
|
4188
4249
|
* flag: number, // OK, ERR or -2 if circumpolar object
|
|
4189
4250
|
* error: string, // Error message if any
|
|
4190
4251
|
* data: number // Transit time in julian days in universal time
|
|
4191
|
-
* }
|
|
4192
|
-
* ```
|
|
4193
|
-
* ### Example
|
|
4194
|
-
* ```
|
|
4195
|
-
* const result =
|
|
4196
|
-
* if(result.flag !== constants.OK) { console.log(result.error); }
|
|
4197
|
-
* console.log(result.data);
|
|
4198
|
-
* ```
|
|
4199
|
-
*
|
|
4200
|
-
*/
|
|
4201
|
-
export function rise_trans(tjd_ut: number, ipl: number, starname: string | null, epheflag: number, rsmi: number, geopos: [longitude: number, latitude: number, elevation: number], atpress: number, attemp: number): RiseTrans;
|
|
4252
|
+
* }
|
|
4253
|
+
* ```
|
|
4254
|
+
* ### Example
|
|
4255
|
+
* ```
|
|
4256
|
+
* const result = rise_trans(2555555, constants.SE_MOON, null, constants.SEFLG_SWIEPH, constants.SE_CALC_RISE, [95,40,200], 0, 0);
|
|
4257
|
+
* if(result.flag !== constants.OK) { console.log(result.error); }
|
|
4258
|
+
* console.log(result.data);
|
|
4259
|
+
* ```
|
|
4260
|
+
*
|
|
4261
|
+
*/
|
|
4262
|
+
export function rise_trans(tjd_ut: number, ipl: number, starname: string | null, epheflag: number, rsmi: number, geopos: [longitude: number, latitude: number, elevation: number], atpress: number, attemp: number): RiseTrans;
|
|
4202
4263
|
|
|
4203
4264
|
/**
|
|
4204
4265
|
* ### Description
|
|
@@ -4293,6 +4354,21 @@ declare module "sweph" {
|
|
|
4293
4354
|
*/
|
|
4294
4355
|
export function set_tid_acc(t_acc: number): void;
|
|
4295
4356
|
|
|
4357
|
+
/**
|
|
4358
|
+
* ### Description
|
|
4359
|
+
* Set the atmospheric lapse rate used by the extended refraction calculations
|
|
4360
|
+
* ### Params
|
|
4361
|
+
* ```
|
|
4362
|
+
* • lapse_rate: number // Lapse rate [°K/m]
|
|
4363
|
+
* ```
|
|
4364
|
+
* ### Example
|
|
4365
|
+
* ```
|
|
4366
|
+
* set_lapse_rate(0.0065);
|
|
4367
|
+
* ```
|
|
4368
|
+
*
|
|
4369
|
+
*/
|
|
4370
|
+
export function set_lapse_rate(lapse_rate: number): void;
|
|
4371
|
+
|
|
4296
4372
|
/**
|
|
4297
4373
|
* ### Description
|
|
4298
4374
|
* Set geographic coordinates for topocentric mode
|
|
@@ -4725,15 +4801,15 @@ declare module "sweph" {
|
|
|
4725
4801
|
* Get current swisseph version
|
|
4726
4802
|
* ### Returns
|
|
4727
4803
|
* ```
|
|
4728
|
-
* string // Swisseph version
|
|
4729
|
-
* ```
|
|
4730
|
-
* ### Example
|
|
4731
|
-
* ```
|
|
4732
|
-
* const
|
|
4733
|
-
* ```
|
|
4734
|
-
*
|
|
4735
|
-
*/
|
|
4736
|
-
export function version(): string;
|
|
4804
|
+
* string // Swisseph version
|
|
4805
|
+
* ```
|
|
4806
|
+
* ### Example
|
|
4807
|
+
* ```
|
|
4808
|
+
* const currentVersion = version(); // "2.10.03"
|
|
4809
|
+
* ```
|
|
4810
|
+
*
|
|
4811
|
+
*/
|
|
4812
|
+
export function version(): string;
|
|
4737
4813
|
|
|
4738
4814
|
/**
|
|
4739
4815
|
* ### Description
|
package/index.mjs
CHANGED
|
@@ -21,6 +21,7 @@ export const close = s.close;
|
|
|
21
21
|
export const set_delta_t_userdef = s.set_delta_t_userdef;
|
|
22
22
|
export const set_ephe_path = s.set_ephe_path;
|
|
23
23
|
export const set_jpl_file = s.set_jpl_file;
|
|
24
|
+
export const set_lapse_rate = s.set_lapse_rate;
|
|
24
25
|
export const set_sid_mode = s.set_sid_mode;
|
|
25
26
|
export const set_tid_acc = s.set_tid_acc;
|
|
26
27
|
export const set_topo = s.set_topo;
|
|
@@ -100,6 +101,9 @@ export const difcsn = s.difcsn;
|
|
|
100
101
|
export const difdegn = s.difdegn;
|
|
101
102
|
export const difcs2n = s.difcs2n;
|
|
102
103
|
export const difdeg2n = s.difdeg2n;
|
|
104
|
+
export const difrad2n = s.difrad2n;
|
|
105
|
+
export const deg_midp = s.deg_midp;
|
|
106
|
+
export const rad_midp = s.rad_midp;
|
|
103
107
|
export const csroundsec = s.csroundsec;
|
|
104
108
|
export const d2l = s.d2l;
|
|
105
109
|
export const day_of_week = s.day_of_week;
|
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",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"prebuild": "prebuildify --napi --strip"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"node-addon-api": "^8.
|
|
50
|
+
"node-addon-api": "^8.9.0",
|
|
51
51
|
"node-gyp-build": "^4.8.4"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
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
|