GreatCircleDistance { public static final double vincentyFormula(LatLonPoint point1, LatLonPoint point2) { double lat1 = point1.getLat(); double lon1 = point1.getLon(); double lat2 = point2.getLat(); double lon2 = point2.getLon(); return vincentyFormula(lat1, lon1, lat2, lon2); }  static final double vincentyFormula(LatLonPoint point1, LatLonPoint point2); static final double vincentyFormula(Point point1, Point point2); static final double vincentyFormula(Coordinate coord1, Coordinate coord2); static final double vincentyFormula(double lat1, double lon1, double lat2, double lon2); static final double haversineFormula(LatLonPoint point1, LatLonPoint point2); static final double haversineFormula(Point point1, Point point2); static final double haversineFormula(Coordinate coord1, Coordinate coord2); static final double haversineFormula(double lat1, double lon1, double lat2, double lon2);  }
@Test public void testVincentyFormula_London_Paris() { double lat1 = 51.50853; double lon1 = -0.12574; double lat2 = 48.85341; double lon2 = 2.34880; double expResult = 343771; double result = GreatCircleDistance.vincentyFormula(lat1, lon1, lat2, lon2); assertEquals(expResult, result, 1); }
@Test public void testVincentyFormula_Paris_London() { double lat1 = 48.85341; double lon1 = 2.34880; double lat2 = 51.50853; double lon2 = -0.12574; double expResult = 343771; double result = GreatCircleDistance.vincentyFormula(lat1, lon1, lat2, lon2); assertEquals(expResult, result, 1); }
@Test public void testVincentyFormula_Distance1() { double lat1 = 41.2572; double lon1 = -95.9656; double lat2 = 41.2592; double lon2 = -95.9339; double expResult = 2.8736; double result = GreatCircleDistance.vincentyFormula(lat1, lon1, lat2, lon2) / 1000; assertEquals(expResult, result, 0.3); }
@Test public void testVincentyFormula_Distance2() { double lat1 = 41.2572; double lon1 = -95.9656; double lat2 = 41.2482; double lon2 = -96.072; double expResult = 9.1893; double result = GreatCircleDistance.vincentyFormula(lat1, lon1, lat2, lon2) / 1000; assertEquals(expResult, result, 0.3); }
@Test public void testVincentyFormula_Distance3() { double lat1 = 41.2572; double lon1 = -95.9656; double lat2 = 41.5871; double lon2 = -93.626; double expResult = 198.3806; double result = GreatCircleDistance.vincentyFormula(lat1, lon1, lat2, lon2) / 1000; assertEquals(expResult, result, 0.3); }
@Test public void testVincentyFormula_Distance4() { double lat1 = 41.2572; double lon1 = -95.9656; double lat2 = 51.0472; double lon2 = -113.9998; double expResult = 1757.1519; double result = GreatCircleDistance.vincentyFormula(lat1, lon1, lat2, lon2) / 1000; assertEquals(expResult, result, 0.3); }
@Test public void testVincentyFormula_Distance5() { double lat1 = 41.2572; double lon1 = -95.9656; double lat2 = 40.7528; double lon2 = -73.9876; double expResult = 1840.1915; double result = GreatCircleDistance.vincentyFormula(lat1, lon1, lat2, lon2) / 1000; assertEquals(expResult, result, 0.3); }
@Test public void testVincentyFormula_Distance6() { double lat1 = 41.2572; double lon1 = -95.9656; double lat2 = 49.7237; double lon2 = 13.3422; double expResult = 7781.1365; double result = GreatCircleDistance.vincentyFormula(lat1, lon1, lat2, lon2) / 1000; assertEquals(expResult, result, 0.3); }
@Ignore @Test public void testVincentyFormula_Distance7() { double lat1 = 41.2572; double lon1 = -95.9656; double lat2 = -33.9065; double lon2 = 18.4175; double expResult = 14312.6630; double result = GreatCircleDistance.vincentyFormula(lat1, lon1, lat2, lon2) / 1000; assertEquals(expResult, result, 0.3); }
@Ignore @Test public void testVincentyFormula_Distance8() { double lat1 = 41.2572; double lon1 = -95.9656; double lat2 = -33.8646; double lon2 = 151.2099; double expResult = 14184.1430; double result = GreatCircleDistance.vincentyFormula(lat1, lon1, lat2, lon2) / 1000; assertEquals(expResult, result, 0.3); }