Skip to content

Commit 7349d46

Browse files
authored
Frame cam no bounds (#492)
* removed pixel boundary check from frame sensor model * docstring edit * test for pixel exceeding bounds * changelog entry frame sensor model no bounds * better test with EQ checks
1 parent 9a5744c commit 7349d46

File tree

4 files changed

+16
-20
lines changed

4 files changed

+16
-20
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ release.
3636
## [Unreleased]
3737

3838
### Fixed
39+
- Removed boundary checks for Frame Sensor Model getSensorPosition [#492](https://github.com/DOI-USGS/usgscsm/pull/492)
3940
- Fixed CAHVOR model optical shifts by removing tolerance check [#488](https://github.com/DOI-USGS/usgscsm/issues/488)
4041

4142
## [2.0.1] - 2024-01-23

include/usgscsm/UsgsAstroFrameSensorModel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class UsgsAstroFrameSensorModel : public csm::RasterGM,
118118
*
119119
* @return @b csm::EcefCoord Returns the body-fixed sensor position.
120120
*
121-
* @throw csm::Error::BOUNDS "Image coordinate () out of bounds."
121+
* @throw csm::Error::BOUNDS "Image time () out of bounds."
122122
*/
123123
virtual csm::EcefCoord getSensorPosition(
124124
const csm::ImageCoord &imagePt) const;

src/UsgsAstroFrameSensorModel.cpp

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -723,26 +723,13 @@ csm::EcefCoord UsgsAstroFrameSensorModel::getSensorPosition(
723723
spdlog::level::debug,
724724
"Accessing sensor position for image point {}, {}",
725725
imagePt.line, imagePt.samp);
726-
// check if the image point is in range
727-
if (imagePt.samp >= m_startingDetectorSample &&
728-
imagePt.samp <= (m_startingDetectorSample + m_nSamples) &&
729-
imagePt.line >= m_startingDetectorSample &&
730-
imagePt.line <= (m_startingDetectorLine + m_nLines)) {
731-
csm::EcefCoord sensorPosition;
732-
sensorPosition.x = m_currentParameterValue[0];
733-
sensorPosition.y = m_currentParameterValue[1];
734-
sensorPosition.z = m_currentParameterValue[2];
726+
727+
csm::EcefCoord sensorPosition;
728+
sensorPosition.x = m_currentParameterValue[0];
729+
sensorPosition.y = m_currentParameterValue[1];
730+
sensorPosition.z = m_currentParameterValue[2];
735731

736-
return sensorPosition;
737-
} else {
738-
MESSAGE_LOG(
739-
spdlog::level::err,
740-
"ERROR: UsgsAstroFrameSensorModel::getSensorPosition: "
741-
"Image Coordinate {},{} out of Bounds",
742-
imagePt.line, imagePt.samp);
743-
throw csm::Error(csm::Error::BOUNDS, "Image Coordinate out of Bounds",
744-
"UsgsAstroFrameSensorModel::getSensorPosition");
745-
}
732+
return sensorPosition;
746733
}
747734

748735
/**

tests/FrameCameraTests.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,14 @@ TEST_F(FrameSensorModelLogging, GetSensorPositionPixel) {
531531
sensorModel->getSensorPosition(imagePt);
532532
}
533533

534+
TEST_F(FrameSensorModelLogging, GetSensorPositionPixelExceedsBounds) {
535+
csm::ImageCoord imagePt(-1, -1);
536+
csm::EcefCoord sensorPos = sensorModel->getSensorPosition(imagePt);
537+
EXPECT_EQ(sensorPos.x, 1000);
538+
EXPECT_EQ(sensorPos.y, 0);
539+
EXPECT_EQ(sensorPos.z, 0);
540+
}
541+
534542
TEST_F(FrameSensorModelLogging, GetSensorPositionTime) {
535543
csm::ImageCoord imagePt(7.5, 7.5);
536544
double time = sensorModel->getImageTime(imagePt);

0 commit comments

Comments
 (0)