コード例 #1
0
 @Test
 public void testKnownAzimuthE() {
   LatLon begin = LatLon.fromDegrees(-12.0, 87.0);
   LatLon end = LatLon.fromDegrees(53.0902505, -67.1064558);
   double azimuth = LatLon.greatCircleAzimuth(begin, end).degrees;
   assertEquals("Known Azimuth E", -21.38356223882703, azimuth, THRESHOLD);
 }
コード例 #2
0
 @Test
 public void testTrivialEquivalentPointsB() {
   LatLon begin = LatLon.fromDegrees(0.0, -180.0);
   LatLon end = LatLon.fromDegrees(0.0, 180.0);
   double distance = LatLon.greatCircleDistance(begin, end).degrees;
   assertEquals("Trivial equivalent points B", 0.0, distance, THRESHOLD);
 }
コード例 #3
0
 @Test
 public void testKnownAzimuthC() {
   LatLon begin = LatLon.fromDegrees(-12.0, 87.0);
   LatLon end = LatLon.fromDegrees(-12.0000001, 86.9999999);
   double azimuth = LatLon.greatCircleAzimuth(begin, end).degrees;
   assertEquals("Known Azimuth C", -135.6329170237546, azimuth, THRESHOLD);
 }
コード例 #4
0
 @Test
 public void testKnownAzimuthD() {
   LatLon begin = LatLon.fromDegrees(-12.0, 87.0);
   LatLon end = LatLon.fromDegrees(11.9999999, -93.0000001);
   double azimuth = LatLon.greatCircleAzimuth(begin, end).degrees;
   assertEquals("Known Azimuth D", 135.6329170162944, azimuth, THRESHOLD);
 }
コード例 #5
0
 @Test
 public void testKnownAzimuthB() {
   LatLon begin = LatLon.fromDegrees(53.0902505, 112.8935442);
   LatLon end = LatLon.fromDegrees(-53.0902505, -67.1064558);
   double azimuth = LatLon.greatCircleAzimuth(begin, end).degrees;
   assertEquals("Known Azimuth B", -90.0, azimuth, THRESHOLD);
 }
コード例 #6
0
 @Test
 public void testTrivialSouth() {
   LatLon begin = LatLon.fromDegrees(0.0, 0.0);
   LatLon end = LatLon.fromDegrees(-90.0, 0.0);
   double azimuth = LatLon.greatCircleAzimuth(begin, end).degrees;
   assertEquals("Trivial South greatCircleAzimuth", 180.0, azimuth, THRESHOLD);
 }
コード例 #7
0
 @Test
 public void testProblemPointsA() {
   LatLon begin = LatLon.fromDegrees(36.0, -118.0);
   LatLon end = LatLon.fromDegrees(36.0, -117.0);
   double distance = LatLon.greatCircleDistance(begin, end).degrees;
   assertEquals("Problem points A", 0.8090134466773318, distance, THRESHOLD);
 }
コード例 #8
0
 @Test
 public void testTrivialEquivalentPointsC() {
   LatLon begin = LatLon.fromDegrees(0.0, 0.0);
   LatLon end = LatLon.fromDegrees(0.0, 360.0);
   double distance = LatLon.rhumbDistance(begin, end).degrees;
   assertEquals("Trivial equivalent points C", 0.0, distance, THRESHOLD);
 }
コード例 #9
0
 @Test
 public void testTrivialEquivalentPointsC() {
   LatLon begin = LatLon.fromDegrees(90.0, 0.0);
   LatLon end = LatLon.fromDegrees(90.0, 0.0);
   double azimuth = LatLon.rhumbAzimuth(begin, end).degrees;
   assertEquals("Trivial equivalent points C", 0.0, azimuth, THRESHOLD);
 }
コード例 #10
0
ファイル: Shapes.java プロジェクト: syzh1991/DigitalEarth
    private Info[] buildSurfaceShapes() {
      LatLon position = new LatLon(Angle.fromDegrees(38), Angle.fromDegrees(-105));

      ArrayList<LatLon> surfaceLinePositions = new ArrayList<LatLon>();
      //            surfaceLinePositions.add(LatLon.fromDegrees(37.8484, -119.9754));
      //            surfaceLinePositions.add(LatLon.fromDegrees(38.3540, -119.1526));

      //            surfaceLinePositions.add(new LatLon(Angle.fromDegrees(0),
      // Angle.fromDegrees(-150)));
      //            surfaceLinePositions.add(new LatLon(Angle.fromDegrees(60),
      // Angle.fromDegrees(0)));

      surfaceLinePositions.add(position);
      surfaceLinePositions.add(LatLon.fromDegrees(39, -104));
      surfaceLinePositions.add(LatLon.fromDegrees(39, -105));
      surfaceLinePositions.add(position);

      return new Info[] {
        new Info("Circle", new SurfaceCircle(position, 100e3)),
        new Info("Ellipse", new SurfaceEllipse(position, 100e3, 90e3, Angle.ZERO)),
        new Info("Square", new SurfaceSquare(position, 100e3)),
        new Info("Quad", new SurfaceQuad(position, 100e3, 60e3, Angle.ZERO)),
        new Info("Sector", new SurfaceSector(Sector.fromDegrees(38, 40, -105, -103))),
        new Info("Polygon", new SurfacePolygon(surfaceLinePositions)),
      };
    }
