World Wind Forums

Go Back   World Wind Forums > WorldWind JAVA forums > Development Help

Development Help Help for building applications or diagnosing problems with WWJ

Reply
 
Thread Tools Display Modes
Old 07-10-2008, 12:37 PM   #1
nlneilson
Super Moderator
 
Join Date: Nov 2006
Location: Mojave & Oxnard California
Posts: 2,617
nlneilson is on a distinguished road
Default Vincenty geodesic distance in WWJ

WWJ has a clipped version of the Vincenty Formula in:
worldwind/geom/LatLon.java #627
Code:
    public static double ellipsoidalDistance(LatLon p1, LatLon p2, double equatorialRadius, double polarRadius)
Here is how it can be implemented.
Code:
//=======================  Vincenty
		    LatLon p1;
		    LatLon p2;
		    double eqR = 6378137.0;     // equatorialRadius  for Earth WGS84
		    double poR = 6356752.3142;  // polarRadius
		    
//		    p1 = LatLon.fromDegrees(loc[0], loc[1]);
//		    p2 = LatLon.fromDegrees(34.2124, -119.1935);

		    p1 = LatLon.fromDegrees(33.94, -118.40); // LAX
		    p2 = LatLon.fromDegrees(41.98, -87.90);  // O'Hare, Chicago

		    double geoDist = LatLon.ellipsoidalDistance(p1, p2, eqR, poR);
		    System.out.println(String.format("%.6fm geodesic distance", geoDist));
2807507.159913m geodesic distance

OK to 4 decimal places in WWJ (.1mm LAX to O'Hare in Chicago)

Just to compare it with the full Vincenty Formula:

Vincenty Inverse Input
Lat1 33.940000 Lon1 -118.400000
Lat2 41.980000 Lon2 -87.900000
Output
s = 2807507.159896060000
aIn = 62.464405076619 aFn = 81.551461342173

Vincenty Direct Input
Lat1 33.940000 Lon1 -118.400000
s = 2807507.159896060000 aIn = 62.464405076619
Output
Lat2 41.979999999984 Lon2 -87.900000000145
aFn = 81.551461342076

OK to 9 decimal paces

Last edited by nlneilson; 07-10-2008 at 12:48 PM.
nlneilson is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
WWJ and Platform-dependence smcnaughton Development Help 31 11-11-2009 01:09 PM
WWJ vs WorldWind.net coloradokid WorldWind General 10 10-09-2008 06:24 AM
SurfaceShapes are not translucent in WWJ 0.5 vash Development Help 0 05-07-2008 02:05 PM
WWJ SDK Alpha 3 - 0.3.0 available patmurris WWJ Release Announcements 35 12-03-2007 08:56 PM
Tilt View: Add Distance movement in the Interface canosso Suggestion Box 0 08-23-2005 04:04 PM


All times are GMT +1. The time now is 01:40 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.