erfars 0.2.0

Safe Rust bindings to the Essential Routines for Fundamental Astronomy (ERFA) C library.
Documentation
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
//! ERFA Precession, Nutation, and Polar Motion Functions

use crate::raw::precnutpolar::*;

/// Frame bias components of IAU 2000 precession-nutation models; part of the
/// Mathews-Herring-Buffett (MHB2000) nutation series, with additions.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/bi00.c)
pub fn Bi00() -> (f64, f64, f64) {
    let mut dpsibi: f64 = 0.0;
    let mut depsbi: f64 = 0.0;
    let mut dra: f64 = 0.0;
    unsafe {
        eraBi00(&mut dpsibi, &mut depsbi, &mut dra);
    }

    return (dpsibi, depsbi, dra);
}

/// Frame bias and precession, IAU 2000.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/bp00.c)
pub fn Bp00(date1: f64, date2: f64, rb: &mut [f64; 9], rp: &mut [f64; 9], rbp: &mut [f64; 9]) {
    unsafe {
        eraBp00(date1, date2, rb, rp, rbp);
    }
}

/// Frame bias and precession, IAU 2006.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/bp06.c)
pub fn Bp06(date1: f64, date2: f64, rb: &mut [f64; 9], rp: &mut [f64; 9], rbp: &mut [f64; 9]) {
    unsafe {
        eraBp06(date1, date2, rb, rp, rbp);
    }
}

/// Extract from the bias-precession-nutation matrix the X,Y coordinates of the
/// Celestial Intermediate Pole.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/bpn2xy.c)
pub fn Bpn2xy(rbpn: &[f64; 9]) -> (f64, f64) {
    let mut x: f64 = 0.0;
    let mut y: f64 = 0.0;
    unsafe {
        eraBpn2xy(rbpn, &mut x, &mut y);
    }

    return (x, y);
}

/// Form the celestial-to-intermediate matrix for a given date using the IAU
/// 2000A precession-nutation model.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/c2i00a.c)
pub fn C2i00a(date1: f64, date2: f64, rc2i: &mut [f64; 9]) {
    unsafe {
        eraC2i00a(date1, date2, rc2i);
    }
}

/// Form the celestial-to-intermediate matrix for a given date using the IAU
/// 2000B precession-nutation model.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/c2i00b.c)
pub fn C2i00b(date1: f64, date2: f64, rc2i: &mut [f64; 9]) {
    unsafe {
        eraC2i00b(date1, date2, rc2i);
    }
}

/// Form the celestial-to-intermediate matrix for a given date using the IAU
/// 2006 precession and IAU 2000A nutation models.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/c2i06a.c)
pub fn C2i06a(date1: f64, date2: f64, rc2i: &mut [f64; 9]) {
    unsafe {
        eraC2i06a(date1, date2, rc2i);
    }
}

/// Form the celestial-to-intermediate matrix for a given date given the bias-
/// precession-nutation matrix. IAU 2000.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/c2ibpn.c)
pub fn C2ibpn(date1: f64, date2: f64, rbpn: &[f64; 9], rc2i: &mut [f64; 9]) {
    unsafe {
        eraC2ibpn(date1, date2, rbpn, rc2i);
    }
}

/// Form the celestial to intermediate-frame-of-date matrix for a given date
/// when the CIP X,Y coordinates are known. IAU 2000.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/c2ixy.c)
pub fn C2ixy(date1: f64, date2: f64, x: f64, y: f64, rc2i: &mut [f64; 9]) {
    unsafe {
        eraC2ixy(date1, date2, x, y, rc2i);
    }
}

/// Form the celestial to intermediate-frame-of-date matrix given the CIP X,Y
/// and the CIO locator s.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/c2ixys.c)
pub fn C2ixys(x: f64, y: f64, s: f64, rc2i: &mut [f64; 9]) {
    unsafe {
        eraC2ixys(x, y, s, rc2i);
    }
}

/// Form the celestial to terrestrial matrix given the date, the UT1 and the
/// polar motion, using the IAU 2000A precession-nutation model.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/c2t00a.c)
pub fn C2t00a(tta: f64, ttb: f64, uta: f64, utb: f64, xp: f64, yp: f64, rc2t: &mut [f64; 9]) {
    unsafe {
        eraC2t00a(tta, ttb, uta, utb, xp, yp, rc2t);
    }
}

