Commit 6e8db600 authored by Jesse Mapel's avatar Jesse Mapel Committed by Jesse Mapel
Browse files

Clipped push frame search to within the image

parent ef2ff5d0
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -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,
+3 −21
Original line number Diff line number Diff line
@@ -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 {