Skip to content
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

CSM Naif Radii #5414

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
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
17 changes: 11 additions & 6 deletions isis/src/base/objs/CSMCamera/CSMCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -771,18 +771,23 @@ void sanitize(std::string &input);

/**
* Set the Target object for the camera model.
*
* If no radii can be found in the label from the naif keywords
* use the radii from the csm model
*
* @param label The label containing information to create the Target from
*/
void CSMCamera::setTarget(Pvl label) {
Target *target = new Target(label);

// get radii from CSM
csm::Ellipsoid targetEllipsoid = csm::SettableEllipsoid::getEllipsoid(m_model);
std::vector<Distance> radii = {Distance(targetEllipsoid.getSemiMajorRadius(), Distance::Meters),
Distance(targetEllipsoid.getSemiMajorRadius(), Distance::Meters),
Distance(targetEllipsoid.getSemiMinorRadius(), Distance::Meters)};
target->setRadii(radii);
if (target->radii().size() == 0) {
// get radii from CSM
csm::Ellipsoid targetEllipsoid = csm::SettableEllipsoid::getEllipsoid(m_model);
std::vector<Distance> radii = {Distance(targetEllipsoid.getSemiMajorRadius(), Distance::Meters),
Comment on lines +783 to +786
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the same as: if no camera model, default to ellipsoid?

Copy link
Collaborator Author

@acpaquette acpaquette Jan 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somewhat, the difference here is in the Target changes where we try to read the radii from the naifwords first. If we can't, we never set the radii so we should pull the radii off the CSM model

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how often are those different?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The isds generated by ALE produce the same semi-major and semi-minor radii but don't capture a third radii if present. For our more common targets (Moon and Mars), the radii are often just a single radii, or a bi-axial ellipsoid. For less common targets, specifically small bodies, we often use a tri-axial radii and that third radii would not be captured by the CSM model

Distance(targetEllipsoid.getSemiMajorRadius(), Distance::Meters),
Distance(targetEllipsoid.getSemiMinorRadius(), Distance::Meters)};
target->setRadii(radii);
}

// Target needs to be able to access the camera to do things like
// compute resolution
Expand Down
15 changes: 15 additions & 0 deletions isis/src/base/objs/Target/Target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,21 @@ namespace Isis {
*m_systemCode = -1;
(*m_systemName).append("THE COSMOS");
}

if (label.hasObject("NaifKeywords")) {
PvlObject naifKeywords = label.findObject("NaifKeywords");
QString m_bodyCode = naifKeywords["BODY_CODE"];
PvlKeyword radiiKey = naifKeywords.findKeyword("BODY" + m_bodyCode + "_RADII");
std::vector<Distance> radii(3, Distance());
radii[0] = Distance(radiiKey[0].toDouble(), Distance::Kilometers);
radii[1] = Distance(radiiKey[1].toDouble(), Distance::Kilometers);
radii[2] = Distance(radiiKey[2].toDouble(), Distance::Kilometers);

setRadii(radii);
}
else {
m_radii.resize(0);
}

m_shape = ShapeModelFactory::create(this, label);
}
Expand Down