コード例 #11
0
 @Test
 public void testKnownAzimuthA() {
   LatLon begin = LatLon.fromDegrees(-90.0, -180.0);
   LatLon end = LatLon.fromDegrees(90.0, 180.0);
   double azimuth = LatLon.rhumbAzimuth(begin, end).degrees;
   assertEquals("Known Azimuth A", 0.0, azimuth, THRESHOLD);
 }
コード例 #12
0
 @Test
 public void testKnownAzimuthB() {
   LatLon begin = LatLon.fromDegrees(53.0902505, 112.8935442);
   LatLon end = LatLon.fromDegrees(-53.0902505, -67.1064558);
   double azimuth = LatLon.rhumbAzimuth(begin, end).degrees;
   assertEquals("Known Azimuth B", -124.94048502315054, azimuth, THRESHOLD);
 }
コード例 #13
0
 @Test
 public void testKnownDistanceCloseTo180() {
   LatLon begin = LatLon.fromDegrees(-12.0, 87.0);
   LatLon end = LatLon.fromDegrees(11.9999999, -93.0000001);
   double distance = LatLon.greatCircleDistance(begin, end).degrees;
   assertEquals("Known spherical distance (close to 180)", 180.0, distance, THRESHOLD);
 }
コード例 #14
0
 @Test
 public void testEquivalentPoints() {
   LatLon begin = LatLon.fromDegrees(53.0902505, 112.8935442);
   LatLon end = LatLon.fromDegrees(53.0902505, 112.8935442);
   double azimuth = LatLon.rhumbAzimuth(begin, end).degrees;
   assertEquals("Equivalent points", 0.0, azimuth, THRESHOLD);
 }
コード例 #15
0
 @Test
 public void testTrivialWest() {
   LatLon begin = LatLon.fromDegrees(0.0, 0.0);
   LatLon end = LatLon.fromDegrees(0.0, -90.0);
   double azimuth = LatLon.rhumbAzimuth(begin, end).degrees;
   assertEquals("Trivial West rhumbAzimuth", -90.0, azimuth, THRESHOLD);
 }
コード例 #16
0
 @Test
 public void testEquivalentPoints() {
   LatLon begin = LatLon.fromDegrees(53.0902505, 112.8935442);
   LatLon end = LatLon.fromDegrees(53.0902505, 112.8935442);
   double distance = LatLon.greatCircleDistance(begin, end).degrees;
   assertEquals("Equivalent points", 0.0, distance, THRESHOLD);
 }
コード例 #17
0
 @Test
 public void testProblemPointsA() {
   LatLon begin = LatLon.fromDegrees(36.0, -118.0);
   LatLon end = LatLon.fromDegrees(36.0, -117.0);
   double distance = LatLon.rhumbDistance(begin, end).degrees;
   assertEquals("Problem points A", 0.8090169943749475, distance, THRESHOLD);
 }
コード例 #18
0
 @Test
 public void testKnownAzimuthC() {
   LatLon begin = LatLon.fromDegrees(-12.0, 87.0);
   LatLon end = LatLon.fromDegrees(-12.0000001, 86.9999999);
   double azimuth = LatLon.rhumbAzimuth(begin, end).degrees;
   assertEquals("Known Azimuth C", -135.63291443992495, azimuth, THRESHOLD);
 }
コード例 #19
0
 @Test
 public void testKnownAzimuthD() {
   LatLon begin = LatLon.fromDegrees(-12.0, 87.0);
   LatLon end = LatLon.fromDegrees(11.9999999, -93.0000001);
   double azimuth = LatLon.rhumbAzimuth(begin, end).degrees;
   assertEquals("Known Azimuth D", 82.34987931207793, azimuth, THRESHOLD);
 }
コード例 #20
0
 @Test
 public void testKnownDistance() {
   LatLon begin = LatLon.fromDegrees(90.0, 45.0);
   LatLon end = LatLon.fromDegrees(36.0, 180.0);
   double distance = LatLon.greatCircleDistance(begin, end).degrees;
   assertEquals("Known spherical distance", 54.0, distance, THRESHOLD);
 }
