Function lupnt::safe_acos¶
Defined in File math_utils.cc
Function Documentation¶
-
Real lupnt::safe_acos(Real x)¶
Compute the safe acos function.
Numerically robust
acos, clamping the input to[-1, 1](offset byEPS) before evaluating, to avoid NaNs from values that are out of range only due to floating-point round-off.Used throughout geometry/elevation-angle computations — e.g.
GnssMeasurement’s elevation/off-boresight angles,GnssAttitude’s yaw/attitude angles, and orbital-element conversions (inclination from angular-momentum components) — wherever theacosargument is a dot product of unit vectors that may slightly exceed +/-1 due to round-off.- Parameters:
x – Input value
x – Cosine value, nominally in
[-1, 1]
- Returns:
acos(x) if x is in [-1, 1], otherwise acos(x - EPS) or acos(x + EPS)
- Returns:
acos(x), withxclamped to(-1, 1)if it lies (slightly) outside