Added better handling of 0,0,0 values
This commit is contained in:
parent
29be5312a0
commit
d2c16c2fa0
@ -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);
|
||||
|
||||
|
@ -51,10 +51,6 @@ CoordinateFrame CoordinateSystemNode::computeLocalCoordinateFrame(const Vec3d& p
|
||||
double latitude, longitude, height;
|
||||
_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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user