Commit 1028b665 authored by Jesse Mapel's avatar Jesse Mapel Committed by jlaura
Browse files

Fixed imageToRemoteImagingLocus in LS and a bug with quaternions near the end of images (#201)

parent 3db6e108
Loading
Loading
Loading
Loading
+13 −32
Original line number Diff line number Diff line
@@ -882,36 +882,17 @@ csm::EcefLocus UsgsAstroLsSensorModel::imageToRemoteImagingLocus(
   double* achieved_precision,
   csm::WarningList* warnings) const
{
   // Object ray unit direction at exposure station
   // Exposure station arbitrary for orthos, so set elevation to zero

   // Set esposure station elevation to zero
   double height = 0.0;
   double GND_DELTA = m_gsd;
   // Point on object ray at zero elevation
   csm::EcefCoord gp1 = imageToGround(
      image_pt, height, desired_precision, achieved_precision, warnings);

   // Unit vector along object ray
   csm::EcefCoord gp2 = imageToGround(
      image_pt, height - GND_DELTA, desired_precision, achieved_precision, warnings);

   double dx2, dy2, dz2;
   dx2 = gp2.x - gp1.x;
   dy2 = gp2.y - gp1.y;
   dz2 = gp2.z - gp1.z;
   double mag2 = sqrt(dx2 * dx2 + dy2 * dy2 + dz2 * dz2);
   dx2 /= mag2;
   dy2 /= mag2;
   dz2 /= mag2;

   // Locus
  double vx, vy, vz;
  csm::EcefLocus locus;
   locus.point = gp1;
   locus.direction.x = dx2;
   locus.direction.y = dy2;
   locus.direction.z = dz2;

  losToEcf(
    image_pt.line, image_pt.samp, _no_adjustment,
    locus.point.x, locus.point.y, locus.point.z,
    vx, vy, vz,
    locus.direction.x, locus.direction.y, locus.direction.z);
  // losToEcf computes the negative look vector, so negate it
  locus.direction.x = -locus.direction.x;
  locus.direction.y = -locus.direction.y;
  locus.direction.z = -locus.direction.z;
  return locus;
}

@@ -1603,7 +1584,7 @@ void UsgsAstroLsSensorModel::getQuaternions(const double& time, double q[4]) con
  if (m_numQuaternions < 6 && nOrder == 8)
     nOrderQuat = 4;
  lagrangeInterp(
     m_numQuaternions, &m_quaternions[0], m_t0Quat, m_dtQuat, time, 4, nOrderQuat, q);
     m_numQuaternions/4, &m_quaternions[0], m_t0Quat, m_dtQuat, time, 4, nOrderQuat, q);
}


+1 −1
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ TEST_F(ConstVelocityLineScanSensorModel, RemoteImageLocus) {
   EXPECT_DOUBLE_EQ(locus.direction.x, -1.0);
   EXPECT_DOUBLE_EQ(locus.direction.y,  0.0);
   EXPECT_DOUBLE_EQ(locus.direction.z,  0.0);
   EXPECT_DOUBLE_EQ(locus.point.x,     10.0);
   EXPECT_DOUBLE_EQ(locus.point.x,      1000.0);
   EXPECT_DOUBLE_EQ(locus.point.y,      0.0);
   EXPECT_DOUBLE_EQ(locus.point.z,      0.0);
}