forked from linchCN/react-native-swisseph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
2561 lines (2438 loc) · 77.9 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
declare namespace swisseph {
// #region Constants
const SE_AUNIT_TO_KM = 149597870.7
const SE_AUNIT_TO_LIGHTYEAR = 1.5812507409819728411242766893179e-5 // = 1.0 / 63241.07708427
const SE_AUNIT_TO_PARSEC = 4.8481368110952742659276431719005e-6 // = 1.0 / 206264.8062471
const SE_MAX_STNAME = 256
const SE_SIDBITS = 256
const SE_SIDBIT_ECL_T0 = 256
const SE_SIDBIT_SSY_PLANE = 512
const SE_SIDBIT_USER_UT = 1024
const SE_BIT_DISC_CENTER = 256
const SE_BIT_DISC_BOTTOM = 8192
const SE_BIT_GEOCTR_NO_ECL_LAT = 128
const SE_BIT_NO_REFRACTION = 512
const SE_BIT_CIVIL_TWILIGHT = 1024
const SE_BIT_NAUTIC_TWILIGHT = 2048
const SE_BIT_ASTRO_TWILIGHT = 4096
const SE_BIT_FIXED_DISC_SIZE = 16384 // = 16 * 1024
const TJD_INVALID = 99999999.0
const SIMULATE_VICTORVB = 1
const SE_PHOTOPIC_FLAG = 0
const SE_SCOTOPIC_FLAG = 1
const SE_MIXEDOPIC_FLAG = 2
const ephemeris: {
swisseph: 2 // = SEFLG_SWIEPH
moshier: 4 // = SEFLG_MOSEPH
de200: 'de200.eph'
de405: 'de405.eph'
de406: 'de406.eph'
de406e: 'de406e.eph'
de414: 'de414.eph'
de421: 'de421.eph'
de422: 'de422.eph'
de430: 'de430.eph'
de431: 'de431.eph'
}
// Calendar types
const SE_JUL_CAL = 0
const SE_GREG_CAL = 1
// Planet numbers
const SE_SUN = 0
const SE_MOON = 1
const SE_MERCURY = 2
const SE_VENUS = 3
const SE_EARTH = 14
const SE_MARS = 4
const SE_JUPITER = 5
const SE_SATURN = 6
const SE_URANUS = 7
const SE_NEPTUNE = 8
const SE_PLUTO = 9
// Moon nodes
const SE_MEAN_NODE = 10
const SE_TRUE_NODE = 11
const SE_MEAN_APOG = 12
const SE_OSCU_APOG = 13
const SE_INTP_APOG = 21
const SE_INTP_PERG = 22
// Base asteroids
const SE_CHIRON = 15
const SE_PHOLUS = 16
const SE_CERES = 17
const SE_PALLAS = 18
const SE_JUNO = 19
const SE_VESTA = 20
const SE_NPLANETS = 23
const SE_AST_OFFSET = 10000
const SE_VARUNA = 30000 // = SE_AST_OFFSET + 20000
const SE_FICT_OFFSET = 40
const SE_FICT_OFFSET_1 = 39
const SE_FICT_MAX = 999
const SE_NFICT_ELEM = 15
const SE_COMET_OFFSET = 1000
const SE_NALL_NAT_POINTS = 38 // = SE_NPLANETS + SE_NFICT_ELEM
// Hamburger or Uranian "planets"
const SE_CUPIDO = 40
const SE_HADES = 41
const SE_ZEUS = 42
const SE_KRONOS = 43
const SE_APOLLON = 44
const SE_ADMETOS = 45
const SE_VULKANUS = 46
const SE_POSEIDON = 47
// Other fictitious bodies
const SE_ISIS = 48
const SE_NIBIRU = 49
const SE_HARRINGTON = 50
const SE_NEPTUNE_LEVERRIER = 51
const SE_NEPTUNE_ADAMS = 52
const SE_PLUTO_LOWELL = 53
const SE_PLUTO_PICKERING = 54
const SE_VULCAN = 55
const SE_WHITE_MOON = 56
const SE_PROSERPINA = 57
const SE_WALDEMATH = 58
const SE_FIXSTAR = -10
const SE_ASC = 0
const SE_MC = 1
const SE_ARMC = 2
const SE_VERTEX = 3
const SE_EQUASC = 4
const SE_COASC1 = 5
const SE_COASC2 = 6
const SE_POLASC = 7
const SE_NASCMC = 8
// Flag bits for "iflag" parameter of the "swe_calc" functions
const SEFLG_JPLEPH = 1
const SEFLG_SWIEPH = 2
const SEFLG_MOSEPH = 4
const SEFLG_HELCTR = 8
const SEFLG_TRUEPOS = 16
const SEFLG_J2000 = 32
const SEFLG_NONUT = 64
const SEFLG_SPEED3 = 128
const SEFLG_SPEED = 256
const SEFLG_NOGDEFL = 512
const SEFLG_NOABERR = 1024
const SEFLG_ASTROMETRIC = 1536 // = SEFLG_NOABERR | SEFLG_NOGDEFL
const SEFLG_EQUATORIAL = 2048 // = 2 *1024
const SEFLG_XYZ = 4096 // = 4 * 1024
const SEFLG_RADIANS = 8192 // = 8 * 1024
const SEFLG_BARYCTR = 16384 // = 16 * 1024
const SEFLG_TOPOCTR = 32768 // = 32 * 1024
const SEFLG_ORBEL_AA = 32768 // = SEFLG_TOPOCTR
const SEFLG_SIDEREAL = 65536 // = 64 * 1024
const SEFLG_ICRS = 131072 // = 128 * 1024
const SEFLG_DPSIDEPS_1980 = 262144 // = 256*1024
const SEFLG_JPLHOR = 262144 // = SEFLG_DPSIDEPS_1980
const SEFLG_JPLHOR_APPROX = 524288 // = 512*1024
const SEFLG_DEFAULTEPH = 2 // = SEFLG_SWIEPH
// Sidereal modes
const SE_SIDM_FAGAN_BRADLEY = 0
const SE_SIDM_LAHIRI = 1
const SE_SIDM_DELUCE = 2
const SE_SIDM_RAMAN = 3
const SE_SIDM_USHASHASHI = 4
const SE_SIDM_KRISHNAMURTI = 5
const SE_SIDM_DJWHAL_KHUL = 6
const SE_SIDM_YUKTESHWAR = 7
const SE_SIDM_JN_BHASIN = 8
const SE_SIDM_BABYL_KUGLER1 = 9
const SE_SIDM_BABYL_KUGLER2 = 10
const SE_SIDM_BABYL_KUGLER3 = 11
const SE_SIDM_BABYL_HUBER = 12
const SE_SIDM_BABYL_ETPSC = 13
const SE_SIDM_ALDEBARAN_15TAU = 14
const SE_SIDM_HIPPARCHOS = 15
const SE_SIDM_SASSANIAN = 16
const SE_SIDM_GALCENT_0SAG = 17
const SE_SIDM_J2000 = 18
const SE_SIDM_J1900 = 19
const SE_SIDM_B1950 = 20
const SE_SIDM_SURYASIDDHANTA = 21
const SE_SIDM_SURYASIDDHANTA_MSUN = 22
const SE_SIDM_ARYABHATA = 23
const SE_SIDM_ARYABHATA_MSUN = 24
const SE_SIDM_SS_REVATI = 25
const SE_SIDM_SS_CITRA = 26
const SE_SIDM_TRUE_CITRA = 27
const SE_SIDM_TRUE_REVATI = 28
const SE_SIDM_TRUE_PUSHYA = 29
const SE_SIDM_GALCENT_RGILBRAND = 30
const SE_SIDM_GALEQU_IAU1958 = 31
const SE_SIDM_GALEQU_TRUE = 32
const SE_SIDM_GALEQU_MULA = 33
const SE_SIDM_GALALIGN_MARDYKS = 34
const SE_SIDM_TRUE_MULA = 35
const SE_SIDM_GALCENT_MULA_WILHELM = 36
const SE_SIDM_ARYABHATA_522 = 37
const SE_SIDM_BABYL_BRITTON = 38
const SE_SIDM_TRUE_SHEORAN = 39
const SE_SIDM_GALCENT_COCHRANE = 40
const SE_SIDM_GALEQU_FIORENZA = 41
const SE_SIDM_VALENS_MOON = 42
const SE_SIDM_USER = 255
const SE_NSIDM_PREDEF = 43
// Used for "swe_nod_aps" function
const SE_NODBIT_MEAN = 1
const SE_NODBIT_OSCU = 2
const SE_NODBIT_OSCU_BAR = 4
const SE_NODBIT_FOPOINT = 256
// Used for eclipse computations
const SE_ECL_NUT = -1
const SE_ECL_CENTRAL = 1
const SE_ECL_NONCENTRAL = 2
const SE_ECL_TOTAL = 4
const SE_ECL_ANNULAR = 8
const SE_ECL_PARTIAL = 16
const SE_ECL_ANNULAR_TOTAL = 32
const SE_ECL_PENUMBRAL = 64
const SE_ECL_ALLTYPES_SOLAR = 63 // = SE_ECL_CENTRAL | SE_ECL_NONCENTRAL | SE_ECL_TOTAL | SE_ECL_ANNULAR | SE_ECL_PARTIAL | SE_ECL_ANNULAR_TOTAL
const SE_ECL_ALLTYPES_LUNAR = 84 // = SE_ECL_TOTAL | SE_ECL_PARTIAL | SE_ECL_PENUMBRAL
const SE_ECL_VISIBLE = 128
const SE_ECL_MAX_VISIBLE = 256
const SE_ECL_1ST_VISIBLE = 512
const SE_ECL_PARTBEG_VISIBLE = 512
const SE_ECL_2ND_VISIBLE = 1024
const SE_ECL_TOTBEG_VISIBLE = 1024
const SE_ECL_3RD_VISIBLE = 2048
const SE_ECL_TOTEND_VISIBLE = 2048
const SE_ECL_4TH_VISIBLE = 4096
const SE_ECL_PARTEND_VISIBLE = 4096
const SE_ECL_PENUMBBEG_VISIBLE = 8192
const SE_ECL_PENUMBEND_VISIBLE = 16384
const SE_ECL_OCC_BEG_DAYLIGHT = 8192
const SE_ECL_OCC_END_DAYLIGHT = 16384
const SE_ECL_ONE_TRY = 32768 // = 32 * 1024
// Used for "swe_rise_transit"
const SE_CALC_RISE = 1
const SE_CALC_SET = 2
const SE_CALC_MTRANSIT = 4
const SE_CALC_ITRANSIT = 8
// Used for "swe_azalt" and "swe_azalt_rev" functions
const SE_ECL2HOR = 0
const SE_EQU2HOR = 1
const SE_HOR2ECL = 0
const SE_HOR2EQU = 1
// Used for "swe_refrac" function
const SE_TRUE_TO_APP = 0
const SE_APP_TO_TRUE = 1
// Rounding flags for "swe_split_deg" function
const SE_SPLIT_DEG_ROUND_SEC = 1
const SE_SPLIT_DEG_ROUND_MIN = 2
const SE_SPLIT_DEG_ROUND_DEG = 4
const SE_SPLIT_DEG_ZODIACAL = 8
const SE_SPLIT_DEG_KEEP_SIGN = 16
const SE_SPLIT_DEG_KEEP_DEG: 32
const SE_SPLIT_DEG_NAKSHATRA = 1024
// Used for heliacal functions
const SE_HELIACAL_RISING = 1
const SE_HELIACAL_SETTING = 2
const SE_MORNING_FIRST = 1 // = SE_HELIACAL_RISING
const SE_EVENING_LAST = 2 // = SE_HELIACAL_SETTING
const SE_EVENING_FIRST = 3
const SE_MORNING_LAST = 4
const SE_ACRONYCHAL_RISING = 5
const SE_ACRONYCHAL_SETTING = 6
const SE_COSMICAL_SETTING = 6 // = SE_ACRONYCHAL_SETTING
const SE_HELFLAG_LONG_SEARCH = 128
const SE_HELFLAG_HIGH_PRECISION = 256
const SE_HELFLAG_OPTICAL_PARAMS = 512
const SE_HELFLAG_NO_DETAILS = 1024
const SE_HELFLAG_SEARCH_1_PERIOD = 2048 // = 1 << 11
const SE_HELFLAG_VISLIM_DARK = 4096 // = 1 << 12
const SE_HELFLAG_VISLIM_NOMOON = 8192 // = 1 << 13
const SE_HELFLAG_VISLIM_PHOTOPIC = 16384 // = 1 << 14
const SE_HELFLAG_AVKIND_VR = 32768 // = 1 << 15
const SE_HELFLAG_AVKIND_PTO = 65536 // = 1 << 16
const SE_HELFLAG_AVKIND_MIN7 = 131072 // = 1 << 17
const SE_HELFLAG_AVKIND_MIN9 = 262144 // = 1 << 18
const SE_HELFLAG_AVKIND = 491520 // = SE_HELFLAG_AVKIND_VR | SE_HELFLAG_AVKIND_PTO | SE_HELFLAG_AVKIND_MIN7 | SE_HELFLAG_AVKIND_MIN9
// #endregion Constants
/**
* All functions that return a value have an optional callback parameter as their last parameter.
* That callback has a result argument with the same type as the return type of the function.
* This type simplifies the type definition of that callback argument.
*/
type ResultCallback<T extends (...args: any) => any> = (
result: ReturnType<T>
) => void
type Ephemeris = {
julianDay: number
longitude: number
longitudeSpeed: number
}
type EclipticEntity = {
id: number
swissephId: number
longitude: number
longitudeSpeed: number
julianDay: number
}
type RetrogradationInfo = {
swissephId: number;
startJulianDay: number;
endJulianDay: number;
startEphemeris: Ephemeris;
endEphemeris: Ephemeris;
}
type Aspect = {
left: {
startLongitude: number;
exactLongitude: number;
endLongitude: number;
};
right: {
startLongitude: number;
exactLongitude: number;
endLongitude: number;
};
id: number;
angle: number;
}
type EclipticEntitiesAspect = {
aspect: Aspect
eclipticEntities: [EclipticEntity, EclipticEntity]
}
type GetTransitsOutput = {
points: {
enter: Ephemeris
exact: Ephemeris
leave: Ephemeris
}
orb: number
}[]
// #region Util
/**
* Computes the difference between Universal Time (UT, GMT) and Ephemeris time.
* @param tjd The Julian day.
* @param callback Optional callback called with the result.
* @returns The result of the computation.
*/
function swe_deltat(
tjd: number,
callback?: ResultCallback<typeof swe_deltat>
): { delta: number }
/**
* Returns the difference between local apparent and local mean time.
* @param tjd The Julian day.
* @param callback Optional callback called with the result.
* @returns The result of the computation or an error.
*/
function swe_time_equ(
tjd: number,
callback?: ResultCallback<typeof swe_time_equ>
): { timeEquation: number } | { error: string }
/**
* Returns sidereal time for a Julian day, obliquity and nutation.
* @param tjd_ut The Julian day.
* @param eps The obliquity.
* @param nut The nutation.
* @param callback Optional callback called with the result.
* @returns Sidereal time at the Greenwich Meridian, measured in hours.
*/
function swe_sidtime0(
tjd_ut: number,
eps: number,
nut: number,
callback?: ResultCallback<typeof swe_sidtime0>
): {
siderialTime: number
}
/**
* Returns sidereal time for a Julian day. Computes obliquity and nutation internally.
* @param tjd_ut The Julian day.
* @param callback Optional callback called with the result.
* @returns Sidereal time at the Greenwich Meridian, measured in hours.
*/
function swe_sidtime(
tjd_ut: number,
callback?: ResultCallback<typeof swe_sidtime>
): { siderialTime: number }
/**
* Coordinate transformation, from ecliptic to equator or vice-versa.
* - equator -> ecliptic: eps must be positive
* - ecliptic -> equator: eps must be negative
* Note: eps, longitude and latitude are in positive degrees!
* @param xpo 3 doubles: long., lat., dist. to be converted; distance remains unchanged, can be set to 1.00.
* @param eps Obliquity of ecliptic, in degrees.
* @param callback Optional callback called with the result.
* @returns Result of the conversion. 3 doubles: long., lat., dist.
*/
function swe_cotrans(
xpo: number[],
eps: number,
callback?: ResultCallback<typeof swe_cotrans>
): {
longitude: number
latitude: number
distance: number
}
/**
* Coordinate transformation of position and speed, from ecliptic to equator or vice-versa.
* - equator -> ecliptic: eps must be positive
* - ecliptic -> equator: eps must be negative
* Note: eps, long., lat., and speeds in long. and lat. are in degrees!
* @param xpo 6 doubles, input: long., lat., dist. and speeds in long., lat and dist.
* @param eps Obliquity of ecliptic, in degrees.
* @param callback Optional callback called with the result.
* @returns Result of the conversion. 6 doubles, position and speed in new coordinate system.
*/
function swe_cotrans_sp(
xpo: number[],
eps: number,
callback?: ResultCallback<typeof swe_cotrans_sp>
): {
longitude: number
latitude: number
distance: number
longitudeSpeed: number
latitudeSpeed: number
distanceSpeed: number
}
/**
* Returns the tidal acceleration used in swe_deltat().
* @param callback Optional callback called with the result.
* @returns The tidal acceleration.
*/
function swe_get_tid_acc(callback?: ResultCallback<typeof swe_get_tid_acc>): {
acceleration: number
}
/**
* Sets the tidal acceleration to be used in swe_deltat().
* @param t_acc The tidal acceleration.
* @param callback Optional callback called with an empty object.
* @returns An empty object.
*/
function swe_set_tid_acc(
t_acc: number,
callback?: ResultCallback<typeof swe_set_tid_acc>
): {}
/**
* Normalizes a degree to the range 0 - 360.
* @param x The degree to normalize.
* @param callback Optional callback called with the result.
* @returns The result of the normalization.
*/
function swe_degnorm(
x: number,
callback?: ResultCallback<typeof swe_degnorm>
): { x360: number }
/**
* Normalizes a radian to the range 0 - 2 PI.
* @param x The radian to normalize.
* @param callback Optional callback called with the result.
* @returns The result of the normalization.
*/
function swe_radnorm(
x: number,
callback?: ResultCallback<typeof swe_radnorm>
): { x2Pi: number }
/**
* Return the mid point between two radians.
* @param x1 The first radian.
* @param x0 The second radian.
* @param callback Optional callback called with the result.
* @returns The result of the computation.
*/
function swe_rad_midp(
x1: number,
x0: number,
callback?: ResultCallback<typeof swe_rad_midp>
): { xMid2Pi: number }
/**
* Return the mid point between two degrees.
* @param x1 The first degree.
* @param x0 The second degree.
* @param callback Optional callback called with the result.
* @returns The result of the computation.
*/
function swe_deg_midp(
x1: number,
x0: number,
callback?: ResultCallback<typeof swe_deg_midp>
): { xMid360: number }
/**
* Split degrees to sign/nakshatra, degrees, minutes, seconds of arc.
* @param ddeg Decimal degrees, ecliptic longitude.
* @param roundflag By default there is no rounding. If rounding is required, the following bits can be set:
* SE_SPLIT_DEG_ROUND_SEC, SE_SPLIT_DEG_ROUND_MIN, SE_SPLIT_DEG_ROUND_DEG,
* SE_SPLIT_DEG_ZODIACAL, SE_SPLIT_DEG_KEEP_SIGN and SE_SPLIT_DEG_NAKSHATRA.
* @param callback Optional callback called with the result.
* @returns The result of the splitting.
* (degree = degree integer, min = degree minutes, second = degree seconds,
* secondFraction = degree fraction of seconds, sign = zodiac sign number)
*/
function swe_split_deg(
ddeg: number,
roundflag: number,
callback?: ResultCallback<typeof swe_split_deg>
): {
degree: number
min: number
second: number
secondFraction: number
sign: number
}
/**
* Normalize a centisecond value into the interval 0 - 360 DEG.
* @param p The centisecond value.
* @param callback Optional callback called with the result.
* @returns The result of the computation.
*/
function swe_csnorm(
p: number,
callback?: ResultCallback<typeof swe_csnorm>
): { centisec360: number }
/**
* Distance in centisecs between p1 and p2 normalized to 0 - 360.
* @param p1 The first centisecond value
* @param p2 The second centisecond value
* @param callback Optional callback called with the result.
* @returns The result of the computation.
*/
function swe_difcsn(
p1: number,
p2: number,
callback?: ResultCallback<typeof swe_difcsn>
): { centisecDiff: number }
/**
* Distance in degrees between p1 and p2.
* @param p1 The first degree value.
* @param p2 The second degree value.
* @param callback Optional callback called with the result.
* @returns The result of the computation.
*/
function swe_difdegn(
p1: number,
p2: number,
callback?: ResultCallback<typeof swe_difdegn>
): { degreeDiff: number }
/**
* Distance in centisecs between p1 and p2 normalized to -180 - 180.
* @param p1 The first centisecond value
* @param p2 The second centisecond value
* @param callback Optional callback called with the result.
* @returns The result of the computation.
*/
function swe_difcs2n(
p1: number,
p2: number,
callback?: ResultCallback<typeof swe_difcs2n>
): { centisecDistance180: number }
/**
* Distance in degrees between p1 and p2 normalized to -180 - 180.
* @param p1 The first degree value.
* @param p2 The second degree value.
* @param callback Optional callback called with the result.
* @returns The result of the computation.
*/
function swe_difdeg2n(
p1: number,
p2: number,
): Promise<number>
/**
* Distance in radians between p1 and p2 normalized to -PI - PI.
* @param p1 The first radian value.
* @param p2 The second radian value.
* @param callback Optional callback called with the result.
* @returns The result of the computation.
*/
function swe_difrad2n(
p1: number,
p2: number,
callback?: ResultCallback<typeof swe_difrad2n>
): { degreeDistancePi: number }
/**
* Round centisecond value, but at 29.5959 always down.
* @param x The centisecond value to round.
* @param callback Optional callback called with the result.
* @returns The result of the computation.
*/
function swe_csroundsec(
x: number,
callback?: ResultCallback<typeof swe_csroundsec>
): { centisecRound: number }
/**
* Convert double to long with rounding, no overflow check.
* @param x The double value to convert.
* @param callback Optional callback called with the result.
* @returns The result of the conversion.
*/
function swe_d2l(
x: number,
callback?: ResultCallback<typeof swe_d2l>
): { xRound: number }
/**
* Returns the day of week for a Julian day.
* @param jd The Julian day.
* @param callback Optional callback called with the result.
* @returns Monday = 0, ... Sunday = 6.
*/
function swe_day_of_week(
jd: number,
callback?: ResultCallback<typeof swe_day_of_week>
): { dayOfWeek: number }
/**
* Converts a centisecond value to a time string.
* @param t The centisecond value.
* @param sep Separator value.
* @param suppressZero Specifies whether to suppress zero values. (0 = no, 1 = yes)
* @param callback Optional callback called with the result.
* @returns The result of the conversion.
*/
function swe_cs2timestr(
t: number,
sep: number,
suppressZero: number,
callback?: ResultCallback<typeof swe_cs2timestr>
): { timeString: string }
/**
* Converts a centisecond value to a longitude or latitude string.
* @param t The centisecond value.
* @param pchar Character used for positive values.
* @param mchar Character used for negative values.
* @param callback Optional callback called with the result.
* @returns The result of the conversion.
*/
function swe_cs2lonlatstr(
t: number,
pchar: string,
mchar: string,
callback?: ResultCallback<typeof swe_cs2lonlatstr>
): { lonlatString: string }
/**
* Converts a centisecond value to a degree string.
* @param t The centisecond value.
* @param callback Optional callback called with the result.
* @returns The result of the conversion.
*/
function swe_cs2degstr(
t: number,
callback?: ResultCallback<typeof swe_cs2degstr>
): { degreeString: string }
// #endregion Util
// #region Date
/**
* Conversion from day, month, year, time to Julian day with error handling.
* @param year The year of the date.
* @param month The month of the date.
* @param day The day of the date.
* @param hour The hour of the date.
* @param gregflag Specifies whether the input date is Julian calendar ('j') or Gregorian calendar ('g').
* @param callback Optional callback called with the result.
* @returns The result of the conversion or an error.
*/
function swe_date_conversion(
year: number,
month: number,
day: number,
hour: number,
gregflag: 'g' | 'j',
callback?: ResultCallback<typeof swe_date_conversion>
): { julianDay: number } | { error: string }
/**
* Conversion from day, month, year, time to Julian day.
* @param year The year of the date.
* @param month The month of the date.
* @param day The day of the date.
* @param hour The hour of the date.
* @param gregflag Specifies whether the input date is Julian calendar (SE_JUL_CAL) or Gregorian calendar (SE_GREG_CAL).
* @param callback Optional callback called with the result.
* @returns The result of the conversion.
*/
function swe_julday(
year: number,
month: number,
day: number,
hour: number,
gregflag: typeof SE_JUL_CAL | typeof SE_GREG_CAL,
callback?: ResultCallback<typeof swe_julday>
): number
/**
* Reverse conversion of a Julian day value to a date object.
* @param jd The Julian day.
* @param gregflag Specifies whether the input date is Julian calendar (SE_JUL_CAL) or Gregorian calendar (SE_GREG_CAL).
* @param callback Optional callback called with the result.
* @returns The result of the conversion.
*/
function swe_revjul(
jd: number,
gregflag: typeof SE_JUL_CAL | typeof SE_GREG_CAL,
callback?: ResultCallback<typeof swe_revjul>
): {
year: number
month: number
day: number
hour: number
}
/**
* Conversion from day, month, year, time in Coordinated Universal Time (UTC) to Julian day.
* @param iyear The year of the date.
* @param imonth The month of the date.
* @param iday The day of the date.
* @param ihour The hour of the date.
* @param imin The minute of the date.
* @param dsec The second of the date.
* @param gregflag Specifies whether the input date is Julian calendar (SE_JUL_CAL) or Gregorian calendar (SE_GREG_CAL).
* @param callback Optional callback called with the result.
* @returns The result of the conversion or an error.
*/
function swe_utc_to_jd(
iyear: number,
imonth: number,
iday: number,
ihour: number,
imin: number,
dsec: number,
gregflag: typeof SE_JUL_CAL | typeof SE_GREG_CAL,
callback?: ResultCallback<typeof swe_utc_to_jd>
):
| {
julianDayET: number
julianDayUT: number
}
| { error: string }
/**
* Reverse conversion of a Julian day value to a date object in Coordinated Universal Time (UTC).
* @param tjd_et The Julian day number in ET (TT).
* @param gregflag Specifies whether the input date is Julian calendar (SE_JUL_CAL) or Gregorian calendar (SE_GREG_CAL).
* @param callback Optional callback called with the result.
* @returns The result of the conversion.
*/
function swe_jdet_to_utc(
tjd_et: number,
gregflag: typeof SE_JUL_CAL | typeof SE_GREG_CAL,
callback?: ResultCallback<typeof swe_jdet_to_utc>
): {
year: number
month: number
day: number
hour: number
minute: number
second: number
}
/**
* Reverse conversion of a Julian day value to a date object in Coordinated Universal Time (UTC).
* @param tjd_ut The Julian day number in UT (UT1).
* @param gregflag Specifies whether the input date is Julian calendar (SE_JUL_CAL) or Gregorian calendar (SE_GREG_CAL).
* @param callback Optional callback called with the result.
* @returns The result of the conversion.
*/
function swe_jdut1_to_utc(
tjd_ut: number,
gregflag: typeof SE_JUL_CAL | typeof SE_GREG_CAL,
callback?: ResultCallback<typeof swe_jdut1_to_utc>
): {
year: number
month: number
day: number
hour: number
minute: number
second: number
}
/**
* Converts a UTC date value to a local date value using the specified time zone offset.
* @param iyear The year of the date.
* @param imonth The month of the date.
* @param iday The day of the date.
* @param ihour The hour of the date.
* @param imin The minute of the date.
* @param dsec The second of the date.
* @param d_timezone The time zone offset.
* @param callback Optional callback called with the result.
* @returns The result of the conversion.
*/
function swe_utc_time_zone(
iyear: number,
imonth: number,
iday: number,
ihour: number,
imin: number,
dsec: number,
d_timezone: number,
callback?: ResultCallback<typeof swe_utc_time_zone>
): {
year: number
month: number
day: number
hour: number
minute: number
second: number
}
// #endregion Date
// #region Pos
/**
* Returns a string with the version number of your Swiss Ephemeris.
* @param callback Optional callback called with the result.
* @returns The version number of your Swiss Ephemeris.
*/
function swe_version(callback?: ResultCallback<typeof swe_version>): string
/**
* Computes the position of a planet, asteroid, lunar node or an apogee for a specified Universal Time.
* @param tjd_ut The Julian day in Universal Time.
* @param ipl The body number.
* @param iflag A 32 bit integer containing bit flags that indicate what kind of computation is wanted.
* @param callback Optional callback called with the result.
* @returns The result of the computation or an error.
*/
function swe_calc_ut(
tjd_ut: number,
ipl: number,
iflag: number,
callback?: ResultCallback<typeof swe_calc_ut>
): Promise<{
longitude: number
latitude: number
distance: number
speedLong: number
speedLat: number
speedDist: number
rflag: number
error: string
}>
/**
* Computes the position of a planet, asteroid, lunar node or an apogee for a specified Terrestrial Time.
* @param tjd The Julian day in Terrestrial Time.
* @param ipl The body number.
* @param iflag A 32 bit integer containing bit flags that indicate what kind of computation is wanted.
* @param callback Optional callback called with the result.
* @returns The result of the computation or an error.
*/
function swe_calc(
tjd: number,
ipl: number,
iflag: number,
callback?: ResultCallback<typeof swe_calc>
):
| {
longitude: number
latitude: number
distance: number
longitudeSpeed: number
latitudeSpeed: number
distanceSpeed: number
rflag: number
}
| {
rectAscension: number
declination: number
distance: number
rectAscensionSpeed: number
declinationSpeed: number
distanceSpeed: number
rflag: number
}
| {
x: number
y: number
z: number
dx: number
dy: number
dz: number
rflag: number
}
| {
error: string
}
/**
* Computes the position of a fixed star for a specified Terrestrial Time.
* @param star The search string used to find the fixed star by name.
* The search string is treated as having a wildcard at the end.
* @param tjd The Julian day in Terrestrial Time.
* @param iflag A 32 bit integer containing bit flags that indicate what kind of computation is wanted.
* @param callback Optional callback called with the result.
* @returns The result of the computation or an error.
* @see {@link swe_fixstar} for a newer and faster implementation.
*/
function swe_fixstar(
star: string,
tjd: number,
iflag: number,
callback?: ResultCallback<typeof swe_fixstar>
):
| {
name: string
longitude: number
latitude: number
distance: number
longitudeSpeed: number
latitudeSpeed: number
distanceSpeed: number
rflag: number
}
| {
name: string
rectAscension: number
declination: number
distance: number
rectAscensionSpeed: number
declinationSpeed: number
distanceSpeed: number
rflag: number
}
| {
name: string
x: number
y: number
z: number
dx: number
dy: number
dz: number
rflag: number
}
| {
error: string
}
/**
* Computes the position of a fixed star for a specified Universal Time.
* @param star The search string used to find the fixed star by name.
* The search string is treated as having a wildcard at the end.
* @param tjd_ut The Julian day in Universal Time.
* @param iflag A 32 bit integer containing bit flags that indicate what kind of computation is wanted.
* @param callback Optional callback called with the result.
* @returns The result of the computation or an error.
* @see {@link swe_fixstar2_ut} for a newer and faster implementation.
*/
function swe_fixstar_ut(
star: string,
tjd_ut: number,
iflag: number,
callback?: ResultCallback<typeof swe_fixstar_ut>
):
| {
name: string
longitude: number
latitude: number
distance: number
longitudeSpeed: number
latitudeSpeed: number
distanceSpeed: number
rflag: number
}
| {
name: string
rectAscension: number
declination: number
distance: number
rectAscensionSpeed: number
declinationSpeed: number
distanceSpeed: number
rflag: number
}
| {
name: string
x: number
y: number
z: number
dx: number