Skip to content
Snippets Groups Projects
Commit 6318b8bd authored by Oleg Alexandrov's avatar Oleg Alexandrov
Browse files

Sync up with ale

parent a055c42b
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,9 @@
#include <tuple>
#include <vector>
enum DistortionType { RADIAL, TRANSVERSE, KAGUYALISM, DAWNFC, LROLROCNAC, CAHVOR, RADTAN };
// This should be synched with the enum in ale/Distortion.h
enum DistortionType { RADIAL, TRANSVERSE, KAGUYALISM, DAWNFC, LROLROCNAC, CAHVOR,
LUNARORBITER, RADTAN };
// Transverse distortion Jacobian
void transverseDistortionJacobian(double x, double y, double *jacobian,
......@@ -23,6 +25,7 @@ void removeDistortion(double dx, double dy, double &ux, double &uy,
void applyDistortion(double ux, double uy, double &dx, double &dy,
std::vector<double> const& opticalDistCoeffs,
DistortionType distortionType,
const double desiredPrecision = 1.0E-6,
const double desiredPrecisio
n = 1.0E-6,
const double tolerance = 1.0E-6);
#endif // INCLUDE_USGSCSM_DISTORTION_H_
......@@ -1060,9 +1060,9 @@ double getSemiMinorRadius(json isd, csm::WarningList *list) {
// type. Defaults to transverse
DistortionType getDistortionModel(json isd, csm::WarningList *list) {
try {
json distoriton_subset = isd.at("optical_distortion");
json distortion_subset = isd.at("optical_distortion");
json::iterator it = distoriton_subset.begin();
json::iterator it = distortion_subset.begin();
std::string distortion = (std::string)it.key();
......@@ -1076,6 +1076,12 @@ DistortionType getDistortionModel(json isd, csm::WarningList *list) {
return DistortionType::DAWNFC;
} else if (distortion.compare("lrolrocnac") == 0) {
return DistortionType::LROLROCNAC;
} else if (distortion.compare("cahvor") == 0) {
return DistortionType::CAHVOR;
} else if (distortion.compare("lunarorbiter") == 0) {
return DistortionType::LUNARORBITER;
} else if (distortion.compare("radtan") == 0) {
return DistortionType::RADTAN;
}
} catch (...) {
if (list) {
......@@ -1105,6 +1111,10 @@ DistortionType getDistortionModel(int aleDistortionModel,
return DistortionType::LROLROCNAC;
}else if (aleDistortionType == ale::DistortionType::CAHVOR) {
return DistortionType::CAHVOR;
}else if (aleDistortionType == ale::DistortionType::LUNARORBITER) {
return DistortionType::LUNARORBITER;
}else if (aleDistortionType == ale::DistortionType::RADTAN) {
return DistortionType::RADTAN;
}
} catch (...) {
if (list) {
......@@ -1263,7 +1273,26 @@ std::vector<double> getDistortionCoeffs(json isd, csm::WarningList *list) {
coefficients = std::vector<double>(6, 0.0);
}
} break;
case DistortionType::RADTAN: {
try {
coefficients = isd.at("optical_distortion")
.at("radtan")
.at("coefficients")
.get<std::vector<double>>();
return coefficients;
} catch (...) {
if (list) {
list->push_back(csm::Warning(
csm::Warning::DATA_NOT_AVAILABLE,
"Could not parse the radtan distortion model coefficients.",
"Utilities::getDistortion()"));
}
coefficients = std::vector<double>(5, 0.0);
}
} break;
}
if (list) {
list->push_back(
csm::Warning(csm::Warning::DATA_NOT_AVAILABLE,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment