9 #include "NewHorizonsLorriDistortionMap.h"
10 #include "CameraFocalPlaneMap.h"
30 NewHorizonsLorriDistortionMap::NewHorizonsLorriDistortionMap(
Camera *parent,
double e2,
double e5,
60 double rr = x * x + y * y;
74 double dr = 1.0 - rr * p_e2 - y * p_e5 - x * p_e6;
106 double xx, yy, xy, rr;
107 double xdistortion, ydistortion;
108 double xdistorted, ydistorted;
109 double xprevious, yprevious;
111 xprevious = 1000000.0;
112 yprevious = 1000000.0;
114 double tolerance = 0.000001;
116 bool bConverged =
false;
121 for (
int i = 0; i < 50; i++) {
128 xdistortion = xt * rr * p_e2 + xy * p_e5 + xx * p_e6;
129 ydistortion = yt * rr * p_e2 + yy * p_e5 + xy * p_e6;
133 xt = ux + xdistortion;
134 yt = uy + ydistortion;
141 if ((fabs(xt - xprevious) <= tolerance) && (fabs(yt - yprevious) <= tolerance)) {