forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Finding Distance (in miles) between two points

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 4 Source Code
View previous topic :: View next topic  
Author Message
nick
Contributor
Contributor


Joined: 15 Aug 2000
Posts: 50
Location: hamburg,nj

PostPosted: Sat Jan 11, 2003 4:05 am    Post subject: Finding Distance (in miles) between two points Reply with quote

Just a little bit of code that can be run from within a vds app to find the approx distance between two points assuming you know the latitude and longitude of each point.

Code:

REM %%lat1 & %%long1 is the latitude and longitude of point A and
rem %%lat2 & %%long2 is the latitude and longitude of point B.

%A = @fmul(@fsub(%%lat2,%%lat1),69.1)
%B = @fmul(@fsub(%%long2,%%long1),53)
%%miles = @fsqt(@fadd(@fmul(%A,%A),@fmul(%B,%B)))
%%miles = @format(%%miles,4.1)


This will give you a fairly good estimate of actual miles. Not good enough
for NASA but good enough for other applications. The alternative is using
the Great Circle Formula. It requires figuring arc cosines which is not available in vds.
I actually ran numbers with both formulas and only showed a .2 mile difference.

Nick
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 4 Source Code All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group