SimApi Convertor getTerrainHeightGlobal
Jump to navigation
Jump to search
static float SimApi::Convertor::getTerrainHeightGlobal(const double &lon, const double &lat)
Description
Gets the terrain height of a particular point.
Parameters
lon - Longitude world global coordinate (radians)
lat - Latitude world global coordinate (radians)
Return
Type: float Description: The height (in meters) of the terrain in the point
Remarks
The return value is the height of the terrain loaded by the simulation in given coordinates. See "Terrain" for more information on terrains in simulation.
Code Sample
float HeightAboveGround(double i_Longitude, double i_Latitude, float i_Height)
{
//get Terrain height
float terrainHeight = SimApi::Convertor::getTerrainHeightGlobal(i_Longitude,i_Latitude);
//compute height above ground
float heightAboveGround = i_Height - terrainHeight;
return heightAboveGround;
}
int main(int argc, char* argv[])
{
// Latitude and Longitude in radians
double lat = 0.6283; // == 36 degrees
double lon = -2.0071; // == -115 degrees
float height = 3500;
float heightAboveGround = HeightAboveGround(lon,lat,height);
cout<<"Height above ground: "<<heightAboveGround<<endl;
return 0;
}
Output:
-------
Height above ground: 2705.5166
See Also
getTerrainHeight
Related Links
SIMbox Coordinates Systems Overview
Terrain