spice_sys/
lib.rs

1use libc::{c_char, c_double, c_float, c_int, c_long, c_short, c_void, uintptr_t};
2
3// Definitions corresponding to the defs in CSPICE
4pub type SpiceLong = c_long;
5pub type SpiceInt = c_int; // this may be wrong for windows...
6pub type SpiceShort = c_short;
7pub type SpiceChar = c_char;
8pub type SpiceDouble = c_double;
9pub type SpiceFloat = c_float;
10pub type SpiceBoolean = c_int;
11
12#[repr(C)]
13pub struct SpiceCellC {
14    _private: [u8; 0],
15}
16
17// not that the field names after fwdptr have been changed
18// by adding an '_' to avoid `isize` as it's a keyword.
19#[repr(C)]
20pub struct SpiceDLADescrC {
21    bwdptr: SpiceInt,
22    fwdptr: SpiceInt,
23    i_base: SpiceInt,
24    i_size: SpiceInt,
25    d_base: SpiceInt,
26    d_size: SpiceInt,
27    c_base: SpiceInt,
28    c_size: SpiceInt,
29}
30
31/// Number of coordinate system parameters in DSK descriptor
32const SPICE_DSK_NSYPAR: uintptr_t = 10;
33
34/// DSK segment descriptor
35#[repr(C)]
36pub struct SpiceDSKDescrC {
37    surfce: SpiceInt,
38    center: SpiceInt,
39    dclass: SpiceInt,
40    dtype: SpiceInt,
41    frmcde: SpiceInt,
42    corsys: SpiceInt,
43    corpar: [SpiceInt; SPICE_DSK_NSYPAR], // Note this array length is hard-coded in CSPICE
44    co1min: SpiceDouble,
45    co1max: SpiceDouble,
46    co2min: SpiceDouble,
47    co2max: SpiceDouble,
48    co3min: SpiceDouble,
49    co3max: SpiceDouble,
50    start: SpiceDouble,
51    stop: SpiceDouble,
52}
53
54#[link(name = "cspice")]
55extern "C" {
56    /// loads an individual kernel or a collection of kernels.
57    pub fn furnsh_c(file: *const c_char);
58
59    /// unloads an individual kernel or a collection of kernels.
60    pub fn unload_c(file: *const c_char);
61
62    /// converts a time string to ET seconds past J2000.
63    pub fn str2et_c(string: *const c_char, et: *mut c_double);
64
65    /// converts ET seconds past J2000 to a time string.
66    pub fn timout_c(et: c_double, pictur: *const c_char, lenout: c_int, output: *mut c_char);
67
68    /// converts an SCLK string to ET seconds past J2000.
69    pub fn scs2e_c(sc: c_int, sclkch: *const c_char, et: *mut c_double);
70
71    /// Clear the KEEPER subsystem: unload all kernels, clear the kernel pool, and
72    /// re-initialize the subsystem.
73    pub fn kclear_c();
74
75    /// Return the current number of kernels that have been loaded via the KEEPER
76    /// interface that are of a specified type.
77    pub fn ktotal_c(kind: *const c_char, count: *mut c_int);
78
79    /// converts ET seconds past J2000 to SCLK string.
80    pub fn sce2s_c(sc: c_int, et: c_double, lenout: c_int, sclkch: *mut c_char);
81
82    /// converts an encoded SCLK to ET seconds past J2000.
83    pub fn sct2e_c(sc: c_int, sclkdp: c_double, et: *mut c_double);
84
85    /// converts ET seconds past J2000 to encoded SCLK
86    pub fn sce2c_c(sc: c_int, et: c_double, sclkdp: *mut c_double);
87
88    /// converts an SCLK string to encoded SCLK.
89    pub fn scencd_c(sc: c_int, sclkch: *const c_char, sclkdp: *mut c_double);
90
91    /// converts an encoded SCLK to SCLK string.
92    pub fn scdecd_c(sc: c_int, sclkdp: c_double, lenout: c_int, sclkch: *mut c_char);
93
94    /// determines whether values exist for some item for a body in the kernel pool.
95    pub fn bodfnd_c(body: c_int, item: *const c_char) -> SpiceBoolean;
96
97    /// retrieves from the kernel pool the values of an item associated with a body.
98    pub fn bodvrd_c(
99        bodynm: *const c_char,
100        item: *const c_char,
101        maxn: c_int,
102        dim: *mut c_int,
103        values: *mut c_double,
104    );
105
106    /// returns the 3x3 matrix rotating a position vector one frame to another.
107    pub fn pxform_c(
108        from: *const c_char,
109        to: *const c_char,
110        et: c_double,
111        rotate: *mut *mut c_double,
112    );
113
114    /// returns the 6x6 matrix rotating a state vector from one frame to another.
115    pub fn sxform_c(
116        from: *const c_char,
117        to: *const c_char,
118        et: c_double,
119        xform: *mut *mut c_double,
120    );
121
122    /// finds the set of reference frame class ID codes of all frames in a binary PCK file.
123    pub fn pckfrm_c(pck: *const c_char, ids: *mut SpiceCellC);
124
125    /// finds the coverage window for a reference frame in a binary PCK file.
126    pub fn pckcov_c(pck: *const c_char, idcode: c_int, cover: *mut SpiceCellC);
127
128    /// returns the 3x3 matrix rotating a position vector from one frame at a
129    /// specified epoch to another frame at a different epoch.
130    pub fn pxfrm2_c(
131        from: *const c_char,
132        to: *const c_char,
133        etfrom: c_double,
134        ett0: c_double,
135        rotate: *mut *mut c_double,
136    );
137
138    /// returns the state of a target body relative to an observing body.
139    pub fn spkezr_c(
140        targ: *const c_char,
141        et: c_double,
142        reff: *const c_char,
143        abcorr: *const c_char,
144        obs: *const c_char,
145        starg: *mut c_double,
146        lt: *mut c_double,
147    );
148
149    /// returns the position of a target body relative to an observing body.
150    pub fn spkpos_c(
151        targ: *const c_char,
152        et: c_double,
153        reff: *const c_char,
154        abcorr: *const c_char,
155        obs: *const c_char,
156        ptarg: *mut c_double,
157        lt: *mut c_double,
158    );
159
160    /// returns the state of a target body relative to a constant-position observer location.
161    pub fn spkcpo_c(
162        target: *const c_char,
163        et: c_double,
164        outref: *const c_char,
165        refloc: *const c_char,
166        abcorr: *const c_char,
167        obspos: *const c_double,
168        obsctr: *const c_char,
169        obsref: *const c_char,
170        state: *mut c_double,
171        lt: *mut c_double,
172    );
173
174    /// returns the state of a constant-position target location relative to an observing body.
175    pub fn spkcpt_c(
176        trgpos: *const c_double,
177        trgctr: *const c_char,
178        trgref: *const c_char,
179        et: c_double,
180        outref: *const c_char,
181        refloc: *const c_char,
182        abcorr: *const c_char,
183        obsrvr: *const c_char,
184        state: *mut c_double,
185        lt: *mut c_double,
186    );
187
188    /// returns the state of a target body relative to a constant-velocity observer location.
189    pub fn spkcvo_c(
190        target: *const c_char,
191        et: c_double,
192        outref: *const c_char,
193        refloc: *const c_char,
194        abcorr: *const c_char,
195        obssta: *const c_double,
196        obsepc: c_double,
197        obsctr: *const c_char,
198        obsref: *const c_char,
199        state: *mut c_double,
200        lt: *mut c_double,
201    );
202
203    /// returns the state of a constant-velocity target location relative to an observing body.
204    pub fn spkcvt_c(
205        trgsta: *const c_double,
206        trgepc: c_double,
207        trgctr: *const c_char,
208        trgref: *const c_char,
209        et: c_double,
210        outref: *const c_char,
211        refloc: *const c_char,
212        abcorr: *const c_char,
213        obsrvr: *const c_char,
214        state: *mut c_double,
215        lt: *mut c_double,
216    );
217
218    /// finds the set of ID codes for all objects in a specified SPK file.
219    pub fn spkobj_c(spk: *const c_char, ids: *mut SpiceCellC);
220
221    /// finds the coverage window for a specified object in a specified SPK file.
222    pub fn spkcov_c(spk: *const c_char, idcode: c_int, cover: *mut SpiceCellC);
223
224    /// finds the set of ID codes for all objects in a specified CK file.
225    pub fn ckobj_c(ck: *const c_char, ids: *mut SpiceCellC);
226
227    /// finds the coverage window for a specified object in a specified CK file.
228    pub fn ckcov_c(
229        ck: *const c_char,
230        idcode: c_int,
231        needav: SpiceBoolean,
232        level: *const c_char,
233        tol: c_double,
234        timsys: *const c_char,
235        cover: *mut SpiceCellC,
236    );
237
238    /// gets pointing for a specified CK ID at a specified SCLK time.
239    pub fn ckgp_c(
240        inst: c_int,
241        sclkdp: c_double,
242        tol: c_double,
243        reff: *const c_char,
244        cmat: *const *const c_double,
245        clkout: *mut c_double,
246        founnd: *mut SpiceBoolean,
247    );
248
249    /// gets pointing and angular velocity for a specified CK ID at a specified SCLK time.
250    pub fn ckgpav_c(
251        inst: c_int,
252        sclkdp: c_double,
253        tol: c_double,
254        reff: *const c_char,
255        cmat: *mut *mut c_double,
256        av: *mut c_double,
257        clkout: *mut c_double,
258        found: *mut SpiceBoolean,
259    );
260
261    /// returns the field-of-view (FOV) configuration for a specified instrument.
262    pub fn getfov_c(
263        instid: c_int,
264        room: c_int,
265        shapelen: c_int,
266        framelen: c_int,
267        shape: *mut c_char,
268        frame: *mut c_char,
269        bsight: *mut c_double,
270        n: *mut c_int,
271        bounds: *mut *mut c_double,
272    );
273
274    /// returns the double precision value of a kernel variable from the kernel pool.
275    pub fn gdpool_c(
276        name: *const c_char,
277        start: c_int,
278        room: c_int,
279        n: *mut c_int,
280        values: *mut c_double,
281        found: *mut SpiceBoolean,
282    );
283
284    /// returns the integer value of a kernel variable from the kernel pool.
285    pub fn gipool_c(
286        name: *const c_char,
287        start: c_int,
288        room: c_int,
289        n: *mut c_int,
290        ivals: *mut c_int,
291        found: *mut SpiceBoolean,
292    );
293
294    /// returns the character value of a kernel variable from the kernel pool.
295    pub fn gcpool_c(
296        name: *const c_char,
297        start: c_int,
298        room: c_int,
299        n: *mut c_int,
300        cvals: *mut c_void,
301        found: *mut SpiceBoolean,
302    );
303
304    /// maps an array of planetocentric longitude/latitude coordinate pairs to
305    /// surface points on a body, modeled as an ellipsoid or a digital shape (DSK).
306    pub fn latsrf_c(
307        method: *const c_char,
308        target: *const c_char,
309        et: c_double,
310        fixref: *const c_char,
311        npts: c_int,
312        lonlat: *const *const c_double,
313        srfpts: *mut *mut c_double,
314    );
315
316    /// maps an array of surface points on a body, modeled as an ellipsoid or a
317    /// digital shape (DSK), to the corresponding outward surface normal vectors.
318    pub fn srfnrm_c(
319        method: *const c_char,
320        target: *const c_char,
321        et: c_double,
322        fixref: *const c_char,
323        npts: c_int,
324        srfpts: *const *const c_double,
325        normls: *mut *mut c_double,
326    );
327
328    /// returns plate model size parameters (plate count and vertex count) for a
329    /// type 2 DSK segment.
330    pub fn dskz02_c(handle: c_int, dladsc: *const SpiceDLADescrC, nv: *mut c_int, np: *mut c_int);
331
332    /// returns triangular plates from a type 2 DSK segment.
333    pub fn dskp02_c(
334        handle: c_int,
335        dladsc: *const SpiceDLADescrC,
336        start: c_int,
337        room: c_int,
338        n: *mut c_int,
339        plates: *mut *mut c_int,
340    );
341
342    /// returns vertices from a type 2 DSK segment.
343    pub fn dskv02_c(
344        handle: c_int,
345        dladsc: *const SpiceDLADescrC,
346        start: c_int,
347        room: c_int,
348        n: *mut c_int,
349        vrtces: *mut *mut c_double,
350    );
351
352    /// returns the set of body ID codes of all objects for which data are
353    /// provided in a DSK file.
354    pub fn dskobj_c(dsk: *const c_char, bodids: *mut SpiceCellC);
355
356    /// returns the set of surface ID codes for all surfaces associated with a body
357    ///in a DSK file.
358    pub fn dsksrf_c(dsk: *const c_char, bodyid: c_int, srfids: *mut SpiceCellC);
359
360    /// translates the NAIF integer code of a body into a common name for that body.
361    pub fn bodc2n_c(code: c_int, lenout: c_int, name: *mut c_char, found: *mut SpiceBoolean);
362
363    /// translates the name of a body or object to the corresponding NAIF integer ID code.
364    pub fn bodn2c_c(name: *const c_char, code: *mut c_int, found: *mut SpiceBoolean);
365
366    /// translates a surface ID code, together with a body name, to the corresponding surface name.
367    pub fn srfcss_c(
368        code: c_int,
369        bodstr: *const c_char,
370        srflen: c_int,
371        srfstr: *mut c_char,
372        isname: *mut SpiceBoolean,
373    );
374
375    /// translates a surface string, together with a body name, to the corresponding surface ID code.
376    pub fn srfs2c_c(
377        srfstr: *const c_char,
378        bodstr: *const c_char,
379        code: *mut c_int,
380        found: *mut SpiceBoolean,
381    );
382
383    /// translates a surface ID code, together with a body ID code, to the corresponding surface name.
384    pub fn srfc2s_c(
385        code: c_int,
386        bodyid: c_int,
387        srflen: c_int,
388        srfstr: *mut c_char,
389        isname: *mut SpiceBoolean,
390    );
391
392    /// translates a surface string, together with a body ID code, to the corresponding surface ID code.
393    pub fn srfscc_c(
394        srfstr: *const c_char,
395        bodyid: c_int,
396        code: *mut c_int,
397        found: *mut SpiceBoolean,
398    );
399
400    /// converts from rectangular to planetocentric coordinates.
401    pub fn reclat_c(
402        rectan: *const c_double,
403        radius: *mut c_double,
404        longitude: *mut c_double,
405        latitude: *mut c_double,
406    );
407
408    /// converts from planetocentric to rectangular coordinates.
409    pub fn latrec_c(
410        radius: c_double,
411        longitude: c_double,
412        latitude: c_double,
413        rectan: *mut c_double,
414    );
415
416    /// converts from planetocentric lat/lon of a surface point on a body to rectangular coordinates.
417    pub fn srfrec_c(body: c_int, longitude: c_double, latitude: c_double, rectan: *mut c_double);
418
419    /// converts from rectangular to geodetic coordinates.
420    pub fn recgeo_c(
421        rectan: *const c_double,
422        re: c_double,
423        f: c_double,
424        lon: *mut c_double,
425        lat: *mut c_double,
426        alt: *mut c_double,
427    );
428
429    /// converts from geodetic to rectangular coordinates.
430    pub fn georec_c(
431        lon: c_double,
432        lat: c_double,
433        alt: c_double,
434        re: c_double,
435        f: c_double,
436        rectan: *mut c_double,
437    );
438
439    /// converts from rectangular to planetographic coordinates.
440    pub fn recpgr_c(
441        body: *const c_char,
442        rectan: *const c_double,
443        re: c_double,
444        f: c_double,
445        lon: *mut c_double,
446        lat: *mut c_double,
447        alt: *mut c_double,
448    );
449
450    /// converts from planetographic to rectangular coordinates.
451    pub fn pgrrec_c(
452        body: *const c_char,
453        lon: c_double,
454        lat: c_double,
455        alt: c_double,
456        re: c_double,
457        f: c_double,
458        rectan: *mut c_double,
459    );
460
461    /// computes the surface intercept point of the ray on a body, modeled as an
462    /// ellipsoid or a digital shape (DSK), at a specified epoch.
463    pub fn sincpt_c(
464        method: *const c_char,
465        target: *const c_char,
466        et: c_double,
467        fixref: *const c_char,
468        abcorr: *const c_char,
469        obsrvr: *const c_char,
470        dref: *const c_char,
471        dvec: *const c_double,
472        spoint: *mut c_double,
473        trgepc: *mut c_double,
474        srfvec: *mut c_double,
475        found: *mut SpiceBoolean,
476    );
477
478    /// computes ray-surface intercepts for a set of rays, using data provided
479    /// by multiple loaded DSK segments.
480    pub fn dskxv_c(
481        pri: SpiceBoolean,
482        target: *const c_char,
483        nsurf: c_int,
484        srflst: *const c_int,
485        et: c_double,
486        fixref: *const c_char,
487        nrays: c_int,
488        vtxarr: *const *const c_double,
489        dirarr: *const *const c_double,
490        xptarr: *mut *mut c_double,
491        fndarr: *mut SpiceBoolean,
492    );
493
494    /// computes a ray-surface intercept using data provided by multiple loaded
495    /// DSK segments and returns information about the source of the data
496    /// defining the surface on which the intercept was found.
497    pub fn dskxsi_c(
498        pri: SpiceBoolean,
499        target: *const c_char,
500        nsurf: c_int,
501        srflst: *const c_int,
502        et: c_double,
503        fixref: *const c_char,
504        vertex: *const c_double,
505        raydir: *const c_double,
506        maxd: c_int,
507        maxi: c_int,
508        xpt: *mut c_double,
509        handle: *mut c_int,
510        dladsc: *mut SpiceDLADescrC,
511        dskdsc: *mut SpiceDSKDescrC,
512        dc: *mut c_double,
513        ic: *mut c_int,
514        found: *mut SpiceBoolean,
515    );
516
517    /// computes the sub-observer point on a body, modeled as an ellipsoid or
518    /// a digital shape (DSK), at a particular epoch.
519    pub fn subpnt_c(
520        method: *const c_char,
521        target: *const c_char,
522        et: c_double,
523        fixref: *const c_char,
524        abcorr: *const c_char,
525        obsrvr: *const c_char,
526        spoint: *mut c_double,
527        trgepc: *mut c_double,
528        srfvec: *mut c_double,
529    );
530
531    /// computes the sub-solar point on a body, modeled as an ellipsoid or a
532    /// digital shape (DSK), as seen by an observer at a particular epoch.
533    pub fn subslr_c(
534        method: *const c_char,
535        target: *const c_char,
536        et: c_double,
537        fixref: *const c_char,
538        abcorr: *const c_char,
539        obsrvr: *const c_char,
540        spoint: *mut c_double,
541        trgepc: *mut c_double,
542        srfvec: *mut c_double,
543    );
544
545    /// computes the illumination angles at a specified surface point of a
546    /// target body, modeled as an ellipsoid or a digital shape (DSK), as
547    /// seen from an observer body, illuminated by the Sun.
548    pub fn ilumin_c(
549        method: *const c_char,
550        target: *const c_char,
551        et: c_double,
552        fixref: *const c_char,
553        abcorr: *const c_char,
554        obsrvr: *const c_char,
555        spoint: *const c_double,
556        trgepc: *mut c_double,
557        srfvec: *mut c_double,
558        phase: *mut c_double,
559        incdnc: *mut c_double,
560        emissn: *mut c_double,
561    );
562
563    /// computes the illumination angles at a specified surface point of a
564    /// target body, modeled as an ellipsoid or a digital shape (DSK), as
565    /// seen from an observer body, illuminated by a user specified body.
566    pub fn illumg_c(
567        method: *const c_char,
568        target: *const c_char,
569        ilusrc: *const c_char,
570        et: c_double,
571        fixref: *const c_char,
572        abcorr: *const c_char,
573        obsrvr: *const c_char,
574        spoint: *const c_double,
575        trgepc: *mut c_double,
576        srfvec: *mut c_double,
577        phase: *mut c_double,
578        incdnc: *mut c_double,
579        emissn: *mut c_double,
580    );
581
582    /// computes the illumination angles at a specified surface point of a
583    /// target body, modeled as an ellipsoid or a digital shape (DSK), as
584    /// seen from an observer body, illuminated by a user specified body,
585    /// with flags indicating whether the point is visible from the observer
586    /// and whether it is illuminated.
587    pub fn illumf_c(
588        method: *const c_char,
589        target: *const c_char,
590        ilusrc: *const c_char,
591        et: c_double,
592        fixref: *const c_char,
593        abcorr: *const c_char,
594        obsrvr: *const c_char,
595        spoint: *const c_double,
596        trgepc: *mut c_double,
597        srfvec: *mut c_double,
598        phase: *mut c_double,
599        incdnc: *mut c_double,
600        visibl: *mut SpiceBoolean,
601        lit: *mut SpiceBoolean,
602    );
603
604    /// computes the apparent phase angle between the centers of target,
605    /// observer, and illuminator ephemeris objects.
606    pub fn phaseq_c(
607        et: c_double,
608        target: *const c_char,
609        illmn: *const c_char,
610        obsrvr: *const c_char,
611        abcorr: *const c_char,
612    ) -> c_double;
613
614    /// computes limb points on a body, modeled as an ellipsoid or a
615    /// digital shape (DSK).
616    pub fn limbpt_c(
617        method: *const c_char,
618        target: *const c_char,
619        et: c_double,
620        fixref: *const c_char,
621        abcorr: *const c_char,
622        corloc: *const c_char,
623        obsrvr: *const c_char,
624        refvec: *const c_double,
625        rolstp: c_double,
626        ncuts: c_int,
627        schstp: c_double,
628        soltol: c_double,
629        maxn: c_int,
630        npts: *mut c_int,
631        points: *mut *mut c_double,
632        epochs: *mut c_double,
633        tangts: *mut *mut c_double,
634    );
635
636    /// computes umbral or penumbral terminator points on a body, modeled as
637    /// an ellipsoid or a digital shape (DSK).
638    pub fn termpt_c(
639        method: *const c_char,
640        ilusrc: *const c_char,
641        target: *const c_char,
642        et: c_double,
643        fixref: *const c_char,
644        abcorr: *const c_char,
645        corloc: *const c_char,
646        obsrvr: *const c_char,
647        refvec: *const c_double,
648        rolstp: c_double,
649        ncuts: c_int,
650        schstp: c_double,
651        soltol: c_double,
652        maxn: c_int,
653        npts: *mut c_int,
654        points: *mut *mut c_double,
655        epochs: *mut c_double,
656        trmvcs: *mut *mut c_double,
657    );
658
659    /// determines the state of an orbiting body from a set orbital elements.
660    pub fn conics_c(elts: *const c_double, et: c_double, state: *mut c_double);
661
662    /// determines the set of orbital elements corresponding to the state of a
663    /// body.
664    pub fn oscelt_c(state: *const c_double, et: c_double, mu: c_double, elts: *mut c_double);
665
666    /// determines if a specified ray is within the FOV of a specified
667    /// instrument at a given time.
668    pub fn fovray_c(
669        inst: *const c_char,
670        raydir: *const c_double,
671        rframe: *const c_char,
672        abcorr: *const c_char,
673        obsrvr: *const c_char,
674        et: *const c_double,
675        visible: *mut SpiceBoolean,
676    );
677
678    /// determines if a specified ephemeris object is within the FOV of a
679    /// specified instrument at a given time.
680    pub fn fovtrg_c(
681        inst: *const c_char,
682        target: *const c_char,
683        tshape: *const c_char,
684        tframe: *const c_char,
685        abcorr: *const c_char,
686        obsrvr: *const c_char,
687        et: *const c_double,
688        visible: *mut SpiceBoolean,
689    );
690
691    /// determines the occultation condition (not occulted, partially,
692    /// etc.) of one target relative to another target as seen by an observer at
693    /// a given time, with targets modeled as points, ellipsoids, or digital
694    /// shapes (DSK).
695    pub fn occult_c(
696        targ1: *const c_char,
697        shape1: *const c_char,
698        frame1: *const c_char,
699        targ2: *const c_char,
700        shape2: *const c_char,
701        frame2: *const c_char,
702        abcorr: *const c_char,
703        obsrvr: *const c_char,
704        et: c_double,
705        ocltid: *mut c_int,
706    );
707
708    /// determines time intervals when a specified constraint on observer-target
709    /// distance is met.
710    pub fn gfdist_c(
711        target: *const c_char,
712        abcorr: *const c_char,
713        obsrvr: *const c_char,
714        relate: *const c_char,
715        refval: c_double,
716        adjust: c_double,
717        step: c_double,
718        nintvls: c_int,
719        cnfine: *mut SpiceCellC,
720        result: *mut SpiceCellC,
721    );
722
723    /// determines time intervals when a specified constraint on the observed
724    /// phase, solar incidence, or emission angle at a surface point is met.
725    pub fn gfilum_c(
726        method: *const c_char,
727        angtyp: *const c_char,
728        target: *const c_char,
729        illmn: *const c_char,
730        fixref: *const c_char,
731        abcorr: *const c_char,
732        obsrvr: *const c_char,
733        spoint: *const c_double,
734        relate: *const c_char,
735        refval: c_double,
736        adjust: c_double,
737        step: c_double,
738        nintvls: c_int,
739        cnfine: *mut SpiceCellC,
740        result: *mut SpiceCellC,
741    );
742
743    /// determines time intervals when a specified constraint on the phase angle
744    /// between the illuminator, target, and observer body centers is met.
745    pub fn gfpa_c(
746        target: *const c_char,
747        illmn: *const c_char,
748        frame: *const c_char,
749        abcorr: *const c_char,
750        obsrvr: *const c_char,
751        relate: *const c_char,
752        refval: c_double,
753        adjust: c_double,
754        step: c_double,
755        nintvls: c_int,
756        cnfine: *mut SpiceCellC,
757        result: *mut SpiceCellC,
758    );
759
760    /// determines time intervals when a coordinate of an observer-target
761    /// position vector satisfies a numerical constraint.
762    pub fn gfposc_c(
763        target: *const c_char,
764        frame: *const c_char,
765        abcorr: *const c_char,
766        obsrvr: *const c_char,
767        crdsys: *const c_char,
768        coord: *const c_char,
769        relate: *const c_char,
770        refval: c_double,
771        adjust: c_double,
772        step: c_double,
773        nintvls: c_int,
774        cnfine: *mut SpiceCellC,
775        result: *mut SpiceCellC,
776    );
777
778    /// determines time intervals when a specified constraint on the observer-
779    /// target range rate is met.
780    pub fn gfrr_c(
781        target: *const c_char,
782        abcorr: *const c_char,
783        obsrvr: *const c_char,
784        relate: *const c_char,
785        refval: c_double,
786        adjust: c_double,
787        step: c_double,
788        nintvls: c_int,
789        cnfine: *mut SpiceCellC,
790        result: *mut SpiceCellC,
791    );
792
793    /// determines time intervals when the angular separation between the
794    /// position vectors of two target bodies relative to an observer satisfies
795    /// a numerical relationship.
796    pub fn gfsep_c(
797        targ1: *const c_char,
798        shape1: *const c_char,
799        frame1: *const c_char,
800        targ2: *const c_char,
801        shape2: *const c_char,
802        frame2: *const c_char,
803        abcorr: *const c_char,
804        obsrvr: *const c_char,
805        relate: *const c_char,
806        refval: c_double,
807        adjust: c_double,
808        step: c_double,
809        nintvls: c_int,
810        cnfine: *mut SpiceCellC,
811        result: *mut SpiceCellC,
812    );
813
814    /// determines time intervals when a coordinate of a ray-surface intercept
815    /// position vector satisfies a numerical constraint.
816    pub fn gfsntc_c(
817        target: *const c_char,
818        fixref: *const c_char,
819        method: *const c_char,
820        abcorr: *const c_char,
821        obsrvr: *const c_char,
822        dref: *const c_char,
823        dvec: *const c_double,
824        crdsys: *const c_char,
825        coord: *const c_char,
826        relate: *const c_char,
827        refval: c_double,
828        adjust: c_double,
829        step: c_double,
830        nintvls: c_int,
831        cnfine: *mut SpiceCellC,
832        result: *mut SpiceCellC,
833    );
834
835    /// determines time intervals when a coordinate of a sub-observer point
836    /// position vector satisfies a numerical constraint.
837    pub fn gfsubc_c(
838        target: *const c_char,
839        fixref: *const c_char,
840        method: *const c_char,
841        abcorr: *const c_char,
842        obsrvr: *const c_char,
843        crdsys: *const c_char,
844        coord: *const c_char,
845        relate: *const c_char,
846        refval: c_double,
847        adjust: c_double,
848        step: c_double,
849        nintvls: c_int,
850        cnfine: *mut SpiceCellC,
851        result: *mut SpiceCellC,
852    );
853
854    /// determines time intervals when a specified ray intersects the space
855    /// bounded by the field-of-view (FOV) of a specified instrument.
856    pub fn gfrfov_c(
857        inst: *const c_char,
858        raydir: *const c_double,
859        rframe: *const c_char,
860        abcorr: *const c_char,
861        obsrvr: *const c_char,
862        step: c_double,
863        cnfine: *mut SpiceCellC,
864        result: *mut SpiceCellC,
865    );
866
867    /// determines time intervals when a specified ephemeris object intersects
868    /// the space bounded by the field-of-view (FOV) of a specified instrument.
869    pub fn gftfov_c(
870        inst: *const c_char,
871        target: *const c_char,
872        tshape: *const c_char,
873        tframe: *const c_char,
874        abcorr: *const c_char,
875        obsrvr: *const c_char,
876        step: c_double,
877        cnfine: *mut SpiceCellC,
878        result: *mut SpiceCellC,
879    );
880
881    /// determines time intervals when an observer sees one target occulted by
882    /// another, with targets modeled as points, ellipsoids, or digital shapes
883    /// (DSK).
884    pub fn gfoclt_c(
885        occtyp: *const c_char,
886        front: *const c_char,
887        fshape: *const c_char,
888        fframe: *const c_char,
889        back: *const c_char,
890        bshape: *const c_char,
891        bframe: *const c_char,
892        abcorr: *const c_char,
893        obsrvr: *const c_char,
894        step: c_double,
895        cnfine: *mut SpiceCellC,
896        result: *mut SpiceCellC,
897    );
898
899    /// converts from rectangular coordinates to range, right ascension, and
900    /// declination.
901    pub fn recrad_c(
902        rectan: *const c_double,
903        range: *mut c_double,
904        ra: *mut c_double,
905        dec: *mut c_double,
906    );
907
908    /// converts from range, right ascension, and declination to rectangular
909    /// coordinates.
910    pub fn radrec_c(range: c_double, ra: c_double, dec: c_double, rectan: *mut c_double);
911
912    /// converts from rectangular to spherical coordinates.
913    pub fn recsph_c(
914        rectan: *const c_double,
915        r: *mut c_double,
916        colat: *mut c_double,
917        lons: *mut c_double,
918    );
919
920    /// converts from spherical to rectangular coordinates.
921    pub fn sphrec_c(r: c_double, colat: c_double, lons: c_double, rectan: *mut c_double);
922
923    /// converts from rectangular to cylindrical coordinates.
924    pub fn reccyl_c(
925        rectan: *const c_double,
926        r: *mut c_double,
927        lon: *mut c_double,
928        z: *mut c_double,
929    );
930
931    /// converts from cylindrical to rectangular coordinates.
932    pub fn cylrec_c(r: c_double, lon: c_double, z: c_double, rectan: *mut c_double);
933
934    /// converts from spherical to cylindrical coordinates.
935    pub fn sphcyl_c(
936        radius: c_double,
937        colat: c_double,
938        slon: c_double,
939        r: *mut c_double,
940        lon: *mut c_double,
941        z: *mut c_double,
942    );
943
944    /// converts from cylindrical to spherical coordinates.
945    pub fn cylsph_c(
946        r: c_double,
947        lonc: c_double,
948        z: c_double,
949        radius: *mut c_double,
950        colat: *mut c_double,
951        lon: *mut c_double,
952    );
953
954    /// converts from spherical to latitudinal coordinates.
955    pub fn sphlat_c(
956        r: c_double,
957        colat: c_double,
958        lons: c_double,
959        radius: *mut c_double,
960        lon: *mut c_double,
961        lat: *mut c_double,
962    );
963
964    /// converts from latitudinal to spherical coordinates.
965    pub fn latsph_c(
966        radius: c_double,
967        lon: c_double,
968        lat: c_double,
969        rho: *mut c_double,
970        colat: *mut c_double,
971        lons: *mut c_double,
972    );
973
974    /// converts from cylindrical to latitudinal coordinates.
975    pub fn cyllat_c(
976        r: c_double,
977        lonc: c_double,
978        z: c_double,
979        radius: *mut c_double,
980        lon: *mut c_double,
981        lat: *mut c_double,
982    );
983
984    /// converts from latitudinal to cylindrical coordinates.
985    pub fn latcyl_c(
986        radius: c_double,
987        lon: c_double,
988        lat: c_double,
989        r: *mut c_double,
990        lonc: *mut c_double,
991        z: *mut c_double,
992    );
993
994    /// transforms states between coordinate systems -- rectangular, cylindrical,
995    /// latitudinal, spherical, geodetic, and planetographic.
996    pub fn xfmsta_c(
997        input_state: *const c_double,
998        input_coord_sys: *const c_char,
999        output_coord_sys: *const c_char,
1000        body: *const c_char,
1001        output_state: *mut c_double,
1002    );
1003
1004    /// packs three scalar components into a vector.
1005    pub fn vpack_c(x: c_double, y: c_double, z: c_double, v: *mut c_double);
1006
1007    /// unpacks three scalar components from a vector.
1008    pub fn vupack_c(v: *const c_double, x: *mut c_double, y: *mut c_double, z: *mut c_double);
1009
1010    /// adds two 3D vectors.
1011    pub fn vadd_c(v1: *const c_double, v2: *const c_double, vout: *mut c_double);
1012
1013    /// computes the difference between two 3D vectors.
1014    pub fn vsub_c(v1: *const c_double, v2: *const c_double, vout: *mut c_double);
1015
1016    /// computes the cross product of two 3D vectors.
1017    pub fn vcrss_c(v1: *const c_double, v2: *const c_double, vout: *mut c_double);
1018
1019    /// computes the dot product of two 3D vectors.
1020    pub fn vdot_c(v1: *const c_double, v2: *const c_double) -> c_double;
1021
1022    /// returns the relative difference between two 3D vectors
1023    pub fn vrel_c(v1: *const c_double, v2: *const c_double) -> c_double;
1024
1025    /// multiplies a scalar and a 3D vector.
1026    pub fn vscl_c(s: c_double, v1: *const c_double, vout: *mut c_double);
1027
1028    /// negates a 3D vector.
1029    pub fn vminus_c(v1: *const c_double, vout: *mut c_double);
1030
1031    /// makes one 3D vector equal to another.
1032    pub fn vequ_c(vin: *const c_double, vout: *mut c_double);
1033
1034    /// indicates whether a 3D vector is the zero vector.
1035    pub fn vzero_c(v: *const c_double) -> SpiceBoolean;
1036
1037    /// finds the separation angle between two 3D vectors.
1038    pub fn vsep_c(v1: *const c_double, v2: *const c_double) -> c_double;
1039
1040    /// returns the distance between two 3D vectors.
1041    pub fn vdist_c(v1: *const c_double, v2: *const c_double) -> c_double;
1042
1043    /// computes the magnitude of a 3D vector.
1044    pub fn vnorm_c(v1: *const c_double) -> c_double;
1045
1046    /// finds the unit vector along a 3D vector.
1047    pub fn vhat_c(v1: *const c_double, vout: *mut c_double);
1048
1049    /// computes the normalized cross product of two 3D vectors.
1050    pub fn ucrss_c(v1: *const c_double, v2: *const c_double, vout: *mut c_double);
1051
1052    /// normalizes a 3D vector and return its magnitude.
1053    pub fn unorm_c(v1: *const c_double, vout: *mut c_double, vmag: *mut c_double);
1054
1055    /// finds the component of a 3D vector that is perpendicular to a second 3D
1056    /// vector.
1057    pub fn vperp_c(a: *const c_double, b: *const c_double, p: *mut c_double);
1058
1059    /// finds the projection of one 3D vector onto another 3D vector.
1060    pub fn vproj_c(a: *const c_double, b: *const c_double, p: *mut c_double);
1061
1062    /// rotates a 3D vector about a specified axis 3D vector by a specified
1063    /// angle.
1064    pub fn vrotv_c(v: *const c_double, axis: *const c_double, theta: c_double, r: *mut c_double);
1065
1066    /// transform a 3D vector to a new coordinate system rotated by an angle
1067    /// about X, Y, or Z.
1068    pub fn rotvec_c(v1: *const c_double, angle: c_double, iaxis: c_int, vout: *mut c_double);
1069
1070    /// computes the vector linear combination a*v1 + b*v2 of two 3D vectors.
1071    pub fn vlcom_c(
1072        a: c_double,
1073        v1: *const c_double,
1074        b: c_double,
1075        v2: *const c_double,
1076        sum: *mut c_double,
1077    );
1078
1079    /// computes the vector linear combination a*v1 + b*v2 + c*v3 of three 3D
1080    /// vectors.
1081    pub fn vlcom3_c(
1082        a: c_double,
1083        v1: *const c_double,
1084        b: c_double,
1085        v2: *const c_double,
1086        c: c_double,
1087        v3: *const c_double,
1088        sum: *mut c_double,
1089    );
1090
1091    /// multiplies two 3x3 matrices.
1092    pub fn mxm_c(m1: *const *const c_double, m2: *const *const c_double, mout: *mut *mut c_double);
1093
1094    /// multiplies a 3x3 matrix and the transpose of another 3x3 matrix.
1095    pub fn mxmt_c(m1: *const *const c_double, m2: *const *const c_double, mout: *mut *mut c_double);
1096
1097    /// multiplies a 3x3 matrix with a 3D vector.
1098    pub fn mxv_c(m1: *const *const c_double, vin: *const c_double, vout: *mut c_double);
1099
1100    /// multiplies the transpose of a 3x3 matrix and a 3x3 matrix.
1101    pub fn mtxm_c(m1: *const *const c_double, m2: *const *const c_double, mout: *mut *mut c_double);
1102
1103    /// multiplies the transpose of a 3x3 matrix on the left with a 3D vector on
1104    /// the right.
1105    pub fn mtxv_c(m1: *const *const c_double, vin: *const c_double, vout: *mut c_double);
1106
1107    /// multiplies the transpose of a 3D vector, a 3x3 matrix, and a 3D vector.
1108    pub fn vtmv_c(
1109        v1: *const c_double,
1110        matrix: *const *const c_double,
1111        v2: *const c_double,
1112    ) -> c_double;
1113
1114    /// transposes a 3x3 matrix.
1115    pub fn xpose_c(m1: *const *const c_double, mout: *mut *mut c_double);
1116
1117    /// sets one 3x3 matrix equal to another.
1118    pub fn mequ_c(m1: *const *const c_double, mout: *mut *mut c_double);
1119
1120    /// computes the determinant of a 3x3 matrix.
1121    pub fn det_c(matrix: *const *const c_double);
1122
1123    /// returns the trace of a 3x3 matrix.
1124    pub fn trace_c(matrix: *const *const c_double);
1125
1126    /// calculates the 3x3 matrix for a rotation of an angle about the X, Y or Z
1127    /// axis.
1128    pub fn rotate_c(angle: c_double, iaxis: c_int, mout: *mut *mut c_double);
1129
1130    /// applies a rotation of an angle about the X, Y, or Z axis to a matrix.
1131    pub fn rotmat_c(
1132        m1: *const *const c_double,
1133        angle: c_double,
1134        iaxis: c_int,
1135        mout: *mut *mut c_double,
1136    );
1137
1138    /// builds the transformation to a frame based on two vectors.
1139    pub fn twovec_c(
1140        axdef: *const c_double,
1141        indexa: c_int,
1142        pldef: *const c_double,
1143        indexp: c_int,
1144        mout: *mut *mut c_double,
1145    );
1146
1147    /// constructs a rotation matrix from a set of Euler angles.
1148    pub fn eul2m_c(
1149        angle3: c_double,
1150        angle2: c_double,
1151        angle1: c_double,
1152        axis3: c_int,
1153        axis2: c_int,
1154        axis1: c_int,
1155        r: *mut *mut c_double,
1156    );
1157
1158    /// factors a matrix as a product of three rotations about specified axes.
1159    pub fn m2eul_c(
1160        r: *const *const c_double,
1161        axis3: c_int,
1162        axis2: c_int,
1163        axis1: c_int,
1164        angle3: *mut c_double,
1165        angle2: *mut c_double,
1166        angle1: *mut c_double,
1167    );
1168
1169    /// computes the axis of the rotation given by a matrix and the angle about
1170    /// that axis.
1171    pub fn raxisa_c(matrix: *const *const c_double, axis: *mut c_double, angle: *mut c_double);
1172
1173    /// construct a rotation matrix that rotates vectors by an angle about an
1174    /// axis.
1175    pub fn axisar_c(axis: *const c_double, angle: c_double, r: *mut *mut c_double);
1176
1177    /// finds a unit quaternion corresponding to a specified rotation matrix.
1178    pub fn m2q_c(r: *const *const c_double, q: *mut c_double);
1179
1180    /// find the rotation matrix corresponding to a specified unit quaternion.
1181    pub fn q2m_c(q: *const c_double, r: *mut *mut c_double);
1182
1183    /// returns half the value of pi.
1184    pub fn halfpi_c() -> c_double;
1185
1186    /// returns the value of pi.
1187    pub fn pi_c() -> c_double;
1188
1189    /// returns twice the value of pi.
1190    pub fn twopi_c() -> c_double;
1191
1192    /// returns the number of degrees per radian.
1193    pub fn dpr_c() -> c_double;
1194
1195    /// returns the number of radians per degree.
1196    pub fn rpd_c() -> c_double;
1197
1198    /// returns the number of seconds in a day.
1199    pub fn spd_c() -> c_double;
1200
1201    /// returns the number of seconds per Julian year.
1202    pub fn jyear_c() -> c_double;
1203
1204    /// returns the number of seconds per tropical year.
1205    pub fn tyear_c() -> c_double;
1206
1207    /// returns the speed of light in vacuo (km/sec)
1208    pub fn clight_c() -> c_double;
1209
1210    /// returns the Julian Date corresponding to Besselian date 1900.0.
1211    pub fn b1900_c() -> c_double;
1212
1213    /// returns the Julian Date corresponding to Besselian date 1950.0.
1214    pub fn b1950_c() -> c_double;
1215
1216    /// returns the Julian Date of 1899 DEC 31 12:00:00 (1900 JAN 0.5).
1217    pub fn j1900_c() -> c_double;
1218
1219    /// returns the Julian Date of 1950 JAN 01 00:00:00 (1950 JAN 1.0).
1220    pub fn j1950_c() -> c_double;
1221
1222    /// returns the Julian Date of 2000 JAN 01 12:00:00 (2000 JAN 1.5).
1223    pub fn j2000_c() -> c_double;
1224
1225    /// returns the Julian Date of 2100 JAN 01 12:00:00 (2100 JAN 1.5).
1226    pub fn j2100_c() -> c_double;
1227}