13#include <boost/foreach.hpp>
16#include "LroWideAngleCameraDistortionMap.h"
37 QString odkkey =
"INS" +
toString(naifIkCode) +
"_OD_K";
38 for (
int i = 0; i < 3; ++i) {
60 QString odkkey =
"INS" + QString::number(naifIkCode) +
"_OD_K";
62 std::vector<double> v_odk;
63 for(
int i = 0; i < 3; i++) {
67 m_odkFilters.push_back(v_odk);
84 if ( (vband <= 0) || (vband > m_odkFilters.size()) ) {
85 QString mess =
"Invalid band (" + QString::number(vband) +
" requested " +
86 " Must be <= " + QString::number(m_odkFilters.size());
91 p_odk = m_odkFilters[vband-1];
113 double dk1 =
p_odk[0];
114 double dk2 =
p_odk[1];
115 double dk3 =
p_odk[2];
117 double rr = dx * dx + dy * dy;
119 double dr = 1.0 + dk1 * rr + dk2 * rr * rr + dk3 * rr * rr * rr;
123 if ( dr == 0.0 )
return false;
154 double xdistorted, ydistorted;
155 double xprevious, yprevious;
157 xprevious = 1000000.0;
158 yprevious = 1000000.0;
161 double tolerance = 1.0e-6;
163 bool bConverged =
false;
165 double dk1 =
p_odk[0];
166 double dk2 =
p_odk[1];
167 double dk3 =
p_odk[2];
172 for(
int i = 0; i < 50; i++) {
173 rr = xt * xt + yt * yt;
175 dr = 1.0 + dk1 * rr + dk2 * rr * rr + dk3 * rr * rr * rr;
186 if((fabs(xt - xprevious) <= tolerance) && (fabs(yt - yprevious) <= tolerance)) {
Distort/undistort focal plane coordinates.
double p_focalPlaneX
Distorted focal plane x.
double p_undistortedFocalPlaneX
Undistorted focal plane x.
std::vector< double > p_odk
Vector of distortion coefficients.
double p_undistortedFocalPlaneY
Undistorted focal plane y.
Camera * p_camera
The camera to distort/undistort.
double p_focalPlaneY
Distorted focal plane y.
@ Programmer
This error is for when a programmer made an API call that was illegal.
void setBand(int vband)
Implements band-dependant distortion parameters.
virtual bool SetFocalPlane(const double dx, const double dy)
Compute undistorted focal plane x/y.
void addFilter(int naifIkCode)
Add an additional set of parameters for a given LROC/WAC filter.
LroWideAngleCameraDistortionMap(Camera *parent, int naifIkCode)
Camera distortion map constructor.
virtual bool SetUndistortedFocalPlane(const double ux, const double uy)
Compute distorted focal plane x/y.
SpiceDouble getDouble(const QString &key, int index=0)
This returns a value from the NAIF text pool.
This is free and unencumbered software released into the public domain.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Namespace for the standard library.