137 m_simultaneousMeasure->setImage();
140 std::vector<double> camPositionJ2K
141 = m_simultaneousMeasure->camera()->instrumentPosition()->Coordinate();
144 std::vector<double> camPositionBodyFixed
145 = m_simultaneousMeasure->camera()->bodyRotation()->ReferenceVector(camPositionJ2K);
149 std::vector<double> pointBodyFixed(3);
150 pointBodyFixed[0] = adjustedSurfacePoint.GetX().
kilometers();
151 pointBodyFixed[1] = adjustedSurfacePoint.GetY().
kilometers();
152 pointBodyFixed[2] = adjustedSurfacePoint.GetZ().
kilometers();
155 m_dX = camPositionBodyFixed[0] - pointBodyFixed[0];
156 m_dY = camPositionBodyFixed[1] - pointBodyFixed[1];
157 m_dZ = camPositionBodyFixed[2] - pointBodyFixed[2];
162 QString msg =
"In BundleLidarRangeConstraint::computeRange(): "
163 "m_rangeComputed must be positive\n";
187 if (m_simultaneousMeasure->isRejected()) {
192 m_simultaneousMeasure->setImage();
195 double scaledTime = m_simultaneousMeasure->camera()->instrumentPosition()->scaledTime();
205 int positionBlockIndex = m_simultaneousMeasure->observationIndex();
209 if (!isisObservation) {
210 QString msg =
"Failed to cast BundleObservation to IsisBundleObservation when applying "
211 "lidar constraint (Point Id: "
212 + m_simultaneousMeasure->parentControlPoint()->id() +
", Measure Serial:"
213 + m_simultaneousMeasure->cubeSerialNumber() +
").\n";
216 int numPositionParameters = isisObservation->numberPositionParameters();
217 if ((
int) coeff_range_image.size2() != numPositionParameters) {
218 coeff_range_image.resize(1, numPositionParameters,
false);
221 coeff_range_image.clear();
222 coeff_range_point3D.clear();
223 coeff_range_RHS.clear();
226 std::vector<double> matrixTargetToJ2K =
227 m_simultaneousMeasure->camera()->bodyRotation()->Matrix();
229 double m11 = matrixTargetToJ2K[0];
230 double m12 = matrixTargetToJ2K[1];
231 double m13 = matrixTargetToJ2K[2];
232 double m21 = matrixTargetToJ2K[3];
233 double m22 = matrixTargetToJ2K[4];
234 double m23 = matrixTargetToJ2K[5];
235 double m31 = matrixTargetToJ2K[6];
236 double m32 = matrixTargetToJ2K[7];
237 double m33 = matrixTargetToJ2K[8];
246 int numPositionParametersPerCoordinate = numPositionParameters/3;
248 for (
int i = 0; i < numPositionParametersPerCoordinate; i++) {
249 coeff_range_image(0,index) = a1*c;
256 for (
int i = 0; i < numPositionParametersPerCoordinate; i++) {
257 coeff_range_image(0,index) = a2*c;
264 for (
int i = 0; i < numPositionParametersPerCoordinate; i++) {
265 coeff_range_image(0,index) = a3*c;
275 double sinlat = sin(lat);
276 double coslat = cos(lat);
277 double sinlon = sin(lon);
278 double coslon = cos(lon);
281 coeff_range_point3D(0,0)
283 coeff_range_point3D(0,1)
285 coeff_range_point3D(0,2)
298 matrix_range<LinearAlgebra::Matrix> normal_range(
299 *(*normalsMatrix[positionBlockIndex])[positionBlockIndex],
300 range(0, coeff_range_image.size2()),
301 range(0, coeff_range_image.size2()));
303 normal_range += prod(trans(coeff_range_image), coeff_range_image);
306 matrix_range<LinearAlgebra::Matrix> N12_range(
307 *N12[positionBlockIndex],
308 range(0, coeff_range_image.size2()),
309 range(0, coeff_range_point3D.size2()));
311 N12_range += prod(trans(coeff_range_image), coeff_range_point3D);
314 int startColumn = normalsMatrix.at(positionBlockIndex)->startColumn();
315 vector_range<LinearAlgebra::VectorCompressed >
316 n1_range (n1, range (startColumn, startColumn+coeff_range_image.size2()));
318 n1_range += prod(trans(coeff_range_image), coeff_range_RHS);
321 N22 += prod(trans(coeff_range_point3D), coeff_range_point3D);
324 n2 += prod(trans(coeff_range_point3D), coeff_range_RHS);