00001 #ifndef DEF_ALGOGUSKOV
00002 #define DEF_ALGOGUSKOV
00003
00004 #include <math.h>
00005 #include <complex>
00006 #include <vector>
00007
00008
00009 #include "Common.hh"
00010 #include "Tile.hh"
00011
00012
00021 class AlgoGuskov
00022 {
00023
00024 private:
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00044
00045
00046
00055
00056
00057
00058
00059
00068 std::vector<OriginalMesh::Normal> get_face_normal(OriginalMesh& result_mesh, OriginalMesh::VertexHandle v);
00069
00071
00072
00073
00074
00075
00076
00077
00078
00079
00086 double max_normal_error;
00087
00089 vector<Vertex> seed_list;
00090
00091
00092
00093
00095 double delta_cubic_spline[2];
00096
00097
00098
00099
00101 unsigned int resampling_level;
00102
00107 unsigned int mapping_parameter_h;
00108
00110
00111
00112
00113
00114
00116
00117
00125 bool condition_EB(vector<Tile*> &tiles, Vertex &v, OriginalMesh &m) ;
00126
00132 bool condition_NZ(vector<Tile*> &tiles, Vertex &v, OriginalMesh &m) ;
00133
00139 bool condition_MB(vector<Tile*> &tiles, Vertex &v, OriginalMesh &m) ;
00140
00146 bool condition_MN(vector<Tile*> &tiles, Vertex &v, OriginalMesh &m);
00147
00159 bool check_normal_error(vector<Tile*>& tiles, Vertex &v, OriginalMesh &m, OpenMesh::VPropHandleT< unsigned int > &vprop_tile);
00160
00162
00163
00164
00165
00166
00167
00168
00169
00171
00172
00174 double calculate_cubic_spline(const double r) const;
00175
00187 double metric_space_dist(OriginalMesh::Point const & s, OriginalMesh::Point const & b1, OriginalMesh::Point const & b2, OriginalMesh::Point const & b3) const;
00188
00189
00202 OriginalMesh::Point blending(OriginalMesh& m, const vector<Tile*>& tiles, const OriginalMesh& base_mesh, const OriginalMesh::Point s, const OriginalMesh::FaceHandle base_face1, const OriginalMesh::FaceHandle second_base_face);
00203
00204
00218 bool triangle_in_D(const OriginalMesh& m, const unsigned int tile_id, const Vertex vertices[3], vector<Tile*> tiles) const;
00219
00220
00222
00223
00224
00225
00226
00228
00229
00230
00239 void optimize_vertex_find_region_interior(OriginalMesh& om, const OriginalMesh& bm, Tile& cur_tile, const OpenMesh::VPropHandleT< double >& vprop_distance, vector<OriginalMesh::Point>& ret_region, Vertex& boundary_start_vertex);
00240
00241
00246 void optimize_vertex_region(OriginalMesh& om, OriginalMesh& bm, vector<Tile*>& tiles);
00247
00252
00253
00254
00256
00257 public:
00258
00260 AlgoGuskov()
00261 {
00262 max_normal_error = 0.5;
00263 delta_cubic_spline[0] = 0.4;
00264 delta_cubic_spline[1] = 0.75;
00265 resampling_level = 2;
00266 mapping_parameter_h = 1;
00267 }
00268
00270
00271
00275 void set_max_normal_error(double error)
00276 { max_normal_error = error; }
00277
00281 double get_max_normal_error() const
00282 { return max_normal_error; }
00283
00289 void set_cubic_spline_delta(unsigned int which_delta, double value)
00290 {
00291 if(which_delta < 2)
00292 delta_cubic_spline[which_delta] = value;
00293 }
00294
00298 double get_cubic_spline_delta(unsigned int which_delta) const
00299 {
00300 return (which_delta < 2) ? delta_cubic_spline[which_delta] : 0.0;
00301 }
00302
00306 void set_resampling_level(unsigned int level)
00307 {
00308 resampling_level = level;
00309 }
00310
00314 unsigned int get_resampling_level() const
00315 {
00316 return resampling_level;
00317 }
00318
00322 void set_mapping_parameter_h(unsigned int h)
00323 {
00324 if(h < 2)
00325 mapping_parameter_h = h;
00326 }
00327
00331 unsigned int get_mapping_parameter_h() const
00332 {
00333 return mapping_parameter_h;
00334 }
00335
00337
00340 void init_mesh(OriginalMesh& m);
00341
00342
00350 std::vector<Seed> create_seeds(const unsigned int n, const OriginalMesh& m);
00351
00352
00361 void run_chartification(OriginalMesh& m, vector<Seed>& seed_list, vector<Tile*>& tiles );
00362
00363
00375 void create_base_mesh(OriginalMesh& m, vector<Tile*>& tiles, OriginalMesh& base_mesh);
00376
00377
00398 void initial_parameterization(OriginalMesh &orig_mesh, OriginalMesh const &base_mesh, vector<Tile*> const &tiles);
00399
00400
00413 void run_resampling(OriginalMesh& m, vector<Tile*>& tiles, OriginalMesh& base_mesh, OriginalMesh& result_mesh);
00414 };
00415
00416
00417
00418
00419
00420 #endif