diff --git a/include/usgscsm/UsgsAstroPushFrameSensorModel.h b/include/usgscsm/UsgsAstroPushFrameSensorModel.h index 6d763bd2dc0495bd61b1fb4b367b529405fe2e45..47ec118d3361f16bda6137a304a1b418453e6ee7 100644 --- a/include/usgscsm/UsgsAstroPushFrameSensorModel.h +++ b/include/usgscsm/UsgsAstroPushFrameSensorModel.h @@ -941,10 +941,6 @@ class UsgsAstroPushFrameSensorModel : public csm::RasterGM, const std::vector<double>& adj) // Parameter Adjustments for partials const; - double calcSensorDistance(int frameletNumber, - const csm::EcefCoord& groundPt, - const std::vector<double>& adj) const; - // Computes the line distance from the center of a frame to the image point // that a ground point reprojects to at that frame. double calcFrameDistance(int frameletNumber, diff --git a/src/UsgsAstroPushFrameSensorModel.cpp b/src/UsgsAstroPushFrameSensorModel.cpp index e708642816a4c375d2736b624a69dab493f38b7c..f8ea14818236758f711f30c10cb26ee6e5742cea 100644 --- a/src/UsgsAstroPushFrameSensorModel.cpp +++ b/src/UsgsAstroPushFrameSensorModel.cpp @@ -669,6 +669,7 @@ csm::ImageCoord UsgsAstroPushFrameSensorModel::groundToImage( // Secant search for the where the ground point is closest to the middle of the framelet. int summedFrameletHeight = m_frameletHeight / m_detectorLineSumming; + int numFramelets = m_nLines / summedFrameletHeight; int startFramelet = 0; double startDistance = calcFrameDistance(startFramelet, groundPt, adj); int endFramelet = m_nLines / summedFrameletHeight - 1; @@ -680,6 +681,8 @@ csm::ImageCoord UsgsAstroPushFrameSensorModel::groundToImage( startFramelet = endFramelet; startDistance = endDistance; endFramelet = std::round(endFramelet - offset); + // Clip to the image bounds + endFramelet = std::max(0, std::min(numFramelets, endFramelet)); endDistance = calcFrameDistance(endFramelet, groundPt, adj); } @@ -2432,27 +2435,6 @@ csm::EcefVector UsgsAstroPushFrameSensorModel::getSunPosition( } -double UsgsAstroPushFrameSensorModel::calcSensorDistance(int frameletNumber, - const csm::EcefCoord& groundPt, - const std::vector<double>& adj) const { - MESSAGE_LOG( - "Calculating sensor distance for framelet {} " - "at ground point ({}, {}, {})", - frameletNumber, groundPt.x, groundPt.y, groundPt.z) - int summedFrameletHeight = m_frameletHeight / m_detectorLineSumming; - double time = getImageTime(csm::ImageCoord(0.5 + summedFrameletHeight * frameletNumber, 0.0)); - - double xc, yc, zc, vx, vy, vz; - getAdjSensorPosVel(time, adj, xc, yc, zc, vx, vy, vz); - csm::EcefVector sensorToGround(groundPt.x - xc, - groundPt.y - yc, - groundPt.z - zc); - double dist = norm(sensorToGround); - MESSAGE_LOG("Calculated distance is {}", dist); - return dist; -} - - double UsgsAstroPushFrameSensorModel::calcFrameDistance(int frameletNumber, const csm::EcefCoord& groundPt, const std::vector<double>& adj) const {