8000 Frame cam no bounds by jrcain-usgs · Pull Request #492 · DOI-USGS/usgscsm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Frame cam no bounds #492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ release.
## [Unreleased]

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

## [2.0.1] - 2024-01-23
Expand Down
2 changes: 1 addition & 1 deletion include/usgscsm/UsgsAstroFrameSensorModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class UsgsAstroFrameSensorModel : public csm::RasterGM,
*
* @return @b csm::EcefCoord Returns the body-fixed sensor position.
*
* @throw csm::Error::BOUNDS "Image coordinate () out of bounds."
* @throw csm::Error::BOUNDS "Image time () out of bounds."
*/
virtual csm::EcefCoord getSensorPosition(
const csm::ImageCoord &imagePt) const;
Expand Down
25 changes: 6 additions & 19 deletions src/UsgsAstroFrameSensorModel.cpp 8000
Original file line number Diff line number Diff line change
Expand Up @@ -503,26 +503,13 @@ csm::EcefCoord UsgsAstroFrameSensorModel::getSensorPosition(
spdlog::level::debug,
"Accessing sensor position for image point {}, {}",
imagePt.line, imagePt.samp);
// check if the image point is in range
if (imagePt.samp >= m_startingDetectorSample &&
imagePt.samp <= (m_startingDetectorSample + m_nSamples) &&
imagePt.line >= m_startingDetectorSample &&
imagePt.line <= (m_startingDetectorLine + m_nLines)) {
csm::EcefCoord sensorPosition;
sensorPosition.x = m_currentParameterValue[0];
sensorPosition.y = m_currentParameterValue[1];
sensorPosition.z = m_currentParameterValue[2];

csm::EcefCoord sensorPosition;
sensorPosition.x = m_currentParameterValue[0];
sensorPosition.y = m_currentParameterValue[1];
sensorPosition.z = m_currentParameterValue[2];

return sensorPosition;
} else {
MESSAGE_LOG(
spdlog::level::err,
"ERROR: UsgsAstroFrameSensorModel::getSensorPosition: "
"Image Coordinate {},{} out of Bounds",
imagePt.line, imagePt.samp);
throw csm::Error(csm::Error::BOUNDS, "Image Coordinate out of Bounds",
"UsgsAstroFrameSensorModel::getSensorPosition");
}
return sensorPosition;
}

csm::EcefCoord UsgsAstroFrameSensorModel::getSensorPosition(double time) const {
Expand Down
8 changes: 8 additions & 0 deletions tests/FrameCameraTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,14 @@ TEST_F(FrameSensorModelLogging, GetSensorPositionPixel) {
sensorModel->getSensorPosition(imagePt);
}

TEST_F(FrameSensorModelLogging, GetSensorPositionPixelExceedsBounds) {
csm::ImageCoord imagePt(-1, -1);
csm::EcefCoord sensorPos = sensorModel->getSensorPosition(imagePt);
EXPECT_EQ(sensorPos.x, 1000);
EXPECT_EQ(sensorPos.y, 0);
EXPECT_EQ(sensorPos.z, 0);
}

TEST_F(FrameSensorModelLogging, GetSensorPositionTime) {
csm::ImageCoord imagePt(7.5, 7.5);
double time = sensorModel->getImageTime(imagePt);
Expand Down
Loading
0