Re: [osg-users] Coordinates in VPB database

2009-03-01 Thread B. McMahan
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_ptrosg::Geode cyl = new osg::Geode();
cyl-addDrawable(new osg::ShapeDrawable(new osg::Cylinder(osg::Vec3(0.0, 0.0, 
0.0), 10.0, 1000.0)));

osg::ref_ptrosg::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





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


[osg-users] Coordinates in VPB database

2009-02-28 Thread B. McMahan
Pardon the elementary question...I'm a newbie with OSG and VPB.  I've search 
around but haven't found a simple example that illustrates what I'd like to do.

Essentially, I've built a VPB whole-earth database and got it loaded in my 
application.  There are two things I'd like to do at this point: 

1) Place a model at some point relative to the earth by latitude, longitude, 
and possibly altitude.

2) Perform an intersection test from the mouse cursor to find the latitude and 
longitude of the point on the earth's surface that the mouse is intersecting 
with.  In short, if the mouse is hovering over the planet's surface, transform 
that point from screen coords to world coordinates, and then convert to lat/lon.

At this point, given my little experience with OSG at the moment on how to 
proceed.  I'm really not looking for hand-outs...but if you can point me to a 
simple (easily digestible) example I'd be just as grateful.

Thank you in advance!

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





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