From d2c16c2fa0f48b6a823f37784c353307e9020b11 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 13 Jun 2007 13:41:23 +0000 Subject: [PATCH] Added better handling of 0,0,0 values --- include/osg/CoordinateSystemNode | 2 +- src/osg/CoordinateSystemNode.cpp | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/include/osg/CoordinateSystemNode b/include/osg/CoordinateSystemNode index ef5f7cd1b..04918d237 100644 --- a/include/osg/CoordinateSystemNode +++ b/include/osg/CoordinateSystemNode @@ -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); diff --git a/src/osg/CoordinateSystemNode.cpp b/src/osg/CoordinateSystemNode.cpp index c4af22144..343238066 100644 --- a/src/osg/CoordinateSystemNode.cpp +++ b/src/osg/CoordinateSystemNode.cpp @@ -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="<computeLocalToWorldTransformFromXYZ(position.x(),position.y(),position.z(), localToWorld); return localToWorld; }