-----Original Message----- From: openguides-dev-bounces@openguides.org [mailto:openguides-dev-bounces@openguides.org]On Behalf Of David Cantrell Sent: 29 June 2004 01:16 To: OpenGuides software developers Subject: Re: [OpenGuides-Dev] locator plugins
IvorW wrote:
An ellipsoidal projection about one great circle will only
provide an accurate projection
regarding distances, for a very small percentage of
locations on Earth.
I know we've talked about simply calculating distances from point A to point B on the surface of a sphere in the past, and rejected it because you lose accuracy over small distances, due to rounding errors in cos() and sin().
I wonder, if we used an arbitrary precision FP library like Math::BigFloat does this problem go away? It doesn't provide trig functions, but they can be derived thus:
cos(x) = 1 - x^2/2! + x^4/4! - x^6/6! + ... (x in radians)
and
sin(x) = x - x^3/3! + x^5/5! - x^7/7! + ...
This is guaranteed to give us accurate results provided we use sufficiently accurate values for sin(x) and cos(x), I wonder what the performance hit would be.
More to the point is the accuracy of the other factor - the radius of the Earth. If you assume that this is a constant, you are assuming that the Earth is a sphere. Also, how would you go about measuring the distance from a given point on the Earth's crust to the centre of the earth?
An alternative approach woud be to use a linear approximation (slides 24-26) http://un.earth.li/~ivorw/slides/geogmod.ppt
Having defined an origin for our guide (e.g. Charing+, Carfax, etc.) We could go out there with a GPS and a trundle wheel (or some other means of measuring distances in a straight line accurately), and come up with the appropriate X and Y scale factors for our own grid. This was my original idea, before I learned about UTM and ellipsoids.
Ivor.
openguides-dev@lists.openguides.org