Unverified Commit ba0be863 authored by Victor Silva's avatar Victor Silva Committed by GitHub
Browse files

Update Camera.cpp to fix local norm for pushbroom cameras (old PR#4214) (#4340)

* Update Camera.cpp to fix not correctly calculating the local norm

This fixes Camera.cpp not correctly calculating the local norm for pushbroom cameras.
This is in reference to Issue #4018, whereas DBL_MIN is not operating as expected, causing an error later in the code, when integer rounding occurs. This erroneously returns the next/previous framelet. Currently, the DBL_MIN is not operating as expected. The functionality that is intended is:
Calculate normal by grabbing elevation values at the edges of the pixel in question.

Originally the fix was submitted via PR#4214 for branch 3.10.2 but since that branch is no longer active, changes will be submitted to dev.

* Updated Camera.h with comments addressing fix for issue#4018
parent dbfb0048
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -1520,10 +1520,10 @@ namespace Isis {

      // order of points in vector is top, bottom, left, right
      QList< QPair< double, double > > surroundingPoints;
      surroundingPoints.append(qMakePair(samp, line - 0.5));
      surroundingPoints.append(qMakePair(samp, line + 0.5 - DBL_MIN));
      surroundingPoints.append(qMakePair(samp - 0.5, line));
      surroundingPoints.append(qMakePair(samp + 0.5 - DBL_MIN, line));
      surroundingPoints.append(qMakePair(samp, std::nexttoward(line - 0.5, line)));
      surroundingPoints.append(qMakePair(samp, std::nexttoward(line + 0.5, line)));
      surroundingPoints.append(qMakePair(std::nexttoward(samp - 0.5, samp), line));
      surroundingPoints.append(qMakePair(std::nexttoward(samp + 0.5, samp), line));

      // save input state to be restored on return
      double originalSample = samp;
+4 −1
Original line number Diff line number Diff line
@@ -228,6 +228,9 @@ namespace Isis {
   *   @history 2018-07-12 Summer Stapleton - Added m_instrumentId and instrumentId() in order to
   *                           collect the InstrumentId from the original cube label for
   *                           comparisons related to image imports in ipce. References #5460.
   *   @history 2021-03-04 Victor Silva - Made changes to GetLocalNormal to calculate local normal
   *                           accurately for LRO by changing 4 corner surrounding points from adding
   *                           0.5 to line and sample and wrapping value with nexttoward.Fixes #4018.
   */

  class Camera : public Sensor {