Go to the documentation of this file.00001
00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00003 #pragma implementation
00004 #endif
00005
00006
00007
00008
00009 #include "mvl_six_point_design_matrix_row.h"
00010
00011 #include <vcl_cmath.h>
00012
00013 void mvl_six_point_design_matrix_row(vnl_matrix<double> const &A,
00014 vnl_matrix<double> const &B,
00015 double u, double v,
00016 double out_row[5])
00017 {
00018
00019 double CA[2][4], CB[2][4];
00020 for (int j=0; j<4; ++j) {
00021 CA[0][j] = A[0][j] - u * A[2][j];
00022 CA[1][j] = A[1][j] - v * A[2][j];
00023
00024
00025 CB[0][j] = B[0][j] - u * B[2][j];
00026 CB[1][j] = B[1][j] - v * B[2][j];
00027
00028 }
00029
00030
00031 {
00032 double nn = 0;
00033 for (int i=0; i<2; ++i)
00034 for (int j=0; j<4; ++j)
00035 nn += CA[i][j] * CA[i][j] + CB[i][j] * CB[i][j];
00036 nn = vcl_sqrt(nn);
00037
00038 for (int i=0; i<2; ++i) {
00039 for (int j=0; j<4; ++j) {
00040 CA[i][j] /= nn;
00041 CB[i][j] /= nn;
00042 }
00043 }
00044 }
00045
00046
00047
00048
00049
00050 double Q[4][4];
00051 for (int r=0; r<4; ++r)
00052 for (int s=0; s<4; ++s)
00053 Q[r][s] = CA[0][r]*CB[1][s] - CA[1][r]*CB[0][s];
00054
00055
00056
00057
00058
00059
00060 out_row[0] = Q[0][1] + Q[1][0];
00061 out_row[1] = Q[0][2] + Q[2][0];
00062 out_row[2] = Q[1][2] + Q[2][1];
00063 out_row[3] = Q[1][3] + Q[3][1];
00064 out_row[4] = Q[2][3] + Q[3][2];
00065 }