Unverified Commit b2ea3a26 authored by Jesse Mapel's avatar Jesse Mapel Committed by GitHub
Browse files

Added adjustable focal length back (#258)

* Added adjustable focal length back

* Added adjustable focal length test

* Better test
parent 2c0738a1
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -1994,7 +1994,8 @@ void UsgsAstroLsSensorModel::losToEcf(

  // Define imaging ray (look vector) in camera space
   double cameraLook[3];
   createCameraLookVector(undistortedFocalPlaneX, undistortedFocalPlaneY, m_zDirection, m_focalLength, cameraLook);
   createCameraLookVector(undistortedFocalPlaneX, undistortedFocalPlaneY,
                          m_zDirection, m_focalLength + getValue(15, adj), cameraLook);
   MESSAGE_LOG(m_logger, "losToEcf: uncorrected camera look vector {} {} {}",
                         cameraLook[0], cameraLook[1], cameraLook[2])

@@ -2501,7 +2502,7 @@ csm::ImageCoord UsgsAstroLsSensorModel::computeViewingPixel(
                                adjustedLookX, adjustedLookY, adjustedLookZ)

   // Convert to focal plane coordinate
   double lookScale = m_focalLength / adjustedLookZ;
   double lookScale = (m_focalLength  + getValue(15, adj)) / adjustedLookZ;
   double focalX = adjustedLookX * lookScale;
   double focalY = adjustedLookY * lookScale;
   double distortedFocalX, distortedFocalY;
+9 −0
Original line number Diff line number Diff line
@@ -252,3 +252,12 @@ TEST_F(OrbitalLineScanSensorModel, ReferenceDateTime) {
  std::string date = sensorModel->getReferenceDateAndTime();
  EXPECT_EQ(date, "20000101T001639");
}

TEST_F(ConstVelocityLineScanSensorModel, FocalLengthAdjustment) {
  csm::ImageCoord imagePt(8.5, 4.0);
  sensorModel->setParameterValue(15, -45);
  csm::EcefLocus locus = sensorModel->imageToRemoteImagingLocus(imagePt);
  EXPECT_DOUBLE_EQ(locus.direction.x, -5.0 / sqrt(5 * 5 + 0.4 * 0.4));
  EXPECT_DOUBLE_EQ(locus.direction.y, -0.4 / sqrt(5 * 5 + 0.4 * 0.4));
  EXPECT_DOUBLE_EQ(locus.direction.z, 0.0);
}