[osg-users] Unable to place model on vpb terrain. How To ?
Tueller, Shayne R Civ USAF AFMC 519 SMXS/MXDEC
Shayne.Tueller at hill.af.mil
Mon Apr 11 07:43:46 PDT 2011
The code I gave you assumes that your VPB terrain was built using the
--geocentric flag (e.g. round earth). If not, then you must resort to
what Glenn recommended in his email and handle the coordinate
conversions correctly from a flat UTM (or whatever) to a round earth.
If you do decide to build your VPB terrain using --geocentric, the X,Y,Z
coordinates have their origin at (0,0,0) (i.e. the center of the earth)
so your Z coordinate in convertXYZToLatLongHeight(276119.7034106,
4685765.312, 0.0,...) should never be zero unless you're exactly at the
equator (yielding a latitude of zero). In your call
osg::DegreesToRadians(-83.715645f), 0.0f,...) an altitude of zero will
only give you an X,Y,Z point on the ellipsoid.
From: osg-users-bounces at lists.openscenegraph.org
[mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Sanat
Sent: Friday, April 08, 2011 11:07 PM
To: osg-users at lists.openscenegraph.org
Subject: Re: [osg-users] Unable to place model on vpb terrain. How To ?
Thanks for your reply. I have tried a few different things and have a
few questions from that:
First of, when I try something like this:
osg::ref_ptr<osg::EllipsoidModel> em =
std::cout << "ellipsoid model is null\n";
//where csnVisitor has a data member storing coordsystemnode
To get over this, I need to set the ellipsoid model first and then try
the above. This seemed strange but since the ctor is overloaded, I
didn't think much of it. But now that the convertXYZToLatLong and vice
versa are giving me incorrect results, I am wondering if this maybe a
Second, when I tried using a set of coords for which I had precomputed
the geocentric (XYZ) coords from lat-long using osgEarth, I got
double latitude, longitude, height;
gHeight(276119.7034106, 4685765.312, 0.0,
latitude, longitude, height);
I think I have these functions right. But cannot figure out what maybe
causing this error.
Third, when I try to get the height above terrain like:
//where terrain position is from the convert to XYZ function
This gives me a wrong height value.
I wanted to know what it is that I can check or that I maybe doing
wrong. I have attached the terrain file (osg) that I am using in case
Read this topic online here:
osg-users mailing list
osg-users at lists.openscenegraph.org
More information about the osg-users