From 4a7fed9e2e82f22fbff1a090e23be1cff61d4c14 Mon Sep 17 00:00:00 2001 From: Jesse Mapel <jmapel@usgs.gov> Date: Mon, 15 Apr 2019 12:12:04 -0700 Subject: [PATCH] Added fall back for ground partials --- src/UsgsAstroFrameSensorModel.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/UsgsAstroFrameSensorModel.cpp b/src/UsgsAstroFrameSensorModel.cpp index 8db8884..45c7916 100644 --- a/src/UsgsAstroFrameSensorModel.cpp +++ b/src/UsgsAstroFrameSensorModel.cpp @@ -568,6 +568,15 @@ std::vector<double> UsgsAstroFrameSensorModel::computeGroundPartials(const csm:: double dz = nextPoint.z - z; double pixelGroundSize = sqrt((dx*dx + dy*dy + dz*dz) / 2.0); + // If the ground size is too small, try the opposite direction + if (pixelGroundSize < 1e-10) { + nextPoint = imageToGround(csm::ImageCoord(ipB.line - 1, ipB.samp - 1)); + dx = nextPoint.x - x; + dy = nextPoint.y - y; + dz = nextPoint.z - z; + pixelGroundSize = sqrt((dx*dx + dy*dy + dz*dz) / 2.0); + } + csm::ImageCoord ipX = groundToImage(csm::EcefCoord(x + pixelGroundSize, y, z)); csm::ImageCoord ipY = groundToImage(csm::EcefCoord(x, y + pixelGroundSize, z)); csm::ImageCoord ipZ = groundToImage(csm::EcefCoord(x, y, z + pixelGroundSize)); -- GitLab