contrib/oxl/mvl/PairMatchSetLineSeg.cxx
Go to the documentation of this file.
00001 // This is oxl/mvl/PairMatchSetLineSeg.cxx
00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00003 #pragma implementation
00004 #endif
00005 //:
00006 //  \file
00007 
00008 #include "PairMatchSetLineSeg.h"
00009 
00010 #include <mvl/MatchSet.h>
00011 #include <mvl/LineSegSet.h>
00012 
00013 PairMatchSetLineSeg::PairMatchSetLineSeg()
00014 {
00015   linesegs1_ = 0;
00016   linesegs2_ = 0;
00017 }
00018 
00019 PairMatchSetLineSeg::PairMatchSetLineSeg(LineSegSet& linesegs1, LineSegSet& linesegs2):
00020   PairMatchSet(linesegs1.size())
00021 {
00022   linesegs1_ = &linesegs1;
00023   linesegs2_ = &linesegs2;
00024 }
00025 
00026 PairMatchSetLineSeg::~PairMatchSetLineSeg()
00027 {
00028 }
00029 
00030 //: Extract the point vectors for only the valid matches.
00031 void PairMatchSetLineSeg::extract_matches(vcl_vector <HomgLineSeg2D>& linesegs1,
00032                                           vcl_vector <HomgLineSeg2D>& linesegs2) const
00033 {
00034   unsigned n = count();
00035   linesegs1.resize(n);
00036   linesegs2.resize(n);
00037   int i = 0;
00038   for (PairMatchSet::iterator match = *this; match; match.next()) {
00039     linesegs1[i] = linesegs1_->get_homg(match.get_i1());
00040     linesegs2[i] = linesegs2_->get_homg(match.get_i2());
00041     ++i;
00042   }
00043 }
00044 
00045 
00046 //: Set the pair of LineSegSets to which matches refer.
00047 void PairMatchSetLineSeg::set(LineSegSet* linesegs1, LineSegSet* linesegs2)
00048 {
00049   linesegs1_ = linesegs1;
00050   linesegs2_ = linesegs2;
00051   set_size(linesegs1_->size());
00052 }