skeleton.h
Go to the documentation of this file.00001
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 #ifndef CLIPPER_SKELETON
00047 #define CLIPPER_SKELETON
00048
00049
00050 #include <algorithm>
00051 #include <set>
00052 #include "function_object_bases.h"
00053
00054
00055 namespace clipper {
00056
00057
00059
00060 class Skeleton_basic : public Skeleton_base<int,float> {
00061 public:
00062
00063
00064 class Neighbours {
00065 public:
00066 Neighbours( const clipper::Xmap_base &map, const float min_dist = 0.5, const float max_dist = 2.5 );
00067 clipper::Coord_grid operator[] (int i) const { return nlist[i]; }
00068 int size() const { return nlist.size(); }
00069 private:
00070 std::vector<clipper::Coord_grid> nlist;
00071 };
00072
00073 class NCube {
00074 public:
00075 NCube( const int& n );
00076 const int& operator[] ( const clipper::Coord_grid& c ) const
00077 { return data[m.index(c)]; }
00078 int& operator[] ( const clipper::Coord_grid& c )
00079 { return data[m.index(c)]; }
00080 const clipper::Grid_range& grid() const { return m; }
00081 private:
00082 clipper::Grid_range m;
00083 std::vector<int> data;
00084 };
00085
00086
00088 Skeleton_basic( const int box = 1 ) : box_(box) {}
00090 Skeleton_basic( clipper::Xmap<int>& xskl, const clipper::Xmap<float>& xmap, const int box = 1 ) : box_(box) { (*this)( xskl, xmap ); }
00092 bool operator() ( clipper::Xmap<int>& xskl, const clipper::Xmap<float>& xmap ) const;
00093
00094 private:
00095 static bool isInSkel( const clipper::Xmap<int>& xskl, const clipper::Coord_grid& c, const Skeleton_basic::Neighbours& neigh, const int& box );
00096 int box_;
00097 };
00098
00099
00101
00102 template <class T1, class T2> class Skeleton_fast : public Skeleton_base<T1,T2> {
00103 public:
00104
00105
00106 class Neighbours {
00107 public:
00108 Neighbours() {}
00109 Neighbours( const clipper::Xmap_base &map, const float min_dist = 0.5, const float max_dist = 2.5 );
00110 clipper::Coord_grid operator[] (int i) const { return nlist[i]; }
00111 int size() const { return nlist.size(); }
00112 private:
00113 std::vector<clipper::Coord_grid> nlist;
00114 };
00115
00116
00118 Skeleton_fast() {}
00120 Skeleton_fast( clipper::Xmap<T1>& xskl, const clipper::Xmap<T2>& xmap ) { (*this)( xskl, xmap ); }
00122 bool operator() ( clipper::Xmap<T1>& xskl, const clipper::Xmap<T2>& xmap ) const;
00123
00124 private:
00125 mutable int cube[3][3][3];
00126 mutable Neighbours neigh;
00127 bool isInSkel( const clipper::Xmap<T1>& xskl, const clipper::Coord_grid& c ) const;
00128 void flood_cube( const int x, const int y, const int z ) const;
00129 };
00130
00131
00132 }
00133
00134 #endif