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 <vifa/vifa_typedefs.h> 00029 00030 class vifa_line_cover : public vbl_ref_count 00031 { 00032 int dim_; 00033 int* index_; 00034 double* max_extent_; 00035 double* min_extent_; 00036 imp_line_sptr line_; 00037 00038 public: 00039 // Constructors and Destructors 00040 vifa_line_cover(); 00041 vifa_line_cover(imp_line_sptr prototype_line, 00042 int index_dimension); 00043 // copy constructor - compiler-provided one sets ref_count to nonzero which is wrong -PVr 00044 inline vifa_line_cover(vifa_line_cover const& c) 00045 : vbl_ref_count(), dim_(c.dim_), index_(c.index_), 00046 max_extent_(c.max_extent_), min_extent_(c.min_extent_), line_(c.line_) {} 00047 ~vifa_line_cover(); 00048 00049 // Indexing methods 00050 void InsertLine(imp_line_sptr l); 00051 00052 // Data Access methods 00053 double GetCoverage(); 00054 double GetDenseCoverage(); 00055 double GetCustomCoverage(const double norm); 00056 void GetExtent(imp_line_sptr& lmin, 00057 imp_line_sptr& lmax); 00058 00059 protected: 00060 int get_index_min(); 00061 int get_index_max(); 00062 double get_signed_distance(vgl_point_2d<double> const& p); 00063 imp_line_sptr get_offset_line(int start, 00064 int end, 00065 double dist); 00066 }; 00067 00068 typedef vbl_smart_ptr<vifa_line_cover> vifa_line_cover_sptr; 00069 00070 #endif // VIFA_LINE_COVER_H
1.4.4