Measuring distance from point a to point b using GPS and Compass

Hey,
So I am building this car which can navigate to point a to point b(not just yet). First off, I would like to say that I am 13, started Arduino's like 1.5 years ago, and I do know a fair amount of programming knowledge on C++ and how GPS works on getting lat and log. I am currently doing HS Algebra in school, so I can understand fairly complex problems, but not like using the sin or the cos function. Now for the real problem, I am using a Neo6M GPS and a HMC5883L compass. I am successfully able to get the lat and long of my current location. I want to know how to get the distance between point a(starting point) to point b(target point), I know that triangulation is one of the ways to find the distance, but don't know how to use that in programming. I also want to know how to get the compass to tell the car which way to turn. I will, of course, input the target lat and long. Any help will be appreciated.
Thanks,
tib0n3

so I can understand fairly complex problems, but not like using the sin or the cos function.

Sorry but you don't do complex problems in High School algebra. You will need to use trigonometric functions so that is sin and cos as well as the inverse functions.

Thanks for the correction, sir.

The formulas and code for calculating bearing and distance between GPS coordinates are quite simple and can be found at Calculate distance and bearing between two Latitude/Longitude points using haversine formula in JavaScript.

However, those won't work well or at all on Arduino, because it does not support double precision (64 bit) floating point calculations required for accuracy.

Other people have worked out complicated ways of getting around this difficulty, so try using the neoGPS library.

Sir, thanks a lot for your post but I still am not able to understand how to integrate the code into my project. Could you also tell me how to use the NeoGPS library, since I am using TinyGPS library right now.

First, study the docs and the examples that come with neoGPS.

If you have specific questions, post them here. The author of that library is a frequent forum contributor.

Alternatively, there is the TinyGPSPlus library which includes a function named courseTo(lat1, long1, lat2, long2). Look in the examples for how it is used.

Dear gdsports,

Thanks alot for the info, I did not even know that there was a built in function for that! I will look into it and get back to you.

Thanks,
tib0n3

This website has also helped me a lot TinyGPS++ | Arduiniana