Search in sources :

Example 16 with SphericalPolygonsSet

use of org.hipparchus.geometry.spherical.twod.SphericalPolygonsSet in project Orekit by CS-SI.

the class EllipsoidTessellatorTest method doTestVariableTolerance.

private void doTestVariableTolerance(final double tolerance) throws OrekitException {
    final ConstantAzimuthAiming aiming = new ConstantAzimuthAiming(ellipsoid, FastMath.toRadians(-168.178485));
    EllipsoidTessellator tessellator = new EllipsoidTessellator(ellipsoid, aiming, 16);
    SphericalPolygonsSet small = buildSimpleZone(tolerance, new double[][] { { -0.01048739, 0.01598931 }, { -0.00789627, 0.01555693 }, { -0.00558595, 0.01430664 }, { -0.00380677, 0.01237394 }, { -0.00275154, 0.00996826 }, { -0.00253461, 0.00735029 }, { -0.00317949, 0.00480374 }, { -0.00461629, 0.00260455 }, { -0.00668931, 0.00099105 }, { -0.00917392, 0.00013808 }, { -0.01180086, 0.00013808 }, { -0.01428546, 0.00099105 }, { -0.01635849, 0.00260455 }, { -0.01779529, 0.00480374 }, { -0.01844016, 0.00735029 }, { -0.01822323, 0.00996826 }, { -0.01716800, 0.01237394 }, { -0.01538882, 0.01430664 }, { -0.01307850, 0.01555693 } });
    final double maxWidth = 40000.0;
    final double maxLength = 40000.0;
    final List<List<Tile>> tiles = tessellator.tessellate(small, maxWidth, maxLength, 0, 0, false, true);
    Assert.assertEquals(1, tiles.size());
    Assert.assertEquals(1, tiles.get(0).size());
}
Also used : List(java.util.List) SphericalPolygonsSet(org.hipparchus.geometry.spherical.twod.SphericalPolygonsSet)

Example 17 with SphericalPolygonsSet

use of org.hipparchus.geometry.spherical.twod.SphericalPolygonsSet in project Orekit by CS-SI.

the class EllipsoidTessellatorTest method testTilesSmallZoneWithTruncation.

@Test
public void testTilesSmallZoneWithTruncation() throws OrekitException, IOException {
    TileAiming aiming = new ConstantAzimuthAiming(ellipsoid, FastMath.toRadians(193.7));
    EllipsoidTessellator tessellator = new EllipsoidTessellator(ellipsoid, aiming, 16);
    SphericalPolygonsSet small = buildSimpleZone(1.0e-10, new double[][] { { 43.6543, 1.4268 }, { 43.6120, 1.4179 }, { 43.6016, 1.3994 }, { 43.5682, 1.4159 }, { 43.5707, 1.4358 }, { 43.5573, 1.4941 }, { 43.6041, 1.4866 } });
    final List<List<Tile>> tiles = tessellator.tessellate(small, 50000.0, 150000.0, 0, 0, true, true);
    Assert.assertEquals(1, tiles.size());
    Assert.assertEquals(1, tiles.get(0).size());
    Tile t = tiles.get(0).get(0);
    // with truncation, the tile is a fraction of the width and length specification
    Assert.assertEquals(3.0 / 16.0 * 150000.0, Vector3D.distance(ellipsoid.transform(t.getVertices()[0]), ellipsoid.transform(t.getVertices()[1])), 10.0);
    Assert.assertEquals(4.0 / 16.0 * 50000.0, Vector3D.distance(ellipsoid.transform(t.getVertices()[1]), ellipsoid.transform(t.getVertices()[2])), 0.01);
    Assert.assertEquals(3.0 / 16.0 * 150000.0, Vector3D.distance(ellipsoid.transform(t.getVertices()[2]), ellipsoid.transform(t.getVertices()[3])), 10.0);
    Assert.assertEquals(4.0 / 16.0 * 50000.0, Vector3D.distance(ellipsoid.transform(t.getVertices()[3]), ellipsoid.transform(t.getVertices()[0])), 0.01);
}
Also used : List(java.util.List) SphericalPolygonsSet(org.hipparchus.geometry.spherical.twod.SphericalPolygonsSet) Test(org.junit.Test)

Example 18 with SphericalPolygonsSet

use of org.hipparchus.geometry.spherical.twod.SphericalPolygonsSet in project Orekit by CS-SI.

the class EllipsoidTessellatorTest method testTilesSmallZoneWithoutTruncation.

@Test
public void testTilesSmallZoneWithoutTruncation() throws OrekitException, IOException {
    TileAiming aiming = new ConstantAzimuthAiming(ellipsoid, FastMath.toRadians(193.7));
    EllipsoidTessellator tessellator = new EllipsoidTessellator(ellipsoid, aiming, 16);
    SphericalPolygonsSet small = buildSimpleZone(1.0e-10, new double[][] { { 43.6543, 1.4268 }, { 43.6120, 1.4179 }, { 43.6016, 1.3994 }, { 43.5682, 1.4159 }, { 43.5707, 1.4358 }, { 43.5573, 1.4941 }, { 43.6041, 1.4866 } });
    final List<List<Tile>> tiles = tessellator.tessellate(small, 50000.0, 150000.0, 0, 0, false, false);
    Assert.assertEquals(1, tiles.size());
    Assert.assertEquals(1, tiles.get(0).size());
    Tile t = tiles.get(0).get(0);
    // without truncation, the tile must match width and length specification
    // (the remaining error is due to Cartesian distance and non-developable ellipsoid)
    Assert.assertEquals(150000.0, Vector3D.distance(ellipsoid.transform(t.getVertices()[0]), ellipsoid.transform(t.getVertices()[1])), 140.0);
    Assert.assertEquals(50000.0, Vector3D.distance(ellipsoid.transform(t.getVertices()[1]), ellipsoid.transform(t.getVertices()[2])), 0.4);
    Assert.assertEquals(150000.0, Vector3D.distance(ellipsoid.transform(t.getVertices()[2]), ellipsoid.transform(t.getVertices()[3])), 140.0);
    Assert.assertEquals(50000.0, Vector3D.distance(ellipsoid.transform(t.getVertices()[3]), ellipsoid.transform(t.getVertices()[0])), 0.4);
}
Also used : List(java.util.List) SphericalPolygonsSet(org.hipparchus.geometry.spherical.twod.SphericalPolygonsSet) Test(org.junit.Test)

