An event detector passing over a point on Earth

Hello,

The FootPrintOverlapDetector breaks when only one point is passed due to the PolygonSet representation of the area, then what would be a suitable event detector class for that matter?

(I was thinking of a simple fieldofviewdetector but the problem is that I need to convert a geodetic point to PVcoordinates.)

Thank you!

Hi @gabmath,

You can convert a GeodeticPoint to PVCoordinates (or rather create a PVCoordinatesProvider to use in the FieldOfViewDetector constructor) using the following method:

import org.hipparchus.geometry.euclidean.threed.Vector3D;
import org.hipparchus.util.FastMath;
import org.orekit.bodies.GeodeticPoint;
import org.orekit.bodies.OneAxisEllipsoid;
import org.orekit.data.DataContext;
import org.orekit.data.DirectoryCrawler;
import org.orekit.frames.Frame;
import org.orekit.frames.FramesFactory;
import org.orekit.frames.Transform;
import org.orekit.models.earth.ReferenceEllipsoid;
import org.orekit.time.AbsoluteDate;
import org.orekit.utils.IERSConventions;
import org.orekit.utils.PVCoordinates;
import org.orekit.utils.PVCoordinatesProvider;
import org.orekit.utils.TimeStampedPVCoordinates;

import java.io.File;

public class GeodeticToPV {
   
   public static void main(String[] args) {
      
      // Load Orekit data
      loadOrekitData();

      // Define geodetic point
      final double latitude  = FastMath.toRadians(0);
      final double longitude = FastMath.toRadians(10);
      final double altitude  = 0;

      final GeodeticPoint point = new GeodeticPoint(latitude, longitude, altitude);

      // Define Earth shape
      final Frame            itrf       = FramesFactory.getITRF(IERSConventions.IERS_2010, false);
      final OneAxisEllipsoid earthShape = ReferenceEllipsoid.getIers2010(itrf);

      // Provider to use in field of view detector
      final PointOnBodyPVProvider provider = new PointOnBodyPVProvider(earthShape, point);
   }

   private static class PointOnBodyPVProvider implements PVCoordinatesProvider {

      private final OneAxisEllipsoid bodyShape;
      private final GeodeticPoint    point;

      private PointOnBodyPVProvider(OneAxisEllipsoid bodyShape, GeodeticPoint point) {
         this.bodyShape = bodyShape;
         this.point     = point;
      }

      @Override
      public TimeStampedPVCoordinates getPVCoordinates(AbsoluteDate date, Frame frame) {

         // Express point pv in body frame, no velocity as point is fixed relative to body frame
         final Vector3D      positionOnBody = bodyShape.transform(point);
         final PVCoordinates pvOnBody       = new PVCoordinates(positionOnBody, Vector3D.ZERO);

         // Compute transform from body frame to output frame
         final Frame     bodyFrame        = bodyShape.getBodyFrame();
         final Transform bodyFrameToFrame = bodyFrame.getTransformTo(frame, date);

         // Express point pn in output frame
         return bodyFrameToFrame.transformPVCoordinates(new TimeStampedPVCoordinates(date, pvOnBody));
      }
   }

   private static void loadOrekitData() {
      //Loading Data
      File rootDir       = new File(System.getProperty("user.home"));
      File orekitDataDir = new File(rootDir, "orekit-data");
      DataContext.getDefault().getDataProvidersManager().addProvider(new DirectoryCrawler(orekitDataDir));
   }
}

Cheers,
Vincent

EDIT:
Even simpler, you can directly use a TopocentricFrame which acts as a PVCoordinatesProvider
:sweat_smile:

2 Likes

Thank you so much!

@Vincent Do you think it is actually a good idea to use the FootPrintOverlapDetector with a point and constructing other two points with a small deviation in the angles?

Could you describe your use case so that we can be sure that it is the most suited detector ?

Cheers,
Vincent