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
//
// GENERATED FILE
//
use super::*;
use f2rust_std::*;
//$Procedure ZZGFPAQ ( Private --- GF, phase angle between bodies )
pub fn ZZGFPAQ(
ET: f64,
TARG: i32,
ILLMN: i32,
OBS: i32,
ABCORR: &[u8],
VALUE: &mut f64,
ctx: &mut Context,
) -> f2rust_std::Result<()> {
let mut LT: f64 = 0.0;
let mut SEP: f64 = 0.0;
let mut PV1 = StackArray::<f64, 3>::new(1..=3);
let mut PV2 = StackArray::<f64, 3>::new(1..=3);
let mut REF = [b' '; 5 as usize];
//
// SPICELIB functions.
//
//
// Local Variables.
//
//
// Standard SPICE error handling.
//
if RETURN(ctx) {
return Ok(());
}
CHKIN(b"ZZGFPAQ", ctx)?;
//
// This calculation is invariant with respect to reference frame.
// Use J2000 for convenience.
//
fstr::assign(&mut REF, b"J2000");
//
// Get the position of the TARG object relative to OBS at ET.
//
SPKEZP(
TARG,
ET,
&REF,
ABCORR,
OBS,
PV1.as_slice_mut(),
&mut LT,
ctx,
)?;
if FAILED(ctx) {
CHKOUT(b"ZZGFPAQ", ctx)?;
return Ok(());
}
//
// Get the state of the ILLMN object relative to TARG at ET
// for no aberration correction, or ET - LT otherwise.
//
if EQSTR(ABCORR, b"NONE") {
SPKEZP(
ILLMN,
ET,
&REF,
ABCORR,
TARG,
PV2.as_slice_mut(),
&mut LT,
ctx,
)?;
} else {
SPKEZP(
ILLMN,
(ET - LT),
&REF,
ABCORR,
TARG,
PV2.as_slice_mut(),
&mut LT,
ctx,
)?;
}
if FAILED(ctx) {
CHKOUT(b"ZZGFPAQ", ctx)?;
return Ok(());
}
//
// ILLMN OBS
// ILLMN as seen ^ /
// from TARG at | /
// ET - LT. | /
// >|..../< phase angle
// | /
// . | /
// . | /
// . v TARG as seen from OBS
// SEP . TARG at ET
// . /
// /
// v
//
// PI = SEP + PHASE
//
// so
//
// PHASE = PI - SEP
//
// Calculate the angle separating the vectors relative to TARG
//
SEP = VSEP(PV1.as_slice(), PV2.as_slice(), ctx);
//
// The angle of interest is that between -PV1 and PV2 measured from
// TARG. Subtract SEP from PI to calculate this angle.
//
*VALUE = (PI(ctx) - SEP);
//
// All done.
//
CHKOUT(b"ZZGFPAQ", ctx)?;
Ok(())
}