![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Apr 2006
Posts: 5
Rep Power: 0
![]() |
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 |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,223
Rep Power: 5
![]() |
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. |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Apr 2006
Posts: 5
Rep Power: 0
![]() |
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)
|
|
|
|
|
|
#4 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,223
Rep Power: 5
![]() |
Then assume that the earth is a sphere with radius 6378137 metres and compute the great circle distance between the points.
|
|
|
|
|
|
#5 | |
|
Newbie
Join Date: Apr 2006
Posts: 5
Rep Power: 0
![]() |
to quote myself:
Quote:
Please, I would really appreciate some help with the algorithm :o |
|
|
|
|
|
|
#6 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,223
Rep Power: 5
![]() |
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. |
|
|
|
|
|
#7 |
|
Newbie
Join Date: Apr 2006
Posts: 5
Rep Power: 0
![]() |
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! |
|
|
|
|
|
#8 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,223
Rep Power: 5
![]() |
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.
|
|
|
|
|
|
#9 |
|
Newbie
Join Date: Apr 2006
Posts: 5
Rep Power: 0
![]() |
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" |
|
|
|
|
|
#10 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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 |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|