00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 #ifndef ACG_MESHEDGESAMPLERT_HH
00053 #define ACG_MESHEDGESAMPLERT_HH
00054
00055
00056
00057
00058 #include <iostream>
00059 #include <vector>
00060 #include "../../Config/ACGDefines.hh"
00061
00062
00063
00064
00065
00066 namespace ACG {
00067
00068
00069
00070
00071
00072
00080 template <class MeshT, class PointT>
00081 class MeshEdgeSamplerT
00082 {
00083 public:
00084
00085
00086 typedef MeshT Mesh;
00087 typedef typename Mesh::VertexHandle VH;
00088 typedef typename Mesh::FaceHandle FH;
00089 typedef typename Mesh::EdgeHandle EH;
00090 typedef typename Mesh::HalfedgeHandle HEH;
00091 typedef PointT Point;
00092
00093
00095 MeshEdgeSamplerT( Mesh& _mesh) : mesh_(_mesh){}
00096
00098 ~MeshEdgeSamplerT() {}
00099
00100
00101
00102
00103
00104 void edge_points_in_segment( const Point& _p_start,
00105 const Point& _p_end,
00106 const FH _fh_start,
00107 const FH _fh_end,
00108 std::vector<Point>& _points,
00109 std::vector<EH>& _ehandles );
00110 protected:
00111
00112
00113
00114 void compute_plane( const Point& _p_start,
00115 const Point& _p_end,
00116 const FH _fh_start,
00117 const FH _fh_end);
00118
00119
00120 void get_start_hehs( const Point& ,
00121 const FH _fh_start,
00122 HEH& _sheh0,
00123 HEH& _sheh1 );
00124
00125 void get_end_fhs_set( const Point& _p_end,
00126 const FH _fh_end,
00127 std::vector<FH>& _endfhs);
00128
00129
00130
00131
00132
00133 double plane_line_intersection( const Point& _p0,
00134 const Point& _p1,
00135 Point& _p_int);
00136
00137 double plane_line_intersection( const HEH _heh,
00138 Point& _p_int);
00139
00140 bool line_in_plane( const Point& _p0,
00141 const Point& _p1,
00142 double _eps);
00143
00144 bool line_in_plane( const HEH& _heh );
00145
00146 double plane_dist( const Point& _p0 );
00147
00148 double line_line_dist(const Point& _p_start,
00149 const Point& _p_end,
00150 const HEH& _heh,
00151 Point& _p_best);
00152
00153 HEH get_next_edge_intersection( const HEH& _heh, const Point& _pold, Point& _pint);
00154
00155
00156 void sort_intersections( HEH& _heh0, double& _d0, Point& _ip0,
00157 HEH& _heh1, double& _d1, Point& _ip1,
00158 HEH& _heh2, double& _d2, Point& _ip2 );
00159
00160 double epsilon( const FH& _fh);
00161 double epsilon( const HEH& _heh);
00162
00163 void finish_list( std::vector<Point>& _points,
00164 std::vector<EH>& _ehs,
00165 const HEH _cur_heh,
00166 const FH _fh_end,
00167 const Point& _p_end,
00168 const int _type);
00169
00170 void finish_list_old( std::vector<Point>& _points,
00171 std::vector<EH>& _ehs,
00172 const HEH _cur_heh,
00173 const FH _fh_end,
00174 const Point& _p_end,
00175 const int _t);
00176
00177
00178 void circulate_CW(HEH _heh, FH _fh_end, std::vector<EH>& _cw_ehs);
00179
00180 void circulate_CCW(HEH _heh, FH _fh_end, std::vector<EH>& _ccw_ehs);
00181
00182 private:
00183
00184
00185 Mesh& mesh_;
00186
00187
00188 Point p_plane_;
00189 Point n_plane_;
00190 };
00191
00192
00193
00194 }
00195
00196 #if defined(INCLUDE_TEMPLATES) && !defined(ACG_MESHEDGESAMPLERT_C)
00197 #define ACG_MESHEDGESAMPLERT_TEMPLATES
00198 #include "MeshEdgeSamplerT.cc"
00199 #endif
00200
00201 #endif // ACG_MESHEDGESAMPLERT_HH defined
00202
00203