Search in sources :

Example 1 with EllipsoidTessellator

use of org.orekit.models.earth.tessellation.EllipsoidTessellator in project Orekit by CS-SI.

the class DOPComputation method sample.

/**
 * Mesh an area of interest into a grid of geodetic points.
 *
 * @param zone the area to mesh
 * @param meshSize the size of the square meshes as a distance on the Earth surface (in meters)
 * @return a list of geodetic points sampling the zone of interest
 * @throws OrekitException if the area cannot be meshed
 */
private List<List<GeodeticPoint>> sample(final OneAxisEllipsoid shape, final List<GeodeticPoint> zone, final double meshSize) throws OrekitException {
    // Convert the area into a SphericalPolygonsSet
    final SphericalPolygonsSet sps = computeSphericalPolygonsSet(zone);
    // Build the tesselator
    final TileAiming aiming = new ConstantAzimuthAiming(shape, 0.);
    final EllipsoidTessellator tessellator = new EllipsoidTessellator(shape, aiming, 4);
    // Returns the sampled area as a grid of geodetic points
    return tessellator.sample(sps, meshSize, meshSize);
}
Also used : ConstantAzimuthAiming(org.orekit.models.earth.tessellation.ConstantAzimuthAiming) EllipsoidTessellator(org.orekit.models.earth.tessellation.EllipsoidTessellator) SphericalPolygonsSet(org.hipparchus.geometry.spherical.twod.SphericalPolygonsSet) TileAiming(org.orekit.models.earth.tessellation.TileAiming)

Example 2 with EllipsoidTessellator

use of org.orekit.models.earth.tessellation.EllipsoidTessellator in project Orekit by CS-SI.

the class FootprintOverlapDetector method sample.

/**
 * Sample the region.
 * @param body body on which the geographic zone is defined
 * @param zone geographic zone to consider
 * @param samplingStep  linear step used for sampling the geographic zone (in meters)
 * @return sampling points
 * @throws OrekitException if the region cannot be sampled
 */
private static List<SamplingPoint> sample(final OneAxisEllipsoid body, final SphericalPolygonsSet zone, final double samplingStep) throws OrekitException {
    final List<SamplingPoint> sampledZone = new ArrayList<SamplingPoint>();
    // sample the zone boundary
    final List<Vertex> boundary = zone.getBoundaryLoops();
    for (final Vertex loopStart : boundary) {
        int count = 0;
        for (Vertex v = loopStart; count == 0 || v != loopStart; v = v.getOutgoing().getEnd()) {
            ++count;
            final Edge edge = v.getOutgoing();
            final int n = (int) FastMath.ceil(edge.getLength() * body.getEquatorialRadius() / samplingStep);
            for (int i = 0; i < n; ++i) {
                final S2Point intermediate = new S2Point(edge.getPointAt(i * edge.getLength() / n));
                final GeodeticPoint gp = new GeodeticPoint(0.5 * FastMath.PI - intermediate.getPhi(), intermediate.getTheta(), 0.0);
                sampledZone.add(new SamplingPoint(body.transform(gp), gp.getZenith()));
            }
        }
    }
    // sample the zone interior
    final EllipsoidTessellator tessellator = new EllipsoidTessellator(body, new ConstantAzimuthAiming(body, 0.0), 4);
    final List<List<GeodeticPoint>> gpSample = tessellator.sample(zone, samplingStep, samplingStep);
    for (final List<GeodeticPoint> list : gpSample) {
        for (final GeodeticPoint gp : list) {
            sampledZone.add(new SamplingPoint(body.transform(gp), gp.getZenith()));
        }
    }
    return sampledZone;
}
Also used : Vertex(org.hipparchus.geometry.spherical.twod.Vertex) S2Point(org.hipparchus.geometry.spherical.twod.S2Point) ArrayList(java.util.ArrayList) EllipsoidTessellator(org.orekit.models.earth.tessellation.EllipsoidTessellator) S2Point(org.hipparchus.geometry.spherical.twod.S2Point) GeodeticPoint(org.orekit.bodies.GeodeticPoint) ConstantAzimuthAiming(org.orekit.models.earth.tessellation.ConstantAzimuthAiming) ArrayList(java.util.ArrayList) List(java.util.List) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Edge(org.hipparchus.geometry.spherical.twod.Edge)

Aggregations

ConstantAzimuthAiming (org.orekit.models.earth.tessellation.ConstantAzimuthAiming)2 EllipsoidTessellator (org.orekit.models.earth.tessellation.EllipsoidTessellator)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Edge (org.hipparchus.geometry.spherical.twod.Edge)1 S2Point (org.hipparchus.geometry.spherical.twod.S2Point)1 SphericalPolygonsSet (org.hipparchus.geometry.spherical.twod.SphericalPolygonsSet)1 Vertex (org.hipparchus.geometry.spherical.twod.Vertex)1 GeodeticPoint (org.orekit.bodies.GeodeticPoint)1 TileAiming (org.orekit.models.earth.tessellation.TileAiming)1