/// Form the celestial to terrestrial matrix given the date, the UT1 and the
/// polar motion, using the IAU 2000B precession-nutation model.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/c2t00b.c)
pub fn C2t00b(tta: f64, ttb: f64, uta: f64, utb: f64, xp: f64, yp: f64, rc2t: &mut [f64; 9]) {
    unsafe {
        eraC2t00b(tta, ttb, uta, utb, xp, yp, rc2t);
    }
}

/// Form the celestial to terrestrial matrix given the date, the UT1 and the
/// polar motion, using the IAU 2006/2000A precession-nutation model.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/c2t06a.c)
pub fn C2t06a(tta: f64, ttb: f64, uta: f64, utb: f64, xp: f64, yp: f64, rc2t: &mut [f64; 9]) {
    unsafe {
        eraC2t06a(tta, ttb, uta, utb, xp, yp, rc2t);
    }
}

/// Assemble the celestial to terrestrial matrix from CIO-based components (the
/// celestial-to-intermediate matrix, the Earth Rotation Angle and the polar
/// motion matrix).
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/c2tcio.c)
pub fn C2tcio(rc2i: &[f64; 9], era: f64, rpom: &[f64; 9], rc2t: &mut [f64; 9]) {
    unsafe {
        eraC2tcio(rc2i, era, rpom, rc2t);
    }
}

/// Assemble the celestial to terrestrial matrix from equinox-based components
/// (the celestial-to-true matrix, the Greenwich Apparent Sidereal Time and the
/// polar motion matrix).
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/c2teqx.c)
pub fn C2teqx(rbpn: &[f64; 9], gst: f64, rpom: &[f64; 9], rc2t: &mut [f64; 9]) {
    unsafe {
        eraC2teqx(rbpn, gst, rpom, rc2t);
    }
}

/// Form the celestial to terrestrial matrix given the date, the UT1, the
/// nutation and the polar motion. IAU 2000.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/c2tpe.c)
pub fn C2tpe(tta: f64, ttb: f64, uta: f64, utb: f64, dpsi: f64, deps: f64, xp: f64, yp: f64, rc2t: &mut [f64; 9]) {
    unsafe {
        eraC2tpe(tta, ttb, uta, utb, dpsi, deps, xp, yp, rc2t);
    }
}

/// Form the celestial to terrestrial matrix given the date, the UT1, the CIP
/// coordinates and the polar motion. IAU 2000.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/c2txy.c)
pub fn C2txy(tta: f64, ttb: f64, uta: f64, utb: f64, x: f64, y: f64, xp: f64, yp: f64, rc2t: &mut [f64; 9]) {
    unsafe {
        eraC2txy(tta, ttb, uta, utb, x, y, xp, yp, rc2t);
    }
}

/// Equation of the origins, IAU 2006 precession and IAU 2000A nutation.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/eo06a.c)
pub fn Eo06a(date1: f64, date2: f64) -> f64 {
    return unsafe { eraEo06a(date1, date2) };
}

/// Equation of the origins, given the classical NPB matrix and the quantity s.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/eors.c)
pub fn Eors(rnpb: &[f64; 9], s: f64) -> f64 {
    return unsafe { eraEors(rnpb, s) };
}

/// Form rotation matrix given the Fukushima-Williams angles.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/fw2m.c)
pub fn Fw2m(gamb: f64, phib: f64, psi: f64, eps: f64, r: &mut [f64; 9]) {
    unsafe {
        eraFw2m(gamb, phib, psi, eps, r);
    }
}

/// CIP X,Y given Fukushima-Williams bias-precession-nutation angles.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/fw2xy.c)
pub fn Fw2xy(gamb: f64, phib: f64, psi: f64, eps: f64) -> (f64, f64) {
    let mut x: f64 = 0.0;
    let mut y: f64 = 0.0;
    unsafe {
        eraFw2xy(gamb, phib, psi, eps, &mut x, &mut y);
    }

    return (x, y);
}

/// Long-term precession matrix.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/ltp.c)
pub fn Ltp(epj: f64, rp: &mut [f64; 9]) {
    unsafe {
        eraLtp(epj, rp);
    }
}

/// Long-term precession matrix, including ICRS frame bias.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/ltpb.c)
pub fn Ltpb(epj: f64, rpb: &mut [f64; 9]) {
    unsafe {
        eraLtpb(epj, rpb);
    }
}

