From 6e8db600062498a47d8fc757f2eedd126736d825 Mon Sep 17 00:00:00 2001 From: Jesse Mapel <jmapel@usgs.gov> Date: Wed, 4 May 2022 13:40:05 -0700 Subject: [PATCH] Clipped push frame search to within the image --- .../usgscsm/UsgsAstroPushFrameSensorModel.h | 4 ---- src/UsgsAstroPushFrameSensorModel.cpp | 24 +++---------------- 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/include/usgscsm/UsgsAstroPushFrameSensorModel.h b/include/usgscsm/UsgsAstroPushFrameSensorModel.h index 6d763bd..47ec118 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 e708642..f8ea148 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 { -- GitLab