Just a few questions from your code...

1) I noticed that your osgdem command isn't using --geocentric in the
command line. Are you building a geocentric database?
2) Are your lat lon values in degrees or radians? The
convertLatLongHeightToXYZ() method requires lat, lon radians.
3) Why is your traversal mask -1 in the computeHeightAboveTerrain()? Try
removing the -1 from this call...

Regards,
-Shayne

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Murray G.
Gamble
Sent: Wednesday, November 24, 2010 2:19 PM
To: [email protected]
Subject: [osg-users] osgSim::HeightAboveTerrain not returning any hits

Hi All,

It's been a while.  Good to be back.

We have created a paged terrain database using VPB/OsgDem with
geo-referenced GeoTIFF-based elevation data using the command:

        osgdem -d honolulu.tif --no-terrain-simplification -l 16 -o
honolulu.ive

This creates a very detailed terrain database against which we'd like to
perform HAT queries.

We build a simple scene graph using the following lines of code:

        osg::Node *wTerrainNode = osgDB::readNodeFile( "honolulu.ive" );
        osg::Group *wRootNode = new osg::Group();

        wRootNode->addChild( wTerrainNode );

        osgViewer::Viewer *wViewer = new osgViewer::Viewer();
        wViewer->setUpViewerInWindow( 100, 100, 800, 600 );
        wViewer->setSceneData( wRootNode );
        wViewer->realize();

        osgSim::HeightAboveTerrain wHatTester;
        osg::CoordinateSystemNode *wCsn =
dynamic_cast<osg::CoordinateSystemNode*>(wTerrainNode);
        wCsn->setEllipsoidModel( new osg::EllipsoidModel() );

We then use the following code to query HAT (in our main loop):

        wCsn->getEllipsoidModel()->convertLatLongHeightToXYZ( wLat, wLon,
wHeight, wX, wY, wZ );

        // where wLat, wLon, wAlt are dynamic, valid values within the
terrain area being populated by our flight model

        double wHat = wHatTester.computeHeightAboveTerrain( wTerrainNode,
osg::Vec3d( wX, wY, wZ ), -1 );

In each case wHat remains a constant value consistent with height above sea
level (i.e., no hits are being generated against the terrain).  We are also
visualizing our observer position with the same lat/lon/alt values and
observe a valid, correlated position, so we know that the terrain is loading
and that the lat/lon/values being used for the HAT query are reasonable.

Any thoughts as to why we're not getting any hits?

Thank you,

Murray








_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to