diff --git a/src/UsgsAstroSarSensorModel.cpp b/src/UsgsAstroSarSensorModel.cpp index dfbd5e8989f3532c1b2669c2b1fc14f1e905e711..f84b20665824ee84b9ee722665adf71c93cd9d36 100644 --- a/src/UsgsAstroSarSensorModel.cpp +++ b/src/UsgsAstroSarSensorModel.cpp @@ -374,7 +374,7 @@ csm::ImageCoord UsgsAstroSarSensorModel::groundToImage( groundPt, time, slantRangeValue, groundTolerance); double line = (time - m_startingEphemerisTime) / m_exposureDuration + 0.5; - double sample = groundRange / m_scaledPixelWidth; + double sample = groundRange / m_scaledPixelWidth + 0.5; return csm::ImageCoord(line, sample); } catch (std::exception& error) { std::string message = "Could not calculate groundToImage, with error ["; @@ -504,7 +504,7 @@ csm::EcefCoord UsgsAstroSarSensorModel::imageToGround( imagePt.line, height, desiredPrecision); double time = m_startingEphemerisTime + (imagePt.line - 0.5) * m_exposureDuration; - double groundRange = imagePt.samp * m_scaledPixelWidth; + double groundRange = (imagePt.samp - 0.5) * m_scaledPixelWidth; std::vector<double> coeffs = getRangeCoefficients(time); double slantRange = groundRangeToSlantRange(groundRange, coeffs); @@ -640,7 +640,7 @@ csm::EcefLocus UsgsAstroSarSensorModel::imageToProximateImagingLocus( // Compute the slant range double time = m_startingEphemerisTime + (imagePt.line - 0.5) * m_exposureDuration; - double groundRange = imagePt.samp * m_scaledPixelWidth; + double groundRange = (imagePt.samp - 0.5) * m_scaledPixelWidth; std::vector<double> coeffs = getRangeCoefficients(time); double slantRange = groundRangeToSlantRange(groundRange, coeffs); diff --git a/tests/SarTests.cpp b/tests/SarTests.cpp index 00285c20bea63617742df7c88dc31f654483e5dc..8871d4f1b646de7a1e679ed9ad44d9c00d881164 100644 --- a/tests/SarTests.cpp +++ b/tests/SarTests.cpp @@ -43,14 +43,13 @@ TEST_F(SarSensorModel, State) { TEST_F(SarSensorModel, Center) { csm::ImageCoord imagePt(500.0, 500.0); csm::EcefCoord groundPt = sensorModel->imageToGround(imagePt, 0.0); - EXPECT_NEAR(groundPt.x, 1737387.8590770673, 1e-3); - EXPECT_NEAR(groundPt.y, -5303.280537826621, 1e-3); + EXPECT_NEAR(groundPt.x, 1737387.8671710272, 1e-3); + EXPECT_NEAR(groundPt.y, -5300.6282306119301, 1e-3); EXPECT_NEAR(groundPt.z, -3749.9796183814506, 1e-3); } TEST_F(SarSensorModel, GroundToImage) { - csm::EcefCoord groundPt(1737387.8590770673, -5303.280537826621, - -3749.9796183814506); + csm::EcefCoord groundPt(1737387.8671710272, -5300.6282306119301, -3749.9796358514604); csm::ImageCoord imagePt = sensorModel->groundToImage(groundPt, 0.001); EXPECT_NEAR(imagePt.line, 500.0, 1e-3); EXPECT_NEAR(imagePt.samp, 500.0, 1e-3); @@ -100,7 +99,7 @@ TEST_F(SarSensorModel, imageToProximateImagingLocus) { 0.001, &precision, &warnings); - EXPECT_NEAR(locus.point.x, 1737388.1260092105, 1e-2); + EXPECT_NEAR(locus.point.x, 1737388.1411342232, 1e-2); EXPECT_NEAR(locus.point.y, -5403.0102509726485, 1e-2); EXPECT_NEAR(locus.point.z, -3749.9801945280433, 1e-2); EXPECT_NEAR(locus.direction.x, 0.002701478402694769, 1e-5);