Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 25th, 2006, 1:04 AM   #1
fisherking
Newbie
 
Join Date: Apr 2006
Posts: 5
Rep Power: 0 fisherking is on a distinguished road
GPS Simulator alogorithm

Hi,

I am supposed to implement a GPS simulator but I not really a mathematician.
The simulator needs to calculate every position with the distance of (preferably) ONE meters between two given gps coordinates!

If the algorithm could include speed (kilometers per hour) that would be great, but not a critical requirement.

thanx
fisherking is offline   Reply With Quote
Old Apr 25th, 2006, 1:32 AM   #2
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,223
Rep Power: 5 grumpy is on a distinguished road
It's not that easy. The method of calculation of distance between two points on the earth depends on reference frame, and the model used to represent the shape of the earth (eg is it a flattened football, is a more detailed representation based on measured altitude of locations used, etc etc). Basically, the more accuracy you want, the more factors you need to take into account in your calculations.

If you do a google search for "geodetic datum" you will find more information on these things. A geodetic datum is a reference system that describes the size and shape of the earth. The real catch is that different countries use different geodetic datums (eg one that accurately represents the US is less accurate in central Australia) and that making a wrong choice of geodetic datum can result in errors (eg in the distance between two points) of the order of hundreds of metres. Last time I looked at such things, there were about 20 different geodetic datums in common usage, and a lot more in less common usage.
grumpy is offline   Reply With Quote
Old Apr 25th, 2006, 1:45 AM   #3
fisherking
Newbie
 
Join Date: Apr 2006
Posts: 5
Rep Power: 0 fisherking is on a distinguished road
I dont know if it makes any difference, but it dosn't matter if the distance between the points isn't correct (as in comparance to the real world distance)
fisherking is offline   Reply With Quote
Old Apr 25th, 2006, 2:55 AM   #4
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,223
Rep Power: 5 grumpy is on a distinguished road
Then assume that the earth is a sphere with radius 6378137 metres and compute the great circle distance between the points.
grumpy is offline   Reply With Quote
Old Apr 25th, 2006, 5:32 AM   #5
fisherking
Newbie
 
Join Date: Apr 2006
Posts: 5
Rep Power: 0 fisherking is on a distinguished road
to quote myself:

Quote:
I not really a mathematician.

Please, I would really appreciate some help with the algorithm :o
fisherking is offline   Reply With Quote
Old Apr 25th, 2006, 5:57 AM   #6
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,223
Rep Power: 5 grumpy is on a distinguished road
This link gives some formulae.

The first three formulae are all alternatives for computing angular separation between two points (different trade-offs on when the formulae are accurate when using a computer are described). Whichever method you use, multiply the result by the radius.

Keep in mind that all angles are measured in radians (just like the math functions in C and C++). To convert from degrees to radians, multiply by pi and divide by 180.0. One way of computing pi is as atan2(0.0, -1.0)

I realise you said you're not a mathematician, but you really need to develop the skills to turn basic mathematical equations into working numerical code, so I'll leave that as an exercise.
grumpy is offline   Reply With Quote
Old Apr 27th, 2006, 3:58 AM   #7
fisherking
Newbie
 
Join Date: Apr 2006
Posts: 5
Rep Power: 0 fisherking is on a distinguished road
Well... I have the distance between the points. It is a point between those two points I need, say:
you have startpoint A and stoppoint B. The distance between these are 500 meters.
I need the coordinates for a point 200 m from A heading for B

(this new coordinate does not need to be exaclty correct. The algorithm does not have to calculate on that the earth is a sphare. In this calculatation the earth can be flat!)

thanks!
fisherking is offline   Reply With Quote
Old Apr 27th, 2006, 7:35 AM   #8
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,223
Rep Power: 5 grumpy is on a distinguished road
I suggest you need to do a bit of thinking for yourself. What you're trying to do is pretty elementary and it won't be hard to find information or (with a bit more work) derive a solution.
grumpy is offline   Reply With Quote
Old Apr 27th, 2006, 8:24 AM   #9
fisherking
Newbie
 
Join Date: Apr 2006
Posts: 5
Rep Power: 0 fisherking is on a distinguished road
If this is so easy, would you *please* help me!
I dont even know what to google for! tried : gps coordinates calculate waypoints
and stuff like that, but there is very few resources for programmers and those who are seems to be focusing on distance calculations!

I realize that I have to learn to calculate on trigonometry and gps and things related, but please, I dont have the time right now!
I wouldn't ask for help if it was just to "do a bit thinking"
fisherking is offline   Reply With Quote
Old Apr 27th, 2006, 10:09 AM   #10
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
We really need a raised-eyebrow emoticon. How'd you get in the time crunch?
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

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

Posting Rules
You may not post new threads
You may not 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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:22 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC