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
//
// GENERATED FILE
//
use super::*;
use f2rust_std::*;
const DTOL: f64 = 0.000000000001;
const NPTOL: f64 = 0.000000000001;
//
// The utility function T_ISNPLN tests whether the "near point" found
// by NPEDLN satisfies the criterion that the outward surface normal
// at this point can be extended to intersect the input line
// orthogonally.
//
pub fn T_ISNPLN(
A: f64,
B: f64,
C: f64,
LINEPT: &[f64],
LINEDR: &[f64],
X: &[f64],
D: f64,
OK: &mut bool,
ctx: &mut Context,
) -> f2rust_std::Result<bool> {
let LINEPT = DummyArray::new(LINEPT, 1..=3);
let LINEDR = DummyArray::new(LINEDR, 1..=3);
let X = DummyArray::new(X, 1..=3);
let mut T_ISNPLN: bool = false;
let mut APPROX = StackArray::<f64, 3>::new(1..=3);
let mut NORMAL = StackArray::<f64, 3>::new(1..=3);
let mut LINMIN = StackArray::<f64, 3>::new(1..=3);
let mut DIST2: f64 = 0.0;
//
// SPICELIB functions
//
//
// Local parameters
//
//
// Local variables
//
//
// Executable code.
//
//
// The point on the line closest to the ellipsoid ( LINMIN ).
//
spicelib::NPLNPT(
LINEPT.as_slice(),
LINEDR.as_slice(),
X.as_slice(),
LINMIN.as_slice_mut(),
&mut DIST2,
ctx,
)?;
//
// Check the distance. This is pretty easy to get right.
//
testutil::CHCKSD(b"D", D, b"~/", DIST2, DTOL, OK, ctx)?;
if !*OK {
T_ISNPLN = false;
return Ok(T_ISNPLN);
}
//
// Obtain ellipsoid surface unit normal at the near point.
//
spicelib::SURFNM(A, B, C, X.as_slice(), NORMAL.as_slice_mut(), ctx)?;
//
// Approximation to LINMIN using X and D.
//
spicelib::VSCLIP(D, NORMAL.as_slice_mut());
spicelib::VADD(X.as_slice(), NORMAL.as_slice(), APPROX.as_slice_mut());
//
// Check the relative error in the approximation to LINMIN.
//
testutil::CHCKAD(
b"APPROX",
APPROX.as_slice(),
b"~~/",
LINMIN.as_slice(),
3,
NPTOL,
OK,
ctx,
)?;
T_ISNPLN = *OK;
Ok(T_ISNPLN)
}