# Re: [Flightgear-devel] Key Bindings

Curtis,
Thanks for the insight into the coordinate systems. I am planning on accounting for a sloped runway via the runway vector. The cross product of the aircraft's velocity vector with the runways vector (which should point in the direction of the slope) will give you a vector to rotate about and angle to rotate can be calculated from the dot product. However, the runways are only have a center point. How does does FlightGear determine the slope? More specifically how can I get the four corners of the runway with the accurate slope?

```Thanks,
Aaron

```

At 12:00 PM 11/3/2004, you wrote:
`Aaron Wilson wrote:`

Developers,
I am planing on developing a HUD instrument to display a virtual outline of the active runway on the HUD. Is there any developer(s) working on this task? If not, can anyone tell me how I can get the aircraft's velocity vector and runway vector in Cartesian coordinates.

`Hi Aaron,`

Sounds like a fun project. :-) I'm not aware that any one else is doing anything like this.

simgear/math/sg_geodesy.hxx has routines for converting from geodetic lon/lat/elev to earth centered cartesian coordinates. What I've done in the past is to use spherical or wgs84 routines to calculate the corner points of the runway(s) and then convert the resulting lon/lat into cartesian coordinates. This makes things much easier "conceptually", but perhaps is not the most efficient approach "computationally."

In the FG core code, there is an abs_view_pos vector that gives you the earth centered cartesian coordinates of your view point. I believe we also have view direction in the same cartesian coordiante system.

I don't know if we have the aircraft's velocity vector directly, but I'm sure you could compute it, or you could estimate it by taking cart_pos(n) - cart_pos(n-1)

Once you have all that, it's "simply" :-) a matter of getting your view parameters set up correctly and dumping your runway verticies/lines into the opengl pipeline.

Do you plan to account for sloping or hilly runways? These are found both in the real world and in FG ... and they do sometimes make life a little more difficult than we'd like. If you start fiddling with sloped runways, you might want to consider some sort of "offline" process to create your runway objects with the proper slope/elevation across their surface then store them in some sort of database, rather than trying to create them on the fly.

I suppose the accuracy that you need for drawing your hud runways depends largely on the accuracy of your sensors, and the tolerances within which you need to fly the aircraft. If you are planning to fly all the way to touchdown with zero visibility, then you probably need to go the extra mile and account for runway slope.

`Regards,`

`Curt.`

```--
Curtis Olson        http://www.flightgear.org/~curt
HumanFIRST Program  http://www.humanfirst.umn.edu/
FlightGear Project  http://www.flightgear.org
Unique text:        2f585eeea02e2c79d7b1d8c4963bae2d```

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

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