LoS Access function?

Using Orekit Python, I want to determine if a spacecraft has line-of-sight (LoS) access to a given Earth Station, and if so what the range is. In pseudo code:

  1. Define a FieldLine with the SC position and ES location points

  2. Use the closestPoint() method to get the line’s point closest to the center of the Earth.

  3. Use the Ellipsoid.isInside() method to determine if the closest point is inside the Earth. If not, then we have line-of-sight access.

This seems pretty straight forward, but it is such a common problem that I was wondering if there is a built-in method like “hasAccess” to do this already? Thanks!

I figured it out - the logic above doesn’t work, but here’s the correct answer in case someone else finds this useful:

  1. construct a line from the SC position to the ES position
  2. determine the abscissa coordinate on the line for both objects
  3. if both values have the same sign, we have unobstructed line-of-sight

The reason this works is that Orekit defines the origin of a line abscissa as the point closest to the origin in the current frame (e.g. center of the Earth). So having the same sign on the abscissa means both objects are on the “same side” of the Earth’s center. Code snippet looks something like this:

from org.hipparchus.geometry.euclidean.threed import Line

line = Line(f_vector, t_vector, 0.1)
f_ab = line.getAbscissa(f_vector)
t_ab = line.getAbscissa(t_vector)

los = ((f_ab < 0 and t_ab < 0) or (f_ab > 0 and t_ab > 0))

The built-in way is to use ElevationDetector to find the access times based on a minimum ground elevation angle or elevation mask. Or for a single point to use TopocentricFrame.getElevation(...).

I figured there had to be something - thanks for the hint!