/// Long-term precession of the ecliptic.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/ltpecl.c)
pub fn Ltpecl(epj: f64) -> [f64; 3] {
    let mut vec: [f64; 3] = [0.0; 3];
    unsafe {
        eraLtpecl(epj, &mut vec);
    }

    return vec;
}

/// Long-term precession of the equator.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/ltpequ.c)
pub fn Ltpequ(epj: f64) -> [f64; 3] {
    let mut veq: [f64; 3] = [0.0; 3];
    unsafe {
        eraLtpequ(epj, &mut veq);
    }

    return veq;
}

/// Form the matrix of nutation for a given date, IAU 2000A model.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/num00a.c)
pub fn Num00a(date1: f64, date2: f64, rmatn: &mut [f64; 9]) {
    unsafe {
        eraNum00a(date1, date2, rmatn);
    }
}

/// Form the matrix of nutation for a given date, IAU 2000B model.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/num00b.c)
pub fn Num00b(date1: f64, date2: f64, rmatn: &mut [f64; 9]) {
    unsafe {
        eraNum00b(date1, date2, rmatn);
    }
}

/// Form the matrix of nutation for a given date, IAU 2006/2000A model.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/num06a.c)
pub fn Num06a(date1: f64, date2: f64, rmatn: &mut [f64; 9]) {
    unsafe {
        eraNum06a(date1, date2, rmatn);
    }
}

/// Form the matrix of nutation.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/numat.c)
pub fn Numat(epsa: f64, dpsi: f64, deps: f64, rmatn: &mut [f64; 9]) {
    unsafe {
        eraNumat(epsa, dpsi, deps, rmatn);
    }
}

/// Nutation, IAU 2000A model (MHB2000 luni-solar and planetary nutation with
/// free core nutation omitted).
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/nut00a.c)
pub fn Nut00a(date1: f64, date2: f64) -> (f64, f64) {
    let mut dpsi: f64 = 0.0;
    let mut deps: f64 = 0.0;
    unsafe {
        eraNut00a(date1, date2, &mut dpsi, &mut deps);
    }

    return (dpsi, deps);
}

/// Nutation, IAU 2000B model.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/nut00b.c)
pub fn Nut00b(date1: f64, date2: f64) -> (f64, f64) {
    let mut dpsi: f64 = 0.0;
    let mut deps: f64 = 0.0;
    unsafe {
        eraNut00b(date1, date2, &mut dpsi, &mut deps);
    }

    return (dpsi, deps);
}

/// IAU 2000A nutation with adjustments to match the IAU 2006 precession.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/nut06a.c)
pub fn Nut06a(date1: f64, date2: f64) -> (f64, f64) {
    let mut dpsi: f64 = 0.0;
    let mut deps: f64 = 0.0;
    unsafe {
        eraNut06a(date1, date2, &mut dpsi, &mut deps);
    }

    return (dpsi, deps);
}

/// Nutation, IAU 1980 model.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/nut80.c)
pub fn Nut80(date1: f64, date2: f64) -> (f64, f64) {
    let mut dpsi: f64 = 0.0;
    let mut deps: f64 = 0.0;
    unsafe {
        eraNut80(date1, date2, &mut dpsi, &mut deps);
    }

    return (dpsi, deps);
}

/// Form the matrix of nutation for a given date, IAU 1980 model.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/nutm80.c)
pub fn Nutm80(date1: f64, date2: f64, rmatn: &mut [f64; 9]) {
    unsafe {
        eraNutm80(date1, date2, rmatn);
    }
}

/// Mean obliquity of the ecliptic, IAU 2006 precession model.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/obl06.c)
pub fn Obl06(date1: f64, date2: f64) -> f64 {
    return unsafe { eraObl06(date1, date2) };
}

/// Mean obliquity of the ecliptic, IAU 1980 model.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/obl80.c)
pub fn Obl80(date1: f64, date2: f64) -> f64 {
    return unsafe { eraObl80(date1, date2) };
}

