Re: [osg-users] Example of geographical position

2010-02-08 Thread Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC
Tony,

In answer to your question, you want to do the former. Assuming you have a
geocentric database, you must convert your lat,lon,elev to a geocentric
X,Y,Z (i.e. origin is the center of the earth) and then use these
coordinates to set the position accordingly...

Osg::Matrix position;
earth-computeLocalToWorldTransformFromLatLongHeight(osg::DegreesToRadians(l
at),
Osg::DegreesToRadians(lon), elev, position);
transform-setMatrix(position);

transform is the node that is part of the entity class I discussed
earlier. If you want your entity to move along, you'll need to update the
code above in an update callback...

-Shayne

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Tony Vasile
Sent: Sunday, February 07, 2010 8:01 PM
To: osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] Example of geographical position

Hi Shayne,
   Excuse my newbie status so how do I set up the MatrixTransform do I just
use the latitude, longitude and altitude as a translation or do I just set
the position of my vehicle using the latitude, longitude to set the position
of the vehicle some how. 



smime.p7s
Description: S/MIME cryptographic signature
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Example of geographical position

2010-02-07 Thread Tony Vasile
Hi Shayne,
   Excuse my newbie status so how do I set up the MatrixTransform do I just
use the latitude, longitude and altitude as a translation or do I just set
the position of my vehicle using the latitude, longitude to set the position
of the vehicle some how.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Example of geographical position

2010-02-05 Thread Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC
Tony,

Entity is just my own class that can represent an airplane, tank, or
whatever.

The member Entity-transform is an osg::MatrixTransform which you'll need
for moving models. 

entityGrp is an osg::Group*.

-Shayne

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Tony Vasile
Sent: Thursday, February 04, 2010 11:25 PM
To: osg-users@lists.openscenegraph.org
Subject: Re: [osg-users] Example of geographical position

Shayne,
   What is the type of Entity and entityGrp in the following code snippet?

Along with Robert's suggestion, you can use the following code snippet to
place a vehicle on a spheroid that has VPB terrain, into the scenegraph.
You'll need osgSim and osg::EllipsoidModel to do this.

Entity-lat = 36.4;
Entity-lon = -115.015;
Entity-alt = GetHeightOnTerrain(Entity-
lat, Entity-lon);
entityGrp-addChild(Entity-transform);

double GetHeightOnTerrain(double lat, double lon) {
   double X,Y,Z;
   double maxElevation = 13000 / 3.281;
   earth-convertLatLongHeightToXYZ(osg::DegreesToRadians(lat),
osg::DegreesToRadians(lon),maxElevation, X,Y,Z);
   double hat =
osgSim::HeightAboveTerrain::computeHeightAboveTerrain(terrain.get(),
osg::Vec3(X,Y,Z), -1);
   return (maxElevation - hat);
}

The earth is an osg::EllipsoidModel object and the terrain is a node
loaded in from the ive file build by VPB. The entity group node is simply
added to your scenegraph and you're ready to go.

Hopefully this will get you started...:)

-Shayne



smime.p7s
Description: S/MIME cryptographic signature
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Example of geographical position

2010-02-04 Thread Robert Osfield
Hi Tony,

Have a look at the osgsimuluation example as this uses the
CoordinateSystemNode/EllipsoidModel to provide conversion between
lat/long/height to XYZ.

Robert.

On Thu, Feb 4, 2010 at 12:12 AM, Tony Vasile ming...@gmail.com wrote:
 Hi,
    I'm a newbie and trying to find as many examples as I can. What I am
 looking for is an example of using a vehicle in latitude, longitude and
 altitude and placing it in the scene graph. Unfortunately most of the
 applications I have found programs such as Flightgear and Simgear and they
 just have far too much code to understand the general ideas quickly.
 Any help would be most appreciated.


 Another problem I have is with VPB. I have some level 1 DTED data that I
 wish to use in my scene graph for collision and occlusion events. Do I need
 to have an image overlayed on the DTED data before I can see anything with
 osgviewer?

 Tony Vasile

 CSC Australia

 ___
 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] Example of geographical position

2010-02-04 Thread Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC
Tony,

Along with Robert's suggestion, you can use the following code snippet to
place a vehicle on a spheroid that has VPB terrain, into the scenegraph.
You'll need osgSim and osg::EllipsoidModel to do this.

Entity-lat = 36.4;
Entity-lon = -115.015;
Entity-alt = GetHeightOnTerrain(Entity-lat, Entity-lon);
entityGrp-addChild(Entity-transform);

double GetHeightOnTerrain(double lat, double lon)
{
double X,Y,Z;
double maxElevation = 13000 / 3.281;
earth-convertLatLongHeightToXYZ(osg::DegreesToRadians(lat),
osg::DegreesToRadians(lon),maxElevation, X,Y,Z);
double hat =
osgSim::HeightAboveTerrain::computeHeightAboveTerrain(terrain.get(),
osg::Vec3(X,Y,Z), -1);
return (maxElevation - hat);
}

The earth is an osg::EllipsoidModel object and the terrain is a node
loaded in from the ive file build by VPB. The entity group node is simply
added to your scenegraph and you're ready to go.

Hopefully this will get you started...:)

-Shayne

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Tony Vasile
Sent: Wednesday, February 03, 2010 5:13 PM
To: osg-users@lists.openscenegraph.org
Subject: [osg-users] Example of geographical position

Hi,
   I'm a newbie and trying to find as many examples as I can. What I am
looking for is an example of using a vehicle in latitude, longitude and
altitude and placing it in the scene graph. Unfortunately most of the
applications I have found programs such as Flightgear and Simgear and they
just have far too much code to understand the general ideas quickly.
Any help would be most appreciated.


Another problem I have is with VPB. I have some level 1 DTED data that I
wish to use in my scene graph for collision and occlusion events. Do I need
to have an image overlayed on the DTED data before I can see anything with
osgviewer?

Tony Vasile

CSC Australia



smime.p7s
Description: S/MIME cryptographic signature
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Example of geographical position

2010-02-04 Thread Tony Vasile
Shayne,
   What is the type of Entity and entityGrp in the following code snippet?

Along with Robert's suggestion, you can use the following code snippet to
place a vehicle on a spheroid that has VPB terrain, into the scenegraph.
You'll need osgSim and osg::EllipsoidModel to do this.

Entity-lat = 36.4;
Entity-lon = -115.015;
Entity-alt = GetHeightOnTerrain(Entity-
lat, Entity-lon);
entityGrp-addChild(Entity-transform);

double GetHeightOnTerrain(double lat, double lon)
{
   double X,Y,Z;
   double maxElevation = 13000 / 3.281;
   earth-convertLatLongHeightToXYZ(osg::DegreesToRadians(lat),
osg::DegreesToRadians(lon),maxElevation, X,Y,Z);
   double hat =
osgSim::HeightAboveTerrain::computeHeightAboveTerrain(terrain.get(),
osg::Vec3(X,Y,Z), -1);
   return (maxElevation - hat);
}

The earth is an osg::EllipsoidModel object and the terrain is a node
loaded in from the ive file build by VPB. The entity group node is simply
added to your scenegraph and you're ready to go.

Hopefully this will get you started...:)

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