Commit 0521e1cc authored by Jesse Mapel's avatar Jesse Mapel Committed by Jesse Mapel
Browse files

Changed csm camera to save look on non-intersection

parent 467b0983
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -121,11 +121,14 @@ namespace Isis {
   * @returns @b bool If the image coordinate was set successfully
   */
  bool CSMCamera::SetImage(const double sample, const double line) {
    // Save off the line & sample
    p_childSample = sample;
    p_childLine = line;

    csm::ImageCoord imagePt;
    isisToCsmPixel(p_alphaCube->AlphaLine(line), p_alphaCube->AlphaSample(sample), imagePt);
    double achievedPrecision = 0;
    csm::WarningList warnings;

    csm::EcefLocus imageLocus;
    try {
      imageLocus = m_model->imageToRemoteImagingLocus(imagePt,
@@ -156,18 +159,19 @@ namespace Isis {
    std::vector<double> locusVec = {imageLocus.direction.x,
                                    imageLocus.direction.y,
                                    imageLocus.direction.z};
    if(!target()->shape()->intersectSurface(obsPosition, locusVec)) {
      return false;
    }

    // If we are here then everything went well so save the pixel and return true
    // Save off the look vector
    m_lookB[0] = locusVec[0];
    m_lookB[1] = locusVec[1];
    m_lookB[2] = locusVec[2];
    m_newLookB = true;

    // Check for a ground intersection
    if(!target()->shape()->intersectSurface(obsPosition, locusVec)) {
      return false;
    }

    p_pointComputed = true;
    p_childSample = sample;
    p_childLine = line;
    if (!m_et) {
      m_et = new iTime();
    }
+12 −0
Original line number Diff line number Diff line
@@ -44,6 +44,18 @@ TEST_F(CSMCameraFixture, SetImage) {
}


TEST_F(CSMCameraFixture, SetImageNoIntersect) {
  csm::Ellipsoid wgs84;
  EXPECT_CALL(mockModel, imageToRemoteImagingLocus(MatchImageCoord(csm::ImageCoord(4.5, 4.5)), ::testing::_, ::testing::_, ::testing::_))
      .Times(1)
      // looking straight down X-Axis
      .WillOnce(::testing::Return(csm::EcefLocus(wgs84.getSemiMajorRadius() + 50000, 0, 0, 0, 1, 0)));

  EXPECT_FALSE(testCam->SetImage(5, 5));
  EXPECT_THAT(testCam->lookDirectionBodyFixed(), ::testing::ElementsAre(0.0, 1.0, 0.0));
}


TEST_F(CSMCameraDemFixture, SetImage) {
  EXPECT_CALL(mockModel, imageToRemoteImagingLocus(MatchImageCoord(csm::ImageCoord(4.5, 4.5)), ::testing::_, ::testing::_, ::testing::_))
      .Times(1)