Example 19 with SphericalPolygonsSet

use of org.hipparchus.geometry.spherical.twod.SphericalPolygonsSet in project Orekit by CS-SI.

the class EllipsoidTessellatorTest method buildFrance.

private SphericalPolygonsSet buildFrance() {
    final SphericalPolygonsSet continental = buildSimpleZone(1.0e-10, new double[][] { { 51.14850, 2.51357 }, { 50.94660, 1.63900 }, { 50.12717, 1.33876 }, { 49.34737, -0.98946 }, { 49.77634, -1.93349 }, { 48.64442, -1.61651 }, { 48.90169, -3.29581 }, { 48.68416, -4.59234 }, { 47.95495, -4.49155 }, { 47.57032, -2.96327 }, { 46.01491, -1.19379 }, { 44.02261, -1.38422 }, { 43.42280, -1.90135 }, { 43.03401, -1.50277 }, { 42.34338, 1.82679 }, { 42.47301, 2.98599 }, { 43.07520, 3.10041 }, { 43.39965, 4.55696 }, { 43.12889, 6.52924 }, { 43.69384, 7.43518 }, { 44.12790, 7.54959 }, { 45.02851, 6.74995 }, { 45.33309, 7.09665 }, { 46.42967, 6.50009 }, { 46.27298, 6.02260 }, { 46.72577, 6.03738 }, { 47.62058, 7.46675 }, { 49.01778, 8.09927 }, { 49.20195, 6.65822 }, { 49.44266, 5.89775 }, { 49.98537, 4.79922 } });
    final SphericalPolygonsSet corsica = EllipsoidTessellator.buildSimpleZone(1.0e-10, new GeodeticPoint(FastMath.toRadians(42.15249), FastMath.toRadians(9.56001), 0.0), new GeodeticPoint(FastMath.toRadians(43.00998), FastMath.toRadians(9.39000), 0.0), new GeodeticPoint(FastMath.toRadians(42.62812), FastMath.toRadians(8.74600), 0.0), new GeodeticPoint(FastMath.toRadians(42.25651), FastMath.toRadians(8.54421), 0.0), new GeodeticPoint(FastMath.toRadians(41.58361), FastMath.toRadians(8.77572), 0.0), new GeodeticPoint(FastMath.toRadians(41.38000), FastMath.toRadians(9.22975), 0.0));
    return (SphericalPolygonsSet) new RegionFactory<Sphere2D>().union(continental, corsica);
}
Also used : RegionFactory(org.hipparchus.geometry.partitioning.RegionFactory) SphericalPolygonsSet(org.hipparchus.geometry.spherical.twod.SphericalPolygonsSet) GeodeticPoint(org.orekit.bodies.GeodeticPoint)

Example 20 with SphericalPolygonsSet

use of org.hipparchus.geometry.spherical.twod.SphericalPolygonsSet in project Orekit by CS-SI.

the class DOPComputation method computeSPS.

/**
 * Computes a spherical polygons set from a geographic zone.
 *
 * @param zone the geographic zone
 * @return the spherical polygons set
 */
private static SphericalPolygonsSet computeSPS(final List<GeodeticPoint> zone) {
    // Convert the area into a SphericalPolygonsSet
    final S2Point[] vertices = new S2Point[zone.size()];
    int i = 0;
    for (GeodeticPoint point : zone) {
        final double theta = point.getLongitude();
        final double phi = 0.5 * FastMath.PI - point.getLatitude();
        vertices[i++] = new S2Point(theta, phi);
    }
    return new SphericalPolygonsSet(1.0e-10, vertices);
}
Also used : S2Point(org.hipparchus.geometry.spherical.twod.S2Point) SphericalPolygonsSet(org.hipparchus.geometry.spherical.twod.SphericalPolygonsSet) GeodeticPoint(org.orekit.bodies.GeodeticPoint) S2Point(org.hipparchus.geometry.spherical.twod.S2Point) GeodeticPoint(org.orekit.bodies.GeodeticPoint)

Aggregations

SphericalPolygonsSet (org.hipparchus.geometry.spherical.twod.SphericalPolygonsSet)20 List (java.util.List)7 S2Point (org.hipparchus.geometry.spherical.twod.S2Point)7 Test (org.junit.Test)7 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)6 RegionFactory (org.hipparchus.geometry.partitioning.RegionFactory)5 Sphere2D (org.hipparchus.geometry.spherical.twod.Sphere2D)5 GeodeticPoint (org.orekit.bodies.GeodeticPoint)5 ArrayList (java.util.ArrayList)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 ObjectInputStream (java.io.ObjectInputStream)2 ObjectOutputStream (java.io.ObjectOutputStream)2 IdentityHashMap (java.util.IdentityHashMap)2 LinkedList (java.util.LinkedList)2 Map (java.util.Map)2 Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)1 BSPTree (org.hipparchus.geometry.partitioning.BSPTree)1 Circle (org.hipparchus.geometry.spherical.twod.Circle)1 Edge (org.hipparchus.geometry.spherical.twod.Edge)1