Once again, thank you so much. I'm not just learning about the algorithm itself, but it's now 'clicked' where-as before, I was on wikipedia, and even did some pencil and paper trig and wasn't getting that far. You can probably tell i like to know exactly how things work.. and why.
So, on the agenda is:
-generate a lookup table to adjust the latitude distance per minute, based on lattitude - a small variation, but would only require maybe 80-90 entries. And will only have to store the offset from equatorial latitude.
-Look at how compliers do cos(x) its input format, and output format (radians, degrees, and if the output is a float, or can be a fixed point number).
-Attempt to simplify things down to only require multiplications.
- Create a test unit, set a zone and radius, and wander around grabbing absolute points when entering/leaving the zone to check relative accuracy, and also points every few seconds for reference. The accuracy of these points is purely down to the GPS, as I'll store the raw long/lat, rather than anything calculated - as well as points every few seconds. This way I'll have a rather large flash chip with a set of GPS points, some tagged with 'entered zone', some 'left zone' and ones based on a timer. Plotting those on a map, with the zone ones in red.. should see how good it is.
I'll have some 'fun' with excel to set this up. And the 'distance per long lat' figures, because they are rather small (1852, 1855.325) I'll calculate (or look up) these to two decimal places, so they'll fit into a 16-bit number, ergo treating 1855.325 as 185533 (metres x 100). Then multiply this by the long/lat differences (which will inevitably be millionths of a minute), and scale this down to 16-bit, as this then has to be squared. This keeps some accuracy of (that 0.325 can add up for larger differences) but should allow it to fit inside a long when squared. Apologies it that sounds confusing, the multiplying by 100, and multiplying minutes by a 1000000 will have to be scaled back down, its just an attempt to deal exclusively with integers for most of the calculations - I realise this probably won't work though.