Re: Lat, Long, Alt conversion to X, Y, Z.

New Message Reply Date view Thread view Subject view Author view

Lee Willis (lee++at++multigen.com)
Tue, 22 Oct 1996 11:35:58 -0700


On Oct 22, 10:57am, Michael Campbell wrote:
> Subject: Lat, Long, Alt conversion to X, Y, Z.
> Hi,
> I plan on using Performer to drive the Out-The-Window display for
> our F/A-18 flight simulator. The simulator generates WGS-84 earth
> Latitude, Longitude, and Altitude positions plus Yaw, Pitch, Roll
> (Euler Angles).
>
> Question: How does one convert the Lat., Long., and Alt. to Performer
> World Coordinates X,Y, and Z ??? ie for positioning the aircraft in
> the Terrain DB.
>
> The Terrain DataBase loaded will be MultiGen flight format generated
> from DMA DTED.
>
> I'm just getting started, but any help that points me in the right
> direction would be appreciated.

How to convert depends on what projection you generated the database
in. The simplest (and fastest at runtime) conversion is using the MultiGen
FLAT EARTH projection. In this, along with you're lat,lon,alt, you need
the origin of the database, and the units of the database (you can get
these from the database attribute page in MultiGen)

   #define METERS_PER_DEGREE 111120.0
   #define RADIANS_PER_DEGREE ( PI / 180.0 )

   double convergance; /* scale to compensate for convergance at poles */
   double x_meters, y_meters;

   convergance = cos( origin_lat * RADIANS_PER_DEGREE );
   /* compute this value once and cache it - it doesn't change */

   /* x,y,z units are now in _meters_ */
   x = (lon - origin_lon) * convergance * METERS_PER_DEGREE;
   y = (lat - origin_lat) * METERS_PER_DEGREE
   z = alt;

  /* if you're units are not in meters, multiply by <units_per_meter> */

If you're not using the Flat Earth projection, the computation
is more complex. email me directly for help.

-- 
Lee Willis	MultiGen Inc. 550 S Winchester Blvd. Suite 500
		San Jose, CA 95128 		(408) 261-4100
"Sure, everyone knows [software] reusability is wonderful for the 
consumer side of the reuse transaction.  But what makes it wonderful 
for the producers?"  -- Brad Cox, _Superdistribution_
=======================================================================
List Archives, FAQ, FTP:  http://www.sgi.com/Technology/Performer/
            Submissions:  info-performer++at++sgi.com
        Admin. requests:  info-performer-request++at++sgi.com

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:53:47 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.