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 #ifndef ISOEX_GRIDBASE_HH
00034 #define ISOEX_GRIDBASE_HH
00035
00036
00037
00038
00039 #include <OpenMesh/Core/Math/VectorT.hh>
00040 #include <vector>
00041
00042
00043
00044 namespace IsoEx {
00045
00046
00047
00048
00055 class Grid
00056 {
00057 public:
00058
00059
00060
00061
00063 typedef unsigned int CubeIdx;
00064
00066 typedef unsigned int PointIdx;
00067
00068
00073 class CubeIterator
00074 {
00075 public:
00079 CubeIterator(unsigned int _idx) : idx_(_idx) {}
00081 CubeIdx& operator*() { return idx_; }
00083 CubeIdx* operator->() { return &idx_; }
00085 bool operator==(const CubeIterator& _rhs) const { return idx_==_rhs.idx_;}
00087 bool operator!=(const CubeIterator& _rhs) const { return !(*this==_rhs); }
00089 CubeIterator& operator++() { ++idx_; return *this; }
00090 private:
00091 unsigned int idx_;
00092 };
00093
00094
00095
00096
00097
00098
00100 Grid() {}
00102 virtual ~Grid() {}
00103
00104
00105
00107
00108
00110 CubeIterator begin() const { return CubeIterator(0); }
00111
00113 CubeIterator end() const { return CubeIterator(n_cubes()); }
00114
00116
00117
00118
00119
00120
00122
00123
00125 virtual unsigned int n_cubes() const = 0;
00126
00128 virtual unsigned int n_points() const = 0;
00129
00131 virtual PointIdx point_idx(CubeIdx _idx, unsigned char _corner) const = 0;
00132
00134 virtual OpenMesh::Vec3f point(PointIdx _idx) const = 0;
00135
00137 virtual bool is_inside(PointIdx _pidx) const = 0;
00138
00140 virtual float scalar_distance(PointIdx _pidx) const = 0;
00141
00143 virtual bool directed_distance(const OpenMesh::Vec3f& _p0,
00144 const OpenMesh::Vec3f& _p1,
00145 OpenMesh::Vec3f& _point,
00146 OpenMesh::Vec3f& _normal,
00147 float& _distance) const = 0;
00149 };
00150
00151
00152
00153 }
00154
00155 #endif // ISOEX_GRIDBASE_HH defined
00156