James Turner writes:
> 
> On Friday, February 7, 2003, at 03:57  am, Norman Vine wrote:
> 
> > John A. Gallas
> >>
> >> I was just wondering if the subroutine
> >> SGRoute.distance_off_route() calculates accurate
> >> results (or even reasonably usable results for
> >> navigation in fgfs) for waypoints on a wgs84 system.
> >> I've run some tests and it seems okay, but I'm no
> >> expert - can someone verify this?
> >
> > This is a *much* better approximation
> > http://williams.best.vwh.net/avform.htm#XTE
> 
> Just to add, in my local tree I've got an FGRouteBase which (I hope) 
> supersedes the SGRoute stuff totally. I spent ages trying to come up 
> with a better 'distance off route' calculation (trigonometry not being 
> my strong point), clearly I should just have asked here.

Note that I said 'better approximation' in that the above is a spherical
solution not an ellipsoidal one

One way to get an ellipsoidal solution is to find the rotation that 
transforms the track segment you are checking into a meridian 
< line of longitude >, then after applying said transform to the
point in question the solution can be found using the geodetic
inverse function from SimGear and the original point and the
found point rotated by the inverse of the transform

Note the needed rotations only need to be computed when the track
segment changes.

Easiest to visualize why this works when you are looing at a ball :-)

Another perhaps easier way to improve the spherical approximation
is to use the mean latitude of the test point and the point of intersection
of the perpendicular from that point to the track segment to determine 
a relative flattening factor of the sphere or an 'effective earth radius'

Note if the distance is 'small', as should be the case when computing
cross track error, the latitude of the test point can be substituted for 
the mean with no 'harm'

Note sgGeodToGeoc() function returns the sea level radius 

spherical-geomentry-is-fun-as-is the-ellipsoidal-variety'ly yr's

Norman


_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to