/// Precession angles, IAU 2006, equinox based.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/p06e.c)
pub fn P06e(date1: f64, date2: f64) -> (f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64, f64) {
    let mut eps0: f64 = 0.0;
    let mut psia: f64 = 0.0;
    let mut oma: f64 = 0.0;
    let mut bpa: f64 = 0.0;
    let mut bqa: f64 = 0.0;
    let mut pia: f64 = 0.0;
    let mut bpia: f64 = 0.0;
    let mut epsa: f64 = 0.0;
    let mut chia: f64 = 0.0;
    let mut za: f64 = 0.0;
    let mut zetaa: f64 = 0.0;
    let mut thetaa: f64 = 0.0;
    let mut pa: f64 = 0.0;
    let mut gam: f64 = 0.0;
    let mut phi: f64 = 0.0;
    let mut psi: f64 = 0.0;

    unsafe {
        eraP06e(
            date1,
            date2,
            &mut eps0,
            &mut psia,
            &mut oma,
            &mut bpa,
            &mut bqa,
            &mut pia,
            &mut bpia,
            &mut epsa,
            &mut chia,
            &mut za,
            &mut zetaa,
            &mut thetaa,
            &mut pa,
            &mut gam,
            &mut phi,
            &mut psi,
        );
    }

    return (eps0, psia, oma, bpa, bqa, pia, bpia, epsa, chia, za, zetaa, thetaa, pa, gam, phi, psi);
}

/// This function forms three Euler angles which implement general precession
/// from epoch J2000.0, using the IAU 2006 model. Frame bias (the offset between
/// ICRS and mean J2000.0) is included.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/pb06.c)
pub fn Pb06(date1: f64, date2: f64) -> (f64, f64, f64) {
    let mut bzeta: f64 = 0.0;
    let mut bz: f64 = 0.0;
    let mut btheta: f64 = 0.0;

    unsafe {
        eraPb06(date1, date2, &mut bzeta, &mut bz, &mut btheta);
    }

    return (bzeta, bz, btheta);
}

/// Precession angles, IAU 2006 (Fukushima-Williams 4-angle formulation).
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/pfw06.c)
pub fn Pfw06(date1: f64, date2: f64) -> (f64, f64, f64, f64) {
    let mut gamb: f64 = 0.0;
    let mut phib: f64 = 0.0;
    let mut psib: f64 = 0.0;
    let mut epsa: f64 = 0.0;

    unsafe {
        eraPfw06(date1, date2, &mut gamb, &mut phib, &mut psib, &mut epsa);
    }

    return (gamb, phib, psib, epsa);
}

/// Precession matrix (including frame bias) from GCRS to a specified date, IAU
/// 2000 model.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/pmat00.c)
pub fn Pmat00(date1: f64, date2: f64, rbp: &mut [f64; 9]) {
    unsafe {
        eraPmat00(date1, date2, rbp);
    }
}

/// Precession matrix (including frame bias) from GCRS to a specified date, IAU
/// 2006 model.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/pmat06.c)
pub fn Pmat06(date1: f64, date2: f64, rbp: &mut [f64; 9]) {
    unsafe {
        eraPmat06(date1, date2, rbp);
    }
}

/// Precession matrix from J2000.0 to a specified date, IAU 1976 model.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/pmat76.c)
pub fn Pmat76(date1: f64, date2: f64, rmatp: &mut [f64; 9]) {
    unsafe {
        eraPmat76(date1, date2, rmatp);
    }
}

/// Precession-nutation, IAU 2000 model: a multi-purpose function, supporting
/// classical (equinox-based) use directly and CIO-based use indirectly.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/pn00.c)
pub fn Pn00(date1: f64, date2: f64, dpsi: f64, deps: f64, epsa: &mut f64, rb: &mut [f64; 9], rp: &mut [f64; 9], rbp: &mut [f64; 9], rn: &mut [f64; 9], rbpn: &mut [f64; 9]) {
    unsafe {
        eraPn00(date1, date2, dpsi, deps, epsa, rb, rp, rbp, rn, rbpn);
    }
}

/// Precession-nutation, IAU 2000A model: a multi-purpose function, supporting
/// classical (equinox-based) use directly and CIO-based use indirectly.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/pn00a.c)
pub fn Pn00a(date1: f64, date2: f64, dpsi: &mut f64, deps: &mut f64, epsa: &mut f64, rb: &mut [f64; 9], rp: &mut [f64; 9], rbp: &mut [f64; 9], rn: &mut [f64; 9], rbpn: &mut [f64; 9]) {
    unsafe {
        eraPn00a(date1, date2, dpsi, deps, epsa, rb, rp, rbp, rn, rbpn);
    }
}

