On Montag 23 Mai 2005 10:52, BONNEVILLE David wrote:
> How could I get the terrain elevation at a given lat/lon at runtime ?
> Could you point me to the right way ?
That depends on what you need.

In src/Scenery/hitlist.* there are the fgCurrentElev(...) functions which 
could be used to get a list of intersection points of the scenery with the 
line from the given position towards the earths center. You can see in 
src/Scenery/tilemgr.cxx in the function 
FGTileMgr::updateCurrentElevAtPos(...) how this could be used to compute a 
single altitude value.

Alternatively, you can use that ground cache in src/FDM/groundcache* to get 
such scenery altitude. You first have to build that cache for a given 
position with prepare_ground_cache. Then you can query for the altitude by 

The basic difference is that the fgCurrentElev function walks the whole 
scenery each time you ask for an altitude.
The ground cache functions build up a small flat subset of the scenery into an 
own small scenegraph.
If you need miltiple terrain altitude values at close but different points in 
the scene the ground cache will be better.
If you need only a single altitude or values far from each other you need to 
use fgCurrentElev.



Mathias Fröhlich, email: [EMAIL PROTECTED]

Flightgear-devel mailing list

Reply via email to