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


Re: [osg-users] Coordinates in VPB database

2009-02-28 Thread Glenn Waldron
Re #1: Your whole-earth database is in geocentric (earth-centered XYZ)
coordinates. In the class osg::EllipsoidModel (in osg/CoordinateSystemNode)
there are functions to convert from lat/long to geocentric and back. You can
these to calcuate the XYZ at which to place your model. Then use the XYZ to
create an osg/MatrixTransform, and put your model node under it.


Glenn Waldron : Pelican Mapping : http://pelicanmapping.com :
+1.703.652.4791


On Sat, Feb 28, 2009 at 4:53 PM, B. McMahan osgfo...@tevs.eu wrote:

 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

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


Re: [osg-users] Coordinates in VPB database

2009-02-28 Thread Paul Martz
EllipsoidModel and CoordinateSystemNode also provide you with a local up
vector, which will be a component of the orientation part of your
MatrixTransform.
 
Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com http://www.skew-matrix.com/ 
+1 303 859 9466
 

  _  

From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Glenn
Waldron
Sent: Saturday, February 28, 2009 3:04 PM
To: osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] Coordinates in VPB database


Re #1: Your whole-earth database is in geocentric (earth-centered XYZ)
coordinates. In the class osg::EllipsoidModel (in osg/CoordinateSystemNode)
there are functions to convert from lat/long to geocentric and back. You can
these to calcuate the XYZ at which to place your model. Then use the XYZ to
create an osg/MatrixTransform, and put your model node under it.


Glenn Waldron : Pelican Mapping : http://pelicanmapping.com :
+1.703.652.4791



On Sat, Feb 28, 2009 at 4:53 PM, B. McMahan osgfo...@tevs.eu wrote:


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



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