/// Precession-nutation, IAU 2000B model: a multi-purpose function, supporting
/// classical (equinox-based) use directly and CIO-based use indirectly.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/pn00b.c)
pub fn Pn00b(date1: f64, date2: f64, dpsi: &mut f64, deps: &mut f64, epsa: &mut f64, rb: &mut [f64; 9], rp: &mut [f64; 9], rbp: &mut [f64; 9], rn: &mut [f64; 9], rbpn: &mut [f64; 9]) {
    unsafe {
        eraPn00b(date1, date2, dpsi, deps, epsa, rb, rp, rbp, rn, rbpn);
    }
}

/// Precession-nutation, IAU 2006 model: a multi-purpose function, supporting
/// classical (equinox-based) use directly and CIO-based use indirectly.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/pn06.c)
pub fn Pn06(date1: f64, date2: f64, dpsi: f64, deps: f64, epsa: &mut f64, rb: &mut [f64; 9], rp: &mut [f64; 9], rbp: &mut [f64; 9], rn: &mut [f64; 9], rbpn: &mut [f64; 9]) {
    unsafe {
        eraPn06(date1, date2, dpsi, deps, epsa, rb, rp, rbp, rn, rbpn);
    }
}

/// Precession-nutation, IAU 2006/2000A models: a multi-purpose function,
/// supporting classical (equinox-based) use directly and CIO-based use
/// indirectly.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/pn06a.c)
pub fn Pn06a(date1: f64, date2: f64, dpsi: &mut f64, deps: &mut f64, epsa: &mut f64, rb: &mut [f64; 9], rp: &mut [f64; 9], rbp: &mut [f64; 9], rn: &mut [f64; 9], rbpn: &mut [f64; 9]) {
    unsafe {
        eraPn06a(date1, date2, dpsi, deps, epsa, rb, rp, rbp, rn, rbpn);
    }
}

/// Form the matrix of precession-nutation for a given date (including frame
/// bias), equinox based, IAU 2000A model.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/pnm00a.c)
pub fn Pnm00a(date1: f64, date2: f64, rbpn: &mut [f64; 9]) {
    unsafe {
        eraPnm00a(date1, date2, rbpn);
    }
}

/// Form the matrix of precession-nutation for a given date (including frame
/// bias), equinox-based, IAU 2000B model.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/pnm00b.c)
pub fn Pnm00b(date1: f64, date2: f64, rbpn: &mut [f64; 9]) {
    unsafe {
        eraPnm00b(date1, date2, rbpn);
    }
}

/// Form the matrix of precession-nutation for a given date (including frame
/// bias), equinox based, IAU 2006 precession and IAU 2000A nutation models.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/pnm06a.c)
pub fn Pnm06a(date1: f64, date2: f64, rbpn: &mut [f64; 9]) {
    unsafe {
        eraPnm06a(date1, date2, rbpn);
    }
}

/// Form the matrix of precession/nutation for a given date, IAU 1976 precession
/// model, IAU 1980 nutation model.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/pnm80.c)
pub fn Pnm80(date1: f64, date2: f64, rmatpn: &mut [f64; 9]) {
    unsafe {
        eraPnm80(date1, date2, rmatpn);
    }
}

/// Form the matrix of polar motion for a given date, IAU 2000.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/pom00.c)
pub fn Pom00(xp: f64, yp: f64, sp: f64, rpom: &mut [f64; 9]) {
    unsafe {
        eraPom00(xp, yp, sp, rpom);
    }
}

/// Precession-rate part of the IAU 2000 precession-nutation models (part of
/// MHB2000).
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/pr00.c)
pub fn Pr00(date1: f64, date2: f64) -> (f64, f64) {
    let mut dpsipr: f64 = 0.0;
    let mut depspr: f64 = 0.0;

    unsafe {
        eraPr00(date1, date2, &mut dpsipr, &mut depspr);
    }

    return (dpsipr, depspr);
}

/// IAU 1976 precession model.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/prec76.c)
pub fn Prec76(date01: f64, date02: f64, date11: f64, date12: f64) -> (f64, f64, f64) {
    let mut zeta: f64 = 0.0;
    let mut z: f64 = 0.0;
    let mut theta: f64 = 0.0;

    unsafe {
        eraPrec76(date01, date02, date11, date12, &mut zeta, &mut z, &mut theta);
    }

    return (zeta, z, theta);
}

