diff --git a/include/ale/Distortion.h b/include/ale/Distortion.h index 4372766ec335c5190a61461c2ff5e3601371111a..dd2aa4aec062485c0320165e9c54c42553745a18 100644 --- a/include/ale/Distortion.h +++ b/include/ale/Distortion.h @@ -9,7 +9,8 @@ namespace ale { DAWNFC, LROLROCNAC, CAHVOR, - LUNARORBITER + LUNARORBITER, + RADTAN }; } diff --git a/src/Util.cpp b/src/Util.cpp index 52e08007587fe0d980452d67701ba69a664aa50b..8afcfa1644539fdfcf85a3410a848a1df919a4fb 100644 --- a/src/Util.cpp +++ b/src/Util.cpp @@ -342,9 +342,9 @@ double getSemiMinorRadius(json isd) { // type. Defaults to transverse DistortionType getDistortionModel(json isd) { 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(); @@ -362,6 +362,8 @@ DistortionType getDistortionModel(json isd) { return DistortionType::CAHVOR; } else if (distortion.compare("lunarorbiter") == 0) { return DistortionType::LUNARORBITER; + } else if (distortion.compare("radtan") == 0) { + return DistortionType::RADTAN; } } catch (...) { throw std::runtime_error("Could not parse the distortion model."); @@ -528,6 +530,20 @@ std::vector<double> getDistortionCoeffs(json isd) { coefficients = std::vector<double>(4, 0.0); } } break; + case DistortionType::RADTAN: { + try { + coefficients = isd.at("optical_distortion") + .at("radtan") + .at("coefficients") + .get<std::vector<double>>(); + + return coefficients; + } catch (...) { + throw std::runtime_error( + "Could not parse the radtan distortion model coefficients."); + coefficients = std::vector<double>(5, 0.0); + } + } break; } throw std::runtime_error( "Could not parse the distortion model coefficients.");