double dLatInRadians, dLonInRadians, dAltInMeters, x, y, z;
osg::CoordinateSystemNode *pCoordSysNode = dynamic_cast< osg::CoordinateSystemNode * >( _pEarthNode.get() );
if ( pCoordSysNode )
{
// Get the ellipsoid model for the map
osg::EllipsoidModel *pEllipse = pCoordSysNode->getEllipsoidModel( );
if ( pEllipse )
{
// This is a geocentric map and we must convert the
// lat, lon, alt to x, y, z
pEllipse->convertLatLongHeightToXYZ( dLatInRadians, dLonInRadians, dAltInMeters, x, y, z );
} // end if
} // end if ( pCoordSysNode )
Set yourself up "for" loops and generate points for various lat, lon locations so that the lines loop around the earth. You'll have to pick an appropriate lat,lon increment in the loops so that the lines don't go through the earth model. You may want to create a paged LOD database (or modify lines in real time) because you would probably want to see lat,lon lines less spaced apart as the camera gets closer in distance to the earth. Also, I would probably vary the altitude of the lines based on camera distance from the earth to prevent the lines from gettting hidden underneath the earth surface. As you get farther away from the earth, the greater the altitude I would use in the convertLatLongHeightToXYZ call above.
Good luck.
I am trying to add latitude/longitude lines to the earth. I ran osgdem –bluemarble-west –t land_shallow_topo_west.tif –bluemarble-east –t land_shallow_topo_east.tif --geocentric –l 12 –o model.ive to build my model of the earth. I have tried taking pieces from the osggeometry and osgsimulation examples to get lines on the earth without any success. Could I draw a bunch of line segments the just wrap around the earth, if so, some guidance in this area would be appreciated. Right now I am getting some lines on the screen, but I used the osgtext example and took out the text stuff and put some line drawing (as in osggeometry) in there, but I would to be able to pick two geo points(lat/long) and draw a line between them without the line going through the earth. Any help with attaching lines to the earth, so that they curve around the earth and are also attached to it as I rotate would be appreciated. Thanks in advance.
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