/// The CIO locator s, positioning the Celestial Intermediate Origin on the
/// equator of the Celestial Intermediate Pole, given the CIP's X,Y coordinates.
/// Compatible with IAU 2000A precession-nutation.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/s00.c)
pub fn S00(date1: f64, date2: f64, x: f64, y: f64) -> f64 {
    return unsafe { eraS00(date1, date2, x, y) };
}

/// The CIO locator s, positioning the Celestial Intermediate Origin on the
/// equator of the Celestial Intermediate Pole, using the IAU 2000A precession-
/// nutation model.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/s00a.c)
pub fn S00a(date1: f64, date2: f64) -> f64 {
    return unsafe { eraS00a(date1, date2) };
}

/// The CIO locator s, positioning the Celestial Intermediate Origin on the
/// equator of the Celestial Intermediate Pole, using the IAU 2000B precession-
/// nutation model.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/s00b.c)
pub fn S00b(date1: f64, date2: f64) -> f64 {
    return unsafe { eraS00b(date1, date2) };
}

/// The CIO locator s, positioning the Celestial Intermediate Origin on the
/// equator of the Celestial Intermediate Pole, given the CIP's X,Y coordinates.
/// Compatible with IAU 2006/2000A precession-nutation.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/s06.c)
pub fn S06(date1: f64, date2: f64, x: f64, y: f64) -> f64 {
    return unsafe { eraS06(date1, date2, x, y) };
}

/// The CIO locator s, positioning the Celestial Intermediate Origin on the
/// equator of the Celestial Intermediate Pole, using the IAU 2006 precession
/// and IAU 2000A nutation models.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/s06a.c)
pub fn S06a(date1: f64, date2: f64) -> f64 {
    return unsafe { eraS06a(date1, date2) };
}

/// The TIO locator s', positioning the Terrestrial Intermediate Origin on the
/// equator of the Celestial Intermediate Pole.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/sp00.c)
pub fn Sp00(date1: f64, date2: f64) -> f64 {
    return unsafe { eraSp00(date1, date2) };
}

/// X,Y coordinates of celestial intermediate pole from series based on IAU 2006
/// precession and IAU 2000A nutation.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/xy06.c)
pub fn Xy06(date1: f64, date2: f64) -> (f64, f64) {
    let mut x: f64 = 0.0;
    let mut y: f64 = 0.0;

    unsafe {
        eraXy06(date1, date2, &mut x, &mut y);
    }

    return (x, y);
}

/// For a given TT date, compute the X,Y coordinates of the Celestial
/// Intermediate Pole and the CIO locator s, using the IAU 2000A precession-
/// nutation model.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/xys00a.c)
pub fn Xys00a(date1: f64, date2: f64) -> (f64, f64, f64) {
    let mut x: f64 = 0.0;
    let mut y: f64 = 0.0;
    let mut s: f64 = 0.0;

    unsafe {
        eraXys00a(date1, date2, &mut x, &mut y, &mut s);
    }

    return (x, y, s);
}

/// For a given TT date, compute the X,Y coordinates of the Celestial
/// Intermediate Pole and the CIO locator s, using the IAU 2000B precession-
/// nutation model.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/xys00b.c)
pub fn Xys00b(date1: f64, date2: f64) -> (f64, f64, f64) {
    let mut x: f64 = 0.0;
    let mut y: f64 = 0.0;
    let mut s: f64 = 0.0;

    unsafe {
        eraXys00b(date1, date2, &mut x, &mut y, &mut s);
    }

    return (x, y, s);
}

/// For a given TT date, compute the X,Y coordinates of the Celestial
/// Intermediate Pole and the CIO locator s, using the IAU 2006 precession and
/// IAU 2000A nutation models.
///
/// Please see the full ERFA docs for this function [here](https://github.com/liberfa/erfa/blob/master/src/xys06a.c)
pub fn Xys06a(date1: f64, date2: f64) -> (f64, f64, f64) {
    let mut x: f64 = 0.0;
    let mut y: f64 = 0.0;
    let mut s: f64 = 0.0;

    unsafe {
        eraXys06a(date1, date2, &mut x, &mut y, &mut s);
    }

    return (x, y, s);
}