9#include "NewHorizonsLorriDistortionMap.h"
10#include "CameraFocalPlaneMap.h"
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)) {
Distort/undistort focal plane coordinates.
double p_focalPlaneX
Distorted focal plane x.
double p_undistortedFocalPlaneX
Undistorted focal plane x.
double p_undistortedFocalPlaneY
Undistorted focal plane y.
double p_focalPlaneY
Distorted focal plane y.
NewHorizonsLorriDistortionMap(Camera *parent, double e2, double e5, double e6, double zDirection=1.0)
Constructs a Distortion Map object for the New Horizons LORRI Camera.
bool SetUndistortedFocalPlane(const double dx, const double dy)
Compute distorted focal plane x/y.
bool SetFocalPlane(const double ux, const double uy)
Compute undistorted focal plane x/y.
This is free and unencumbered software released into the public domain.
Namespace for the standard library.