Added better handling of 0,0,0 values

This commit is contained in:
Robert Osfield 2007-06-13 13:41:23 +00:00
parent 29be5312a0
commit d2c16c2fa0
2 changed files with 1 additions and 5 deletions

View File

@ -158,7 +158,7 @@ inline void EllipsoidModel::convertXYZToLatLongHeight(double X, double Y, double
{
// http://www.colorado.edu/geography/gcraft/notes/datum/gif/xyzllh.gif
double p = sqrt(X*X + Y*Y);
double theta = atan(Z*_radiusEquator/ (p*_radiusPolar));
double theta = atan2(Z*_radiusEquator , (p*_radiusPolar));
double eDashSquared = (_radiusEquator*_radiusEquator - _radiusPolar*_radiusPolar)/
(_radiusPolar*_radiusPolar);

View File

@ -52,10 +52,6 @@ CoordinateFrame CoordinateSystemNode::computeLocalCoordinateFrame(const Vec3d& p
_ellipsoidModel->convertXYZToLatLongHeight(position.x(),position.y(),position.z(),latitude, longitude, height);
_ellipsoidModel->computeLocalToWorldTransformFromLatLongHeight(latitude, longitude, 0.0f, localToWorld);
osg::notify(osg::INFO)<<"lat="<<latitude<<"\tlong="<<longitude<<"\theight"<<height<<std::endl;
//_ellipsoidModel->computeLocalToWorldTransformFromXYZ(position.x(),position.y(),position.z(), localToWorld);
return localToWorld;
}
else