core/vpgl/vpgl_affine_fundamental_matrix.txx
Go to the documentation of this file.
00001 // This is core/vpgl/vpgl_affine_fundamental_matrix.txx
00002 #ifndef vpgl_affine_fundamental_matrix_txx_
00003 #define vpgl_affine_fundamental_matrix_txx_
00004 //:
00005 // \file
00006 
00007 #include "vpgl_affine_fundamental_matrix.h"
00008 //
00009 #include <vnl/vnl_matrix_fixed.h>
00010 
00011 //---------------------------------
00012 template <class T>
00013 vpgl_affine_fundamental_matrix<T>::vpgl_affine_fundamental_matrix() :
00014   vpgl_fundamental_matrix<T>()
00015 {
00016   vnl_matrix_fixed<T,3,3> default_matrix( (T)0 );
00017   default_matrix(0,1) = default_matrix(0,2) = (T)1;
00018   default_matrix(1,0) = default_matrix(2,0) = -(T)1;
00019   vpgl_fundamental_matrix<T>::set_matrix( default_matrix );
00020 }
00021 
00022 
00023 //---------------------------------
00024 template <class T>
00025 vpgl_affine_fundamental_matrix<T>::vpgl_affine_fundamental_matrix(
00026   const vpgl_fundamental_matrix<T>& fm )
00027 {
00028   set_from_params( fm.get_matrix()(2,0), fm.get_matrix()(2,1), fm.get_matrix()(2,2),
00029                    fm.get_matrix()(1,2), fm.get_matrix()(0,2) );
00030 }
00031 
00032 
00033 //---------------------------------
00034 template <class T>
00035 void vpgl_affine_fundamental_matrix<T>::set_from_params( T a, T b, T c, T d, T e )
00036 {
00037   vnl_matrix_fixed<T,3,3> fm( (T)0 );
00038   fm.put( 2, 0, a );
00039   fm.put( 2, 1, b );
00040   fm.put( 2, 2, c );
00041   fm.put( 1, 2, d );
00042   fm.put( 0, 2, e );
00043   vpgl_fundamental_matrix<T>::set_matrix( fm );
00044 };
00045 
00046 
00047 // Code for easy instantiation.
00048 #undef vpgl_AFFINE_FUNDAMENTAL_MATRIX_INSTANTIATE
00049 #define vpgl_AFFINE_FUNDAMENTAL_MATRIX_INSTANTIATE(T) \
00050 template class vpgl_affine_fundamental_matrix<T >
00051 
00052 #endif // vpgl_affine_fundamental_matrix_txx_