A couple of observations:
1) The units will be in millions because your database is a round earth
database using the WGS84 spheroid ECEF CS with units in meters.
2) I don't understand how your second code blocks maps correctly to the
geocentric cartesian round earth database built with osgdem using the
--geocentric flag.
I use this code block to map from geodetic to geocentric CS just fine without
precision problems. My models move smoothly on the terrain surface...
Code:
void Model::UpdateOrientation()
{
orientation.makeRotate(osg::DegreesToRadians(roll), osg::Vec3f(0.0,1.0,0.0), //
roll
osg::DegreesToRadians(pitch), osg::Vec3f(1.0,0.0,0.0), // pitch
osg::DegreesToRadians(-heading), osg::Vec3f(0.0,0.0,1.0)); // yaw (-heading)
}
void Model::UpdatePosition()
{
_ellipsoid->computeLocalToWorldTransformFromLatLongHeight(osg::DegreesToRadians(lat),
osg::DegreesToRadians(lon), altitude, position);
}
void Model::Update()
{
osg::Matrixd t_matrix;
t_matrix = osg::Matrixd::rotate(orientation) * position;
transform->setMatrix(t_matrix);
}
Shayne[/code]
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=52441#52441
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org