Loading isis/src/base/objs/SurfacePoint/SurfacePoint.cpp +16 −63 Original line number Diff line number Diff line Loading @@ -26,12 +26,7 @@ namespace Isis { * */ SurfacePoint::SurfacePoint(const SurfacePoint &other) { if(other.p_localRadius) { p_localRadius = new Distance(*other.p_localRadius); } else { p_localRadius = NULL; } p_localRadius = other.p_localRadius; if(other.p_x) { p_x = new Displacement(*other.p_x); Loading Loading @@ -204,7 +199,7 @@ namespace Isis { p_x = NULL; p_y = NULL; p_z = NULL; p_localRadius = NULL; p_localRadius = Distance(); } Loading Loading @@ -257,10 +252,10 @@ namespace Isis { // throw IException(IException::User, msg, _FILEINFO_); // } if (!p_localRadius || (p_localRadius && !(*p_localRadius).isValid())) { if (!p_localRadius.isValid()) { ComputeLocalRadius(); p_localRadius = GetLocalRadius(); } *p_localRadius = GetLocalRadius(); } Loading @@ -283,9 +278,7 @@ namespace Isis { const Distance &ySigma, const Distance &zSigma) { // Wipe out current local radius to ensure it will be recalculated in SetRectangularPoint if (p_localRadius) { *p_localRadius = Distance(); } p_localRadius = Distance(); SetRectangularPoint(x, y, z); Loading @@ -308,9 +301,7 @@ namespace Isis { void SurfacePoint::SetRectangular(Displacement x, Displacement y, Displacement z, const symmetric_matrix<double,upper>& covar) { // Wipe out current local radius to ensure it will be recalulated in SetRectangularPoint if (p_localRadius) { *p_localRadius = Distance(); } p_localRadius = Distance(); SetRectangularPoint(x, y, z); SetRectangularMatrix(covar); Loading Loading @@ -440,12 +431,7 @@ namespace Isis { latrec_c ( dradius, dlon, dlat, rect); // Set local radius now since we have it to avoid calculating it later if (p_localRadius) { *p_localRadius = radius; } else { p_localRadius = new Distance(radius); } p_localRadius = radius; SetRectangularPoint(Displacement(rect[0], Displacement::Kilometers), Displacement(rect[1], Displacement::Kilometers), Loading Loading @@ -708,7 +694,7 @@ namespace Isis { } ComputeLocalRadius(); *p_localRadius = GetLocalRadius(); p_localRadius = GetLocalRadius(); } Loading Loading @@ -736,12 +722,7 @@ namespace Isis { SpiceDouble lat = (double) GetLatitude().radians(); SpiceDouble lon = (double) GetLongitude().radians(); if (p_localRadius) { *p_localRadius = radius; } else { p_localRadius = new Distance(radius); } p_localRadius = radius; // Set rectangular coordinates SpiceDouble rect[3]; Loading Loading @@ -888,20 +869,10 @@ namespace Isis { double y = p_y->meters(); double z = p_z->meters(); if (p_localRadius) { *p_localRadius = Distance(sqrt(x*x + y*y + z*z), Distance::Meters); } else { p_localRadius = new Distance(sqrt(x*x + y*y + z*z), Distance::Meters); } p_localRadius = Distance(sqrt(x*x + y*y + z*z), Distance::Meters); } else if (*p_x == zero && *p_y == zero && *p_z == zero) { // for backwards compatability if (p_localRadius) { *p_localRadius = Distance(0., Distance::Meters); } else { p_localRadius = new Distance(0., Distance::Meters); } p_localRadius = Distance(0., Distance::Meters); } else { // Invalid point IString msg = "SurfacePoint::Can't compute local radius on invalid point"; Loading @@ -915,15 +886,7 @@ namespace Isis { * */ Distance SurfacePoint::GetLocalRadius() const { if (!Valid()) return Distance(); if (p_localRadius) { return *p_localRadius; } else { return Distance(); } return p_localRadius; } Loading @@ -932,7 +895,7 @@ namespace Isis { * */ Distance SurfacePoint::GetLatSigmaDistance() const { Distance latSigmaDistance; Distance latSigmaDistance = Distance(); if(Valid()) { Angle latSigma = GetLatSigma(); Loading Loading @@ -1146,10 +1109,6 @@ namespace Isis { *p_x = *other.p_x; *p_y = *other.p_y; *p_z = *other.p_z; // Finally initialize local radius to avoid using a previous value if (p_localRadius && other.p_localRadius) { *p_localRadius = other.GetLocalRadius(); } } else { FreeAllocatedMemory(); Loading @@ -1166,10 +1125,6 @@ namespace Isis { p_z = new Displacement(*other.p_z); } if(other.p_localRadius) { p_localRadius = new Distance(other.GetLocalRadius()); } if(other.p_rectCovar) { p_rectCovar = new symmetric_matrix<double, upper>(*other.p_rectCovar); } Loading @@ -1179,6 +1134,9 @@ namespace Isis { } } // Finally initialize local radius to avoid using a previous value p_localRadius = other.GetLocalRadius(); return *this; } Loading @@ -1198,11 +1156,6 @@ namespace Isis { p_z = NULL; } if(p_localRadius) { delete p_localRadius; p_localRadius = NULL; } if(p_rectCovar) { delete p_rectCovar; p_rectCovar = NULL; Loading isis/src/base/objs/SurfacePoint/SurfacePoint.h +5 −3 Original line number Diff line number Diff line Loading @@ -95,9 +95,11 @@ namespace Isis { * have not changed. Also corrected the longitude conversion equation * in SetSphericalSigmasDistance and GetLonSigmaDistance. * References #5457. * @history 2018-07-30 Debbie A. Cook - Initialized the local radius whenever any * @history 2018-08-15 Debbie A. Cook - Initialized the local radius whenever any * SurfacePoint coordinate was changed, removed memory errors, * and cleaned up documentation. References #5457 * and cleaned up documentation. Changed localRadius member * from a pointer to value to reduce extraneous if blocks. * References #5457 */ class SurfacePoint { Loading Loading @@ -215,7 +217,7 @@ namespace Isis { void SetSphericalPoint(const Latitude &lat, const Longitude &lon, const Distance &radius); void FreeAllocatedMemory(); Distance *p_localRadius; Distance p_localRadius; Displacement *p_x; Displacement *p_y; Displacement *p_z; Loading Loading
isis/src/base/objs/SurfacePoint/SurfacePoint.cpp +16 −63 Original line number Diff line number Diff line Loading @@ -26,12 +26,7 @@ namespace Isis { * */ SurfacePoint::SurfacePoint(const SurfacePoint &other) { if(other.p_localRadius) { p_localRadius = new Distance(*other.p_localRadius); } else { p_localRadius = NULL; } p_localRadius = other.p_localRadius; if(other.p_x) { p_x = new Displacement(*other.p_x); Loading Loading @@ -204,7 +199,7 @@ namespace Isis { p_x = NULL; p_y = NULL; p_z = NULL; p_localRadius = NULL; p_localRadius = Distance(); } Loading Loading @@ -257,10 +252,10 @@ namespace Isis { // throw IException(IException::User, msg, _FILEINFO_); // } if (!p_localRadius || (p_localRadius && !(*p_localRadius).isValid())) { if (!p_localRadius.isValid()) { ComputeLocalRadius(); p_localRadius = GetLocalRadius(); } *p_localRadius = GetLocalRadius(); } Loading @@ -283,9 +278,7 @@ namespace Isis { const Distance &ySigma, const Distance &zSigma) { // Wipe out current local radius to ensure it will be recalculated in SetRectangularPoint if (p_localRadius) { *p_localRadius = Distance(); } p_localRadius = Distance(); SetRectangularPoint(x, y, z); Loading @@ -308,9 +301,7 @@ namespace Isis { void SurfacePoint::SetRectangular(Displacement x, Displacement y, Displacement z, const symmetric_matrix<double,upper>& covar) { // Wipe out current local radius to ensure it will be recalulated in SetRectangularPoint if (p_localRadius) { *p_localRadius = Distance(); } p_localRadius = Distance(); SetRectangularPoint(x, y, z); SetRectangularMatrix(covar); Loading Loading @@ -440,12 +431,7 @@ namespace Isis { latrec_c ( dradius, dlon, dlat, rect); // Set local radius now since we have it to avoid calculating it later if (p_localRadius) { *p_localRadius = radius; } else { p_localRadius = new Distance(radius); } p_localRadius = radius; SetRectangularPoint(Displacement(rect[0], Displacement::Kilometers), Displacement(rect[1], Displacement::Kilometers), Loading Loading @@ -708,7 +694,7 @@ namespace Isis { } ComputeLocalRadius(); *p_localRadius = GetLocalRadius(); p_localRadius = GetLocalRadius(); } Loading Loading @@ -736,12 +722,7 @@ namespace Isis { SpiceDouble lat = (double) GetLatitude().radians(); SpiceDouble lon = (double) GetLongitude().radians(); if (p_localRadius) { *p_localRadius = radius; } else { p_localRadius = new Distance(radius); } p_localRadius = radius; // Set rectangular coordinates SpiceDouble rect[3]; Loading Loading @@ -888,20 +869,10 @@ namespace Isis { double y = p_y->meters(); double z = p_z->meters(); if (p_localRadius) { *p_localRadius = Distance(sqrt(x*x + y*y + z*z), Distance::Meters); } else { p_localRadius = new Distance(sqrt(x*x + y*y + z*z), Distance::Meters); } p_localRadius = Distance(sqrt(x*x + y*y + z*z), Distance::Meters); } else if (*p_x == zero && *p_y == zero && *p_z == zero) { // for backwards compatability if (p_localRadius) { *p_localRadius = Distance(0., Distance::Meters); } else { p_localRadius = new Distance(0., Distance::Meters); } p_localRadius = Distance(0., Distance::Meters); } else { // Invalid point IString msg = "SurfacePoint::Can't compute local radius on invalid point"; Loading @@ -915,15 +886,7 @@ namespace Isis { * */ Distance SurfacePoint::GetLocalRadius() const { if (!Valid()) return Distance(); if (p_localRadius) { return *p_localRadius; } else { return Distance(); } return p_localRadius; } Loading @@ -932,7 +895,7 @@ namespace Isis { * */ Distance SurfacePoint::GetLatSigmaDistance() const { Distance latSigmaDistance; Distance latSigmaDistance = Distance(); if(Valid()) { Angle latSigma = GetLatSigma(); Loading Loading @@ -1146,10 +1109,6 @@ namespace Isis { *p_x = *other.p_x; *p_y = *other.p_y; *p_z = *other.p_z; // Finally initialize local radius to avoid using a previous value if (p_localRadius && other.p_localRadius) { *p_localRadius = other.GetLocalRadius(); } } else { FreeAllocatedMemory(); Loading @@ -1166,10 +1125,6 @@ namespace Isis { p_z = new Displacement(*other.p_z); } if(other.p_localRadius) { p_localRadius = new Distance(other.GetLocalRadius()); } if(other.p_rectCovar) { p_rectCovar = new symmetric_matrix<double, upper>(*other.p_rectCovar); } Loading @@ -1179,6 +1134,9 @@ namespace Isis { } } // Finally initialize local radius to avoid using a previous value p_localRadius = other.GetLocalRadius(); return *this; } Loading @@ -1198,11 +1156,6 @@ namespace Isis { p_z = NULL; } if(p_localRadius) { delete p_localRadius; p_localRadius = NULL; } if(p_rectCovar) { delete p_rectCovar; p_rectCovar = NULL; Loading
isis/src/base/objs/SurfacePoint/SurfacePoint.h +5 −3 Original line number Diff line number Diff line Loading @@ -95,9 +95,11 @@ namespace Isis { * have not changed. Also corrected the longitude conversion equation * in SetSphericalSigmasDistance and GetLonSigmaDistance. * References #5457. * @history 2018-07-30 Debbie A. Cook - Initialized the local radius whenever any * @history 2018-08-15 Debbie A. Cook - Initialized the local radius whenever any * SurfacePoint coordinate was changed, removed memory errors, * and cleaned up documentation. References #5457 * and cleaned up documentation. Changed localRadius member * from a pointer to value to reduce extraneous if blocks. * References #5457 */ class SurfacePoint { Loading Loading @@ -215,7 +217,7 @@ namespace Isis { void SetSphericalPoint(const Latitude &lat, const Longitude &lon, const Distance &radius); void FreeAllocatedMemory(); Distance *p_localRadius; Distance p_localRadius; Displacement *p_x; Displacement *p_y; Displacement *p_z; Loading