Thanks, Shayne. It was the --geocentric flag missing from the osgdem that was messing everything up. Once this was fixed, I also had to correct the way that I was positioning the observer eyepoint to account for the geocentric nature of the terrain (I now use EllipsoidModel::computeLocalToWorldTransformFromLatLonHeight() to generate a matrix that is used to position the eyepoint, rather than using lat/lon information directly).
Murray On 2010-11-24, at 4:59 PM, Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC wrote: > 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: osg-users-boun...@lists.openscenegraph.org > [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Murray G. > Gamble > Sent: Wednesday, November 24, 2010 2:19 PM > To: osg-users@lists.openscenegraph.org > 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 > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Murray G. Gamble, CMSP Director of Modeling & Simulation VSIM / Advanced Cognitive Engineering (ACE) Lab 2227 V-SIM, Carleton University Ottawa, Ontario, K1S 5B6 off: 613.520.2600 x2475 cell: 613.298.0997 fax: 613.520.2539 e-mail: mgam...@connect.carleton.ca <mailto:mgam...@connect.carleton.ca> http://acelab.carleton.ca
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org