35 int startFramelet = 1;
38 int endFramelet = detectorMap->TotalFramelets();
41 bool minimizedSpacecraftDist =
false;
43 for (
int j = 0; j < 30 && !minimizedSpacecraftDist;j++) {
44 int deltaX = abs(startFramelet - endFramelet) / 2;
53 double biasFactor = startDist / endDist;
55 if (biasFactor < 1.0) {
56 biasFactor = -1.0 / biasFactor;
57 biasFactor = -(biasFactor + 1) / biasFactor;
60 biasFactor = std::min(biasFactor + 0.50, 0.0);
63 biasFactor = (biasFactor - 1) / biasFactor;
66 biasFactor = std::max(biasFactor - 0.50, 0.0);
69 int middleFramelet = startFramelet + (int)(deltaX + biasFactor * deltaX);
72 if (startDist > endDist) {
74 if (startFramelet == middleFramelet) middleFramelet++;
75 startFramelet = middleFramelet;
76 startDist = middleDist;
79 endFramelet = middleFramelet;
83 if (startFramelet == endFramelet) {
84 minimizedSpacecraftDist =
true;
88 if (!minimizedSpacecraftDist) {
92 int realFramelet = startFramelet;
93 bool frameletEven = (realFramelet % 2 == 0);
94 bool timeAscendingFramelets = detectorMap->timeAscendingFramelets();
104 double realDist =
FindDistance(realFramelet, surfacePoint);
105 int guessFramelet = realFramelet + direction;
106 double guessDist =
FindDistance(guessFramelet, surfacePoint);
108 if (guessDist > realDist) {
109 direction = -1 * direction;
110 guessFramelet = realFramelet + direction;
114 for (
int j = 0; (realDist >= guessDist) && (j < 30);j++) {
115 realFramelet = guessFramelet;
116 realDist = guessDist;
118 guessFramelet = realFramelet + direction;
121 if (realFramelet <= 0 || realFramelet > detectorMap->TotalFramelets()) {
126 detectorMap->SetFramelet(realFramelet);
152 detectorMap->SetFramelet(framelet);
153 if(!
p_camera->Sensor::SetGround(surfacePoint,
false))
return DBL_MAX;
156 p_camera->Sensor::LookDirection(lookC);
160 if(!distortionMap->SetUndistortedFocalPlane(ux, uy))
return DBL_MAX;
162 double dx = distortionMap->FocalPlaneX();
163 double dy = distortionMap->FocalPlaneY();
166 if(!focalMap->SetFocalPlane(dx, dy))
return DBL_MAX;
168 detectorMap->
SetDetector(focalMap->DetectorSample(), focalMap->DetectorLine());
170 double actualFrameletHeight = detectorMap->frameletHeight() / detectorMap->LineScaleFactor();
171 double frameletDeltaY = detectorMap->frameletLine() - (actualFrameletHeight / 2.0);
173 return frameletDeltaY * frameletDeltaY;