libNumerics/computeH.cpp
// Add two corresponding lines, type involving at most 4 parameters
Add two corresponding lines, type involving at most 4 parameters
Add two corresponding lines type involving at most 4 parameters
void ComputeH::add_4parameters(float x, float y, float z,
                                float X, float Y, float Z, float w)
{
    double x2 = x*x, y2 = y*y, z2 = z*z, xy = x*y, xz = x*z, yz = y*z;
    double X2 = X*X, Y2 = Y*Y, Z2 = Z*Z, XY = X*Y, XZ = X*Z, YZ = Y*Z;
    double *A = Ann, *B = Bn;
    if(_type == Translation) {
        *A++ += w* X2; 
        *A++ += w* XY; 
        *B++ += w* (yz*XY + xz*X2 - XZ);
        A++;
        *A++ += w* Y2; 
        *B++ += w* (xz*XY + yz*Y2 - YZ);
        b += w* (z2 + Z2 + y2*X2 + x2*Z2 - 2*(xz*XZ + yz*YZ + xy*XZ));
        return;
    }
    b += w* Z2; 
    if(_type == GeneralZoom) {
        *A++ += w* (y2+z2) * X2;
        *A++ -= w* xy * XY;
        *A++ -= w* xz * X2;
        *A++ -= w* xz * XY;
        *B++ += w* xz * XZ;
        A++;
        *A++ += w* (x2+z2) * Y2;
        *A++ -= w* yz * XY;
        *A++ -= w* yz * Y2;
        *B++ += w* yz * YZ;
        A += 2;
        *A++ += w* X2; 
        *A++ += w* XY; 
        *B++ -= w* XZ; 
        A += 3;
        *A++ += w* Y2; 
        *B++ -= w* YZ; 
        return;
    }
    if(_type == Zoom) {
        *A++ += w* (z2 + y2*X2 + x2*Y2 - 2*xy*XY);
        *A++ -= w* (yz*XY + xz*X2);
        *A++ -= w* (yz*Y2 + xz*XY);
        *B++ += w* (yz*YZ + xz*X2);
    } else { 
        *A++ += w* (1 + 2*(z2 - xy)) * X2;
        *A++ += w* (x2 - y2) * XY;
        *A++ -= w* (xz + yz) * X2;
        *A++ -= w* (xz + yz) * XY;
        *B++ += w* (xz + yz) * XZ;
        A++;
        *A++ += w* (1 + 2*(z2 + xy)) * Y2;
        *A++ += w* (xz - yz) * XY;
        *A++ += w* (xz - yz) * Y2;
        *B++ += w* (yz - xz) * YZ;
        A++; 
    }
    A++;
    *A++ += w* X2; 
    *A++ += w* XY; 
    *B++ -= w* XZ; 
    A += n-1;
    *A++ += w* Y2; 
    *B++ -= w* YZ; 
}
void ComputeH :: add_4parameters ( float x , float y , float z , float X , float Y , float Z , float w ) { double x2 = x * x , y2 = y * y , z2 = z * z , xy = x * y , xz = x * z , yz = y * z ; double X2 = X * X , Y2 = Y * Y , Z2 = Z * Z , XY = X * Y , XZ = X * Z , YZ = Y * Z ; double * A = Ann , * B = Bn ; if ( _type == Translation ) { * A ++ += w * X2 ; * A ++ += w * XY ; * B ++ += w * ( yz * XY + xz * X2 - XZ ) ; A ++ ; * A ++ += w * Y2 ; * B ++ += w * ( xz * XY + yz * Y2 - YZ ) ; b += w * ( z2 + Z2 + y2 * X2 + x2 * Z2 - 2 * ( xz * XZ + yz * YZ + xy * XZ ) ) ; return ; } b += w * Z2 ; if ( _type == GeneralZoom ) { * A ++ += w * ( y2 + z2 ) * X2 ; * A ++ -= w * xy * XY ; * A ++ -= w * xz * X2 ; * A ++ -= w * xz * XY ; * B ++ += w * xz * XZ ; A ++ ; * A ++ += w * ( x2 + z2 ) * Y2 ; * A ++ -= w * yz * XY ; * A ++ -= w * yz * Y2 ; * B ++ += w * yz * YZ ; A += 2 ; * A ++ += w * X2 ; * A ++ += w * XY ; * B ++ -= w * XZ ; A += 3 ; * A ++ += w * Y2 ; * B ++ -= w * YZ ; return ; } if ( _type == Zoom ) { * A ++ += w * ( z2 + y2 * X2 + x2 * Y2 - 2 * xy * XY ) ; * A ++ -= w * ( yz * XY + xz * X2 ) ; * A ++ -= w * ( yz * Y2 + xz * XY ) ; * B ++ += w * ( yz * YZ + xz * X2 ) ; } else { * A ++ += w * ( 1 + 2 * ( z2 - xy ) ) * X2 ; * A ++ += w * ( x2 - y2 ) * XY ; * A ++ -= w * ( xz + yz ) * X2 ; * A ++ -= w * ( xz + yz ) * XY ; * B ++ += w * ( xz + yz ) * XZ ; A ++ ; * A ++ += w * ( 1 + 2 * ( z2 + xy ) ) * Y2 ; * A ++ += w * ( xz - yz ) * XY ; * A ++ += w * ( xz - yz ) * Y2 ; * B ++ += w * ( yz - xz ) * YZ ; A ++ ; } A ++ ; * A ++ += w * X2 ; * A ++ += w * XY ; * B ++ -= w * XZ ; A += n - 1 ; * A ++ += w * Y2 ; * B ++ -= w * YZ ; }
Add two corresponding lines, type involving at most 4 parameters
Add two corresponding lines type involving at most 4 parameters
// *(x2+y2=1) // *(x2+y2=1) /* *(x2+y2=1) */ // *(x2+y2=1) /* *(x2+y2=1) */ // *(x2+y2=1) // *(x2+y2=1) // *(x2+y2=1) // *(x2+y2=1) // *(x2+y2=1) // *(x2+y2=1) /* *(X2+Y2=1)*/ // Similarity or Rotation /* =x2+y2*/ /* =x2+y2*/ // Prepare for next line // *(x2+y2=1) // *(x2+y2=1) // *(x2+y2=1) // *(x2+y2=1) // *(x2+y2=1)