Hi everyone,

I am trying to calculate height value of the terrain on a given latitude and 
longitude. I am using a ive formatted terrain model that was converted using 
osgDem from Dted level-1 data. I searched a solution on whole osg forum and web 
but i could not find good one. Also I looked HeightAboveTerrain class and 
osgintersection sample but these class does not work only given a latitude and 
longitude values. 

I can get height on terrain with following code block,  is it a good solution?


Code:

osg::PagedLOD* pLod = 
dynamic_cast<osg::PagedLOD*>(coordinateSystemNode->getChild(0));
osgTerrain::TerrainTile* pTopTile = 
dynamic_cast<osgTerrain::TerrainTile*>(pLod->getChild(0));
osgTerrain::HeightFieldLayer* pLayer = 
dynamic_cast<osgTerrain::HeightFieldLayer*>(pTopTile->getElevationLayer());

pLayer->getInterpolatedValidValue( osg::DegreesToRadians(langVal), 
osg::DegreesToRadians(longVal), height );




Cheers,

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=53687#53687





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to