Skip to content

Commit

Permalink
Changed csm camera to save look on non-intersection
Browse files Browse the repository at this point in the history
  • Loading branch information
jessemapel committed Jun 28, 2021
1 parent 467b098 commit 0521e1c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
18 changes: 11 additions & 7 deletions isis/src/base/objs/CSMCamera/CSMCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();
}
Expand Down
12 changes: 12 additions & 0 deletions isis/tests/CSMCameraTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0521e1c

Please sign in to comment.