Go to the documentation of this file.00001
00002 #ifndef VIFA_COLL_LINES
00003 #define VIFA_COLL_LINES
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <vcl_vector.h>
00019 #include <vbl/vbl_smart_ptr.h>
00020 #include <vgl/vgl_point_2d.h>
00021 #include <vtol/vtol_edge.h>
00022 #include <vtol/vtol_edge_2d.h>
00023 #include <vifa/vifa_coll_lines_params.h>
00024 #include <vifa/vifa_typedefs.h>
00025
00026
00027 class vifa_coll_lines : public vifa_coll_lines_params
00028 {
00029 private:
00030 bool discard_flag_;
00031 static int serial_num_;
00032 int id_;
00033 imp_line_sptr hypothesized_line_;
00034 edge_2d_list contributors_;
00035 double projected_length_cutoff_;
00036 double endpt_distance_;
00037
00038 public:
00039 vifa_coll_lines(vtol_edge_2d_sptr e,
00040 double angle_cutoff_deg = 5.0,
00041 double endpt_distance = 3.0,
00042 bool src_from_discard = false
00043 );
00044 ~vifa_coll_lines(void);
00045
00046 bool get_discard_flag(void) const;
00047 int get_id(void) const;
00048 double get_measure(const vtol_edge_2d& e) const;
00049 double get_projected_length(const vtol_edge_2d& e) const;
00050
00051 edge_2d_list& get_contributors(void);
00052
00053
00054 face_list* get_contributor_faces(void);
00055
00056 static void lms_fit(const vcl_vector<double>& x,
00057 const vcl_vector<double>& y,
00058 double& A,
00059 double& B,
00060 double& C
00061 );
00062
00063 void add_and_update(vtol_edge_2d_sptr e);
00064 double spanning_length(void);
00065 double spanning_length(vgl_point_2d<double>& p1,
00066 vgl_point_2d<double>& p2
00067 );
00068 double support_length(void);
00069 bool contains(const vtol_edge& e);
00070
00071 private:
00072 static double get_projected_length(const vtol_edge_2d& e,
00073 const imp_line& hyp_line,
00074 double& v1_dist,
00075 double& v2_dist
00076 );
00077 static double get_midpt_dist(const vtol_edge_2d& e,
00078 const imp_line& hyp_line
00079 );
00080 double get_measure(const vtol_edge_2d& e,
00081 const imp_line& hyp_line
00082 ) const;
00083
00084 void fit_line(void);
00085 };
00086
00087 typedef vbl_smart_ptr<vifa_coll_lines> vifa_coll_lines_sptr;
00088
00089 typedef vcl_vector<vifa_coll_lines_sptr> coll_list;
00090 typedef vcl_vector<vifa_coll_lines_sptr>::iterator coll_iterator;
00091
00092
00093 #endif // VIFA_COLL_LINES