Deniz,

If you're using osgdem with the --geocentric flag set, you're building a
geocentric database which is correct.

Here's a code snippet that may help you position your camera on the spheroid
in geocentric space. It sets the view matrix for the camera given the lat,
lon and alt. Roll, pitch, and yaw are zero in this example which means you
will be flying level looking north.

osg::Matrixd vm;
ellipsoid->computeLocalToWorldTransformFromLatLongHeight(osg::DegreesToRadia
ns(lat),
                                                osg::DegreesToRadians(lon),
alt, vm);
vm.invert(vm);

osg::Matrixd rotation2YUp;
rotation2YUp.makeRotate(-M_PI_2, osg::Vec3f(1.0, 0.0, 0.0));
vm *= rotation2YUp;
view->getCamera()->setViewMatrix(vm);

Hope this helps...
-Shayne

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of deniz
diktas
Sent: Monday, December 27, 2010 3:35 PM
To: [email protected]
Subject: [osg-users] [vpb] geographic to geocentric coordinate
transformation

Hi,

I am using osgdem to generate a terrain from a set of dted-files in
geocentric coordinates. What I am trying to do next is to navigate the
camera along a path given in geographic coordinates (lat, long, alt).

However, when I try to convert a geographic coordinate (of which I am sure
from where the terrain is visible) to geocentric coordinates, and place my
camera there I do not get to see anything. I transform the coordinates using
osg:EllipsoidModel. 

I also realized that I am getting weird output results from the Ellipsoid
transformation: when I construct a bounding sphere bounding the whole
terrain (built in geocentric coord-sys) and test a point at the center of
the terrain (converted from geographic to geocentric coordinates) to see if
it is included in this bonding sphere, it turns out that this point in
geocentric coordinates is not included inside this bounding sphere - which
is a contradiction.

am I missing something when performing the transformation from geographic to
geocentric coordinates? 
are there other transformations I have to incorporate into my calculation? 
or am I building my terrain database with the wrong parameters ?

I use --geocentric option and I pass the root directory of all dted files. 
I use osg-version 2.9.5 and virtual-planet-builder-v11.

any help is greatly appreciated..

Thank you!

Cheers,
deniz

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





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to