contrib/oxl/mvl/HMatrix1DCompute.cxx
Go to the documentation of this file.
00001 // This is oxl/mvl/HMatrix1DCompute.cxx
00002 #include "HMatrix1DCompute.h"
00003 
00004 #include <vcl_cstdlib.h>
00005 #include <vcl_iostream.h>
00006 
00007 #include <mvl/HMatrix1D.h>
00008 #include <vgl/vgl_homg_point_1d.h>
00009 #include <vcl_vector.h>
00010 
00011 //--------------------------------------------------------------------------------
00012 //
00013 //  misc. stuff
00014 //
00015 //--------------------------------------------------------------------------------
00016 
00017 void HMatrix1DCompute::verbose(bool v) { verbose_=v; }
00018 
00019 //--------------------------------------------------------------------------------
00020 //
00021 //  implementations of virtual functions :
00022 //
00023 //--------------------------------------------------------------------------------
00024 
00025 bool
00026 HMatrix1DCompute::compute_array_dbl(const double p1[],
00027                                     const double p2[],
00028                                     int N,
00029                                     HMatrix1D *H)
00030 {
00031   vcl_vector<vgl_homg_point_1d<double> > pt1;
00032   vcl_vector<vgl_homg_point_1d<double> > pt2;
00033   pt1.reserve(N);
00034   pt2.reserve(N);
00035   for (int i=0;i<N;i++) {
00036     pt1.push_back(vgl_homg_point_1d<double>(p1[i],1.0));
00037     pt2.push_back(vgl_homg_point_1d<double>(p2[i],1.0));
00038   }
00039   return compute_cool_homg(pt1,pt2,H);
00040 }
00041 
00042 bool
00043 HMatrix1DCompute::compute_cool_homg(const vcl_vector<vgl_homg_point_1d<double> >&,
00044                                     const vcl_vector<vgl_homg_point_1d<double> >&,
00045                                     HMatrix1D *)
00046 {
00047   vcl_cerr << "\nHMatrix1DCompute::compute_cool_homg() :\n"
00048            << "This is a virtual method which should have been\n"
00049            << "overridden by a class derived from HMatrix1DCompute.\n";
00050   vcl_abort();
00051   return false;
00052 }
00053 
00054 //--------------------------------------------------------------------------------
00055 //
00056 //  the remaining functions just call the above functions.
00057 //
00058 //--------------------------------------------------------------------------------
00059 
00060 bool
00061 HMatrix1DCompute::compute(const vcl_vector<vgl_homg_point_1d<double> >&p1,
00062                           const vcl_vector<vgl_homg_point_1d<double> >&p2,
00063                           HMatrix1D *H)
00064 {
00065   return compute_cool_homg(p1,p2,H);
00066 }