Pass prediction over an area polygon on ground

I’m trying to predict when an area (defined by a set of coordinates) is visible to payload on the CubeSat. My analogy is as follows:

  1. create a FoV for the CubeSat.
  2. create a target area using SphericalPolygonsSet.
  3. Use FootPrintOverViewDetector for detecting when the FoV crosses the ground target area polygon.

Below is the code for same.

 String line1 = "1 25544U 98067A   23232.54552208  .00013950  00000+0  25634-3 0  9993";
        String line2 = "2 25544  51.6414   9.6997 0003586 329.2127 122.8297 15.49506380411773";
        double mass = 430000;
        double halfApparture = 20;

        // Propagation Characteristics
        AbsoluteDate start_date = new AbsoluteDate(new Date(), TimeScalesFactory.getUTC()); // Propagation starts from date of most recent TLE (Orekit)
        AbsoluteDate final_date = start_date.shiftedBy(1*3600); // 1 day

        //setup orbit from tle
        final TLE tle = new TLE(line1, line2);
        final Frame satelliteFrame = FramesFactory.getTEME();
        var attitudeProvider = new NadirPointing(FramesFactory.getTEME(), Earth.DEFAULT_EARTH_SHAPE);

        final SGP4 propagator = new SGP4(tle, attitudeProvider, mass, satelliteFrame);

        //define satellite FoV
        FieldOfView fov = new CircularFieldOfView(Vector3D.PLUS_K, FastMath.toRadians(halfApparture), 0);

        //define earth
        var earth = Earth.DEFAULT_EARTH_SHAPE;
        var earthFrame = earth.getBodyFrame();

        //define area
        List<Double> AOILongs = List.of(-120.,-119.,-118.);
        List<Double> AOILats = List.of(39.,38.,39.);
        List<Double> AOIAlts = List.of(0.,0.,0.);

        S2Point[] vertex_points = new S2Point[AOILats.size()];

        for (int i = 0; i < AOILats.size(); i++) {
            GeodeticPoint vertex = new GeodeticPoint(FastMath.toRadians(AOILats.get(i)), FastMath.toRadians(AOILongs.get(i)), AOIAlts.get(i));
            vertex_points[i] = new S2Point(FastMath.toRadians(AOILongs.get(i)),FastMath.toRadians(90- AOILats.get(i)));
        //create the polygon
        SphericalPolygonsSet AOI = new SphericalPolygonsSet(1e-3, vertex_points);

        System.out.println("size of AOI : " + AOI.getSize());

        try {
            EventDetector geoDetect = new FootprintOverlapDetector(fov, (OneAxisEllipsoid) earth,AOI,100)
                    .withMaxCheck(60)// Checking every x second
                    .withHandler((s, detector, increasing) -> {
                        if (increasing) {
                            System.out.println("ENTERING AOI at: " + s.getDate());
                        } else {
                            System.out.println("LEAVING AOI at: " + s.getDate()+"\n");
                        return  Action.CONTINUE;

        System.out.println("adding detector to propagator");
        }catch (Exception e){

        System.out.println("\n *** start of simulation ***");

        System.out.println("\n *** end of simulation ***");

When I ran this code, the code froze creation of event detector for a long time, finally throwing the following error:

org.orekit.errors.OrekitInternalError: internal error, please notify development team by creating a new topic at

the time after this error shows up is directly related to the sampling rate value in the FootPrintOverlapDetector, as when I had a value 10 , the error takes a lot of time to show up while if it’s 1000 , the error pops up immediately.

When I replaced FootPrintOverlapDetector with GeographicalZoneDetector , the code is running, but the results are way off.