コード例 #21
0
 @Test
 public void testAntipodalPointsA() {
   LatLon begin = LatLon.fromDegrees(53.0902505, 112.8935442);
   LatLon end = LatLon.fromDegrees(-53.0902505, -67.1064558);
   double distance = LatLon.greatCircleDistance(begin, end).degrees;
   assertEquals("Antipodal points A", 180.0, distance, THRESHOLD);
 }
コード例 #22
0
 @Test
 public void testAntipodalPointsB() {
   LatLon begin = LatLon.fromDegrees(-12.0, 87.0);
   LatLon end = LatLon.fromDegrees(12.0, -93.0);
   double distance = LatLon.greatCircleDistance(begin, end).degrees;
   assertEquals("Antipodal points B", 180.0, distance, THRESHOLD);
 }
コード例 #23
0
 @Test
 public void testTrivialAntipodalPointsC() {
   LatLon begin = LatLon.fromDegrees(-90.0, -180.0);
   LatLon end = LatLon.fromDegrees(90.0, 180.0);
   double distance = LatLon.greatCircleDistance(begin, end).degrees;
   assertEquals("Trivial antipodal points C", 180.0, distance, THRESHOLD);
 }
コード例 #24
0
 @Test
 public void testKnownAzimuthE() {
   LatLon begin = LatLon.fromDegrees(-12.0, 87.0);
   LatLon end = LatLon.fromDegrees(53.0902505, -67.1064558);
   double azimuth = LatLon.rhumbAzimuth(begin, end).degrees;
   assertEquals("Known Azimuth E", -64.05846977747626, azimuth, THRESHOLD);
 }
コード例 #25
0
 @Test
 public void testKnownDistance() {
   LatLon begin = LatLon.fromDegrees(90.0, 45.0);
   LatLon end = LatLon.fromDegrees(36.0, 180.0);
   double distance = LatLon.rhumbDistance(begin, end).degrees;
   assertEquals(
       "Known spherical distance", 54.11143196539475, distance, 1e-5); // Custom threshold
 }
コード例 #26
0
 @Test
 public void testKnownDistanceCloseToZero() {
   LatLon begin = LatLon.fromDegrees(-12.0, 87.0);
   LatLon end = LatLon.fromDegrees(-12.0000001, 86.9999999);
   double distance = LatLon.rhumbDistance(begin, end).degrees;
   assertEquals(
       "Known spherical distance (close to zero)", 1.398846933590201e-7, distance, THRESHOLD);
 }
コード例 #27
0
 @Test
 public void testKnownAzimuthC() {
   LatLon begin = LatLon.fromDegrees(-32.0000, 116.0000);
   LatLon end = LatLon.fromDegrees(23.0000, 122.0000);
   Angle theta =
       LatLon.ellipsoidalForwardAzimuth(
           begin, end, globe.getEquatorialRadius(), globe.getPolarRadius());
   assertEquals("Known ellipsoidal Azimuth C", 6.75777, theta.degrees, TOLERANCE);
 }
コード例 #28
0
 @Test
 public void testKnownAzimuthA() {
   LatLon begin = LatLon.fromDegrees(30.000000, -102.000000);
   LatLon end = LatLon.fromDegrees(34.000000, -97.000000);
   Angle theta =
       LatLon.ellipsoidalForwardAzimuth(
           begin, end, globe.getEquatorialRadius(), globe.getPolarRadius());
   assertEquals("Known ellipsoidal Azimuth A", 45.50583, theta.degrees, TOLERANCE);
 }
コード例 #29
0
 @Test
 public void testKnownDistanceD() {
   LatLon begin = LatLon.fromDegrees(51.4898, 0.0539);
   LatLon end = LatLon.fromDegrees(42.3232, -71.0974);
   double distance =
       LatLon.ellipsoidalDistance(
           begin, end, globe.getEquatorialRadius(), globe.getPolarRadius());
   assertEquals("Known ellipsoidal distance D", 5296396.967, distance, TOLERANCE);
 }
コード例 #30
0
 @Test
 public void testKnownDistanceC() {
   LatLon begin = LatLon.fromDegrees(-31.9236, 116.1231);
   LatLon end = LatLon.fromDegrees(23.6937, 121.9831);
   double distance =
       LatLon.ellipsoidalDistance(
           begin, end, globe.getEquatorialRadius(), globe.getPolarRadius());
   assertEquals("Known ellipsoidal distance C", 6186281.864, distance, TOLERANCE);
 }