contrib/oxl/mvl/FMatrixAffine.cxx
Go to the documentation of this file.
00001 // This is oxl/mvl/FMatrixAffine.cxx
00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00003 #pragma implementation
00004 #endif
00005 //:
00006 //  \file
00007 
00008 #include "FMatrixAffine.h"
00009 #include <vcl_cassert.h>
00010 
00011 //--------------------------------------------------------------
00012 //
00013 //: Constructor
00014 FMatrixAffine::FMatrixAffine ()
00015 {
00016 }
00017 
00018 //--------------------------------------------------------------
00019 //
00020 //: Destructor
00021 FMatrixAffine::~FMatrixAffine()
00022 {
00023 }
00024 
00025 //--------------------------------------------------------------
00026 //
00027 //: Set the fundamental matrix using the vnl_matrix f_matrix.
00028 // Only returns true if f_matrix contained a Fundamental
00029 // matrix in the affine form, and not an approximation to one.
00030 // Otherwise returns false and the matrix is not set.
00031 // f_matrix must be 3x3.
00032 
00033 bool FMatrixAffine::set(vnl_matrix<double> const& f_matrix)
00034 {
00035   assert(f_matrix.rows() == 3 && f_matrix.columns() == 3);
00036   for (int row_index = 0; row_index < 3; row_index++)
00037   for (int col_index = 0; col_index < 3; col_index++)
00038   {
00039      f_matrix_.put(row_index, col_index, f_matrix(row_index,col_index));
00040     ft_matrix_.put(col_index, row_index, f_matrix(row_index,col_index));
00041   }
00042   return true;
00043 }
00044 
00045 //--------------------------------------------------------------
00046 //
00047 //: Set the fundamental matrix using the two-dimensional (C-storage) array f_matrix.
00048 // Only returns true if f_matrix contained a Fundamental
00049 // matrix in the affine form, and not an approximation to one.
00050 // Otherwise returns false and the matrix is not set.
00051 // f_matrix must be 3x3, i.e., must contain 9 elements.
00052 
00053 bool FMatrixAffine::set(const double* f_matrix)
00054 {
00055   for (int row_index = 0; row_index < 3; row_index++)
00056   for (int col_index = 0; col_index < 3; col_index++)
00057   {
00058      f_matrix_.put(row_index, col_index, *f_matrix);
00059     ft_matrix_.put(col_index, row_index, *f_matrix++);
00060   }
00061   return true;
00062 }