[osg-users] Coordinates in VPB database

B. McMahan osgforum at tevs.eu
Sun Mar 1 23:58:48 PST 2009


Thank you all for your help...that got me going in the right direction.

Essentially what I did was traverse the scene graph to find my osg::CoordinateSystemNode, get the osg::EllipsoidModel from it and then use it to transform my desired LLA point to world coordinates:


Code:

double lat = osg::DegreesToRadians(37.0);
double lon = osg::DegreesToRadians(-118.0);

osg::Matrix localToWorld;

/* 'em' is the EllipsoidModel */
em->computeLocalToWorldTransformFromLatLongHeight(lat, lon, 0.0, localToWorld);

/* using a huge cylinder to test position & orientation */
osg::ref_ptr<osg::Geode> cyl = new osg::Geode();
cyl->addDrawable(new osg::ShapeDrawable(new osg::Cylinder(osg::Vec3(0.0, 0.0, 0.0), 100000.0, 10000000.0)));

osg::ref_ptr<osg::MatrixTransform> transform = new 
osg::MatrixTransform(localToWorld);
transform->addChild(cyl.get());
sceneRoot->addChild(transform.get());





Thanks!

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








More information about the osg-users mailing list