contrib/gel/vifa/vifa_line_cover.h
Go to the documentation of this file.
00001 // This is gel/vifa/vifa_line_cover.h
00002 #ifndef VIFA_LINE_COVER_H
00003 #define VIFA_LINE_COVER_H
00004 //-----------------------------------------------------------------------------
00005 //:
00006 // \file
00007 // \brief An index space for queries on parallel line overlap
00008 //
00009 // The vifa_line_cover class is an index which aids in finding parallel line
00010 // covers.  That is, we have a set of lines, some of which are parallel.  The
00011 // key function is to identify the subset of mutually parallel lines.  It is
00012 // assumed that there is a line space (an array) upon which a set of
00013 // approximately parallel lines are projected.  A measure of projection overlap
00014 // is defined by the accumulated projected points along this line like shapes.
00015 // That is, there are groups of parallel line segments having projection
00016 // overlap.
00017 //
00018 // \author J.L. Mundy (12/22/1998)
00019 //
00020 // \verbatim
00021 //  Modifications:
00022 //   MPP Jun 2003, Ported to VXL from TargetJr
00023 // \endverbatim
00024 //-----------------------------------------------------------------------------
00025 
00026 #include <vbl/vbl_ref_count.h>
00027 #include <vbl/vbl_smart_ptr.h>
00028 #include <vgl/vgl_fwd.h>
00029 #include <vifa/vifa_typedefs.h>
00030 
00031 class vifa_line_cover : public vbl_ref_count
00032 {
00033   int           dim_;
00034   int*          index_;
00035   double*       max_extent_;
00036   double*       min_extent_;
00037   imp_line_sptr line_;
00038 
00039  public:
00040   // Constructors and Destructors
00041   vifa_line_cover();
00042   vifa_line_cover(imp_line_sptr prototype_line,
00043                   int           index_dimension);
00044   // copy constructor - compiler-provided one sets ref_count to nonzero which is wrong -PVr
00045   inline vifa_line_cover(vifa_line_cover const& c)
00046     : vbl_ref_count(), dim_(c.dim_), index_(c.index_),
00047       max_extent_(c.max_extent_), min_extent_(c.min_extent_), line_(c.line_) {}
00048   ~vifa_line_cover();
00049 
00050   // Indexing methods
00051   void InsertLine(imp_line_sptr l);
00052 
00053   // Data Access methods
00054   double GetCoverage();
00055   double GetDenseCoverage();
00056   double GetCustomCoverage(const double norm);
00057   void   GetExtent(imp_line_sptr& lmin,
00058                    imp_line_sptr& lmax);
00059 
00060  protected:
00061   int    get_index_min();
00062   int    get_index_max();
00063   double get_signed_distance(vgl_point_2d<double> const& p);
00064   imp_line_sptr get_offset_line(int    start,
00065                                 int    end,
00066                                 double dist);
00067 };
00068 
00069 typedef vbl_smart_ptr<vifa_line_cover> vifa_line_cover_sptr;
00070 
00071 #endif  // VIFA_LINE_COVER_H