Isis 3 Programmer Reference
MocWideAngleDetectorMap.cpp
1 
7 /* SPDX-License-Identifier: CC0-1.0 */
8 
9 #include "MocWideAngleDetectorMap.h"
10 
11 using namespace std;
12 namespace Isis {
18  bool MocWideAngleDetectorMap::SetDetector(const double sample,
19  const double line) {
20  if(!LineScanCameraDetectorMap::SetDetector(sample, line)) return false;
21 
22  if((p_moclab->CrosstrackSumming() == 13) ||
23  (p_moclab->CrosstrackSumming() == 27)) {
24  int detector = (int) sample;
25  if(detector < 1) detector = 1;
26  if(detector >= p_moclab->Detectors()) detector = p_moclab->Detectors() - 1;
27  double samp1 = p_moclab->Sample(detector - 1);
28  double samp2 = p_moclab->Sample(detector);
29  if(samp1 < 0.0) return false;
30  if(samp2 < 0.0) return false;
31 
32  double m = (samp2 - samp1);
33  p_parentSample = m * (sample - detector) + samp2;
34  }
35 
36  return true;
37  }
38 
39 
46  bool MocWideAngleDetectorMap::SetParent(const double sample,
47  const double line) {
48  if(!LineScanCameraDetectorMap::SetParent(sample, line)) return false;
49 
50  // Handle variable summing if necessary
51  if((p_moclab->CrosstrackSumming() == 13) ||
52  (p_moclab->CrosstrackSumming() == 27)) {
53  int isamp = (int) sample;
54  if(isamp < 2) {
55  p_detectorSample = p_moclab->StartDetector(1);
56  p_detectorSample += sample - 1.0;
57  }
58  else if(isamp > p_camera->Samples()) {
59  p_detectorSample = p_moclab->StartDetector(p_camera->Samples());
60  p_detectorSample += sample - p_camera->Samples();
61  }
62  else {
63  int ss = p_moclab->StartDetector(isamp - 1);
64  int es = p_moclab->EndDetector(isamp - 1);
65  double samp1 = (ss + es) / 2.0;
66 
67  ss = p_moclab->StartDetector(isamp);
68  es = p_moclab->EndDetector(isamp);
69  double samp2 = (ss + es) / 2.0;
70 
71  double m = (samp2 - samp1);
72  p_detectorSample = m * (sample - isamp) + samp1;
73  }
74  }
75  return true;
76  }
77 }
std
Namespace for the standard library.
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16