40 RadarSlantRangeMap::RadarSlantRangeMap(
Camera *parent,
double groundRangeResolution) :
45 p_a[0] = p_a[1] = p_a[2] = p_a[3] = 0.0;
72 double slantRange = p_a[0] + p_a[1] * dx + p_a[2] * dx * dx + p_a[3] * dx * dx * dx;
94 if (fabs(slant-p_a[0]) < p_tolerance) {
109 p_initialMinGroundRangeGuess = (slant - p_a[0]) / p_a[1];
110 double minGroundRangeGuess = slant - (p_a[0] + p_initialMinGroundRangeGuess *
111 (p_a[1] + p_initialMinGroundRangeGuess * (p_a[2] + p_initialMinGroundRangeGuess * p_a[3])));
113 p_initialMaxGroundRangeGuess = p_initialMinGroundRangeGuess + minGroundRangeGuess /
114 (p_a[1] + p_initialMinGroundRangeGuess * (2.0 * p_a[2] + p_initialMinGroundRangeGuess *
116 double maxGroundRangeGuess = slant - (p_a[0] + p_initialMaxGroundRangeGuess *
117 (p_a[1] + p_initialMaxGroundRangeGuess * (p_a[2] +
118 p_initialMaxGroundRangeGuess * p_a[3])));
120 p_initialMinGroundRangeGuess = p_initialMaxGroundRangeGuess - 10.0;
121 minGroundRangeGuess = slant - (p_a[0] + p_initialMinGroundRangeGuess *
122 (p_a[1] + p_initialMinGroundRangeGuess * (p_a[2] + p_initialMinGroundRangeGuess * p_a[3])));
126 if ((minGroundRangeGuess < 0.0 && maxGroundRangeGuess < 0.0) ||
127 (minGroundRangeGuess > 0.0 && maxGroundRangeGuess > 0.0)) {
129 int maxBracketIters = 10;
131 float xMin = p_initialMinGroundRangeGuess;
132 float xMax = p_initialMaxGroundRangeGuess;
134 float funcMin = minGroundRangeGuess;
135 float funcMax = maxGroundRangeGuess;
137 for (
int j=0; j<maxBracketIters; j++) {
140 float dist = abs(abs(xMin) - abs(xMax));
144 if (abs(funcMin) <= abs(funcMax)) {
146 xMin = xMax - 2*dist;
150 xMax = xMin + 2*dist;
153 funcMin = slant -(p_a[0]+ xMin *(p_a[1] + xMin * (p_a[2] + xMin * p_a[3])));
154 funcMax = slant - (p_a[0] + xMax *(p_a[1] + xMax * (p_a[2] + xMax * p_a[3])));
157 if ((funcMin <= 0.0 && funcMax >= 0.0) || (funcMin >= 0.0 && funcMax <= 0.0)){
158 p_initialMinGroundRangeGuess = xMin;
159 p_initialMaxGroundRangeGuess = xMax;
160 minGroundRangeGuess = funcMin;
161 maxGroundRangeGuess = funcMax;
170 if ((minGroundRangeGuess == maxGroundRangeGuess) ||
171 (minGroundRangeGuess < 0.0 && maxGroundRangeGuess < 0.0) ||
172 (minGroundRangeGuess > 0.0 && maxGroundRangeGuess > 0.0)) {
183 double ax = p_initialMinGroundRangeGuess;
184 double bx = p_initialMaxGroundRangeGuess;
185 double fax = minGroundRangeGuess;
186 double fbx = maxGroundRangeGuess;
193 double p, q, r, s, t;
197 if (fbx * fcx > 0.0) {
203 if (fabs(fcx) < fabs(fbx)) {
211 tol1 = 2.0 * eps * fabs(bx) + 0.5 * p_tolerance;
212 xm = 0.5 * (cx - bx);
213 if (fabs(xm) <= tol1 || fbx == 0.0) {
218 if (fabs(e) >= tol1 && fabs(fax) > fabs(fbx)) {
227 p = s * (2.0 * xm * q * (q - r) - (bx - ax) * (r - 1.0));
228 q = (q - 1.0) * (r - 1.0) * (s - 1.0);
232 t = 3.0 * xm * q - fabs(tol1 * q);
233 if (t > fabs(e * q)) t = fabs(e * q);
249 if (fabs(d) > tol1) {
261 fbx = slant - (p_a[0] + bx * (p_a[1] + bx * (p_a[2] + bx * p_a[3])));
263 while (iter <= p_maxIterations);
275 for (
int i = 0; i < seq.
Size(); i++) {
277 std::vector<QString> array = seq[i];
279 utc2et_c(array[0].toLatin1().data(), &et);
280 p_time.push_back(et);
295 double currentEt = p_camera->
time().
Et();
297 std::vector<double>::iterator pos = lower_bound(p_time.begin(), p_time.end(), currentEt);
299 int index = p_time.size() - 1;
300 if (currentEt <= p_time[0]) {
306 else if (currentEt >= p_time.at(index)) {
307 p_a[0] = p_a0[index];
308 p_a[1] = p_a1[index];
309 p_a[2] = p_a2[index];
310 p_a[3] = p_a3[index];
312 index = pos - p_time.begin();
313 double weight = (currentEt - p_time.at(index-1)) /
314 (p_time.at(index) - p_time.at(index-1));
315 p_a[0] = p_a0[index-1] * (1.0 - weight) + p_a0[index] * weight;
316 p_a[1] = p_a1[index-1] * (1.0 - weight) + p_a1[index] * weight;
317 p_a[2] = p_a2[index-1] * (1.0 - weight) + p_a2[index] * weight;
318 p_a[3] = p_a3[index-1] * (1.0 - weight) + p_a3[index] * weight;
326 p_rangeSigma = range_sigma;
327 p_dopplerSigma = doppler_sigma;
void SetWeightFactors(double range_sigma, double doppler_sigma)
Set the weight factors for slant range and Doppler shift.
double p_focalPlaneX
Distorted focal plane x.
Parse and return elements of a Pvl sequence.
void ComputeA()
Set new A-coefficients based on the current ephemeris time.
Namespace for the standard library.
virtual bool SetFocalPlane(const double dx, const double dy)
Set the ground range and compute a slant range.
double toDouble(const QString &string)
Global function to convert from a string to a double.
int Size() const
Number of arrays in the sequence.
double p_undistortedFocalPlaneX
Undistorted focal plane x.
virtual bool SetUndistortedFocalPlane(const double ux, const double uy)
Set the slant range and compute a ground range.
void SetFocalLength(double v)
Sets the focal length.
A single keyword-value pair.
Distort/undistort focal plane coordinates.
double p_focalPlaneY
Distorted focal plane y.
double p_undistortedFocalPlaneY
Undistorted focal plane y.
void SetCoefficients(PvlKeyword &keyword)
Load the ground range/slant range coefficients from the RangeCoefficientSet keyword.
Namespace for ISIS/Bullet specific routines.
double Et() const
Returns the ephemeris time (TDB) representation of the time as a double.
iTime time() const
Returns the ephemeris time in seconds which was used to obtain the spacecraft and sun positions...