00001
00002 #ifndef fhs_arc_h_
00003 #define fhs_arc_h_
00004
00005
00006
00007
00008
00009 #include <vsl/vsl_binary_io.h>
00010 #include <vcl_vector.h>
00011
00012
00013
00014
00015 class fhs_arc
00016 {
00017 private:
00018 unsigned i_;
00019 unsigned j_;
00020 double dx_;
00021 double dy_;
00022 double var_x_;
00023 double var_y_;
00024 public:
00025
00026 fhs_arc()
00027 : i_(0),j_(0),dx_(0),dy_(0),var_x_(1.0),var_y_(1.0) {}
00028
00029
00030 fhs_arc(int i, int j, double dx, double dy, double var_x, double var_y)
00031 : i_(i),j_(j),dx_(dx),dy_(dy),var_x_(var_x),var_y_(var_y) {}
00032
00033
00034 fhs_arc flipped() const
00035 { return fhs_arc(j(),i(),-dx(),-dy(),var_x(),var_y()); }
00036
00037
00038 unsigned i() const { return i_; }
00039
00040
00041 unsigned j() const { return j_; }
00042
00043
00044 double dx() const { return dx_; }
00045
00046
00047 double dy() const { return dy_; }
00048
00049
00050 double var_x() const { return var_x_; }
00051
00052
00053 double var_y() const { return var_y_; }
00054
00055
00056 void b_write(vsl_b_ostream& bfs) const;
00057
00058
00059 void b_read(vsl_b_istream& bfs);
00060 };
00061
00062
00063
00064
00065
00066 bool fhs_order_tree_from_root(const vcl_vector<fhs_arc>& arc0,
00067 vcl_vector<fhs_arc>& new_arc,
00068 vcl_vector<vcl_vector<unsigned> >& children,
00069 unsigned new_root);
00070
00071
00072
00073 vcl_ostream& operator<<(vcl_ostream& os, const fhs_arc& c);
00074
00075
00076 vcl_ostream& operator<<(vcl_ostream& os, const vcl_vector<fhs_arc>& arc);
00077
00078
00079 inline void vsl_b_write(vsl_b_ostream& bfs, const fhs_arc& t)
00080 {
00081 t.b_write(bfs);
00082 }
00083
00084
00085 inline void vsl_b_read(vsl_b_istream& bfs, fhs_arc& t)
00086 {
00087 t.b_read(bfs);
00088 }
00089
00090
00091 void vsl_print_summary(vcl_ostream& os, const fhs_arc& t);
00092
00093 #endif // fhs_arc_h_