00001 00002 #ifndef _MC_GRID_SPATIAL_HASHING_HPP_ 00003 #define _MC_GRID_SPATIAL_HASHING_HPP_ 00004 00005 #include <MC_grid_3d.hpp> 00006 00007 #include <set> 00008 #include <algorithm> 00009 00010 namespace mesh_conv 00011 { 00013 class MC_grid_index_spatial_hashing 00014 { 00015 public: 00016 00017 // ********************************************* // 00018 // ********************************************* // 00019 // CONSTRUCTORS 00020 // ********************************************* // 00021 // ********************************************* // 00022 00024 MC_grid_index_spatial_hashing(); 00026 MC_grid_index_spatial_hashing(const MC_int_vector& grid_size); 00027 00028 // ********************************************* // 00029 // ********************************************* // 00030 // Size 00031 // ********************************************* // 00032 // ********************************************* // 00033 00035 MC_int_vector size() const; 00036 00038 bool is_in_bound(const MC_int_vector& position) const; 00039 00040 // ********************************************* // 00041 // ********************************************* // 00042 // Global filling 00043 // ********************************************* // 00044 // ********************************************* // 00045 00047 void clear(); 00048 00049 00050 // ********************************************* // 00051 // ********************************************* // 00052 // Index 00053 // ********************************************* // 00054 // ********************************************* // 00055 00057 void add_index(const MC_int_vector& X,const int index); 00059 void delete_index(const MC_int_vector& X,const int index); 00060 00062 std::set<int>& get(const MC_int_vector& X); 00064 const std::set<int>& get(const MC_int_vector& X) const; 00065 00067 MC_int_vector_vector get_voxel_within_sphere(const MC_v3d& center,const double& radius) const; 00068 00069 00070 // ********************************************* // 00071 // ********************************************* // 00072 // Neighbooring map 00073 // ********************************************* // 00074 // ********************************************* // 00075 00077 void add_sphere(const MC_v3d& center,const double& radius,const int& id); 00079 std::set<int> neighboors_index_in_radius(const MC_v3d& center,const double& radius) const; 00080 00081 private: 00082 00084 MC_grid_3d<std::set<int> > index_grid; 00085 00086 }; 00087 00088 } 00089 00090 00091 #endif
1.6.1