Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members

Grid.hh

00001 /*===========================================================================*\
00002  *                                                                           *
00003  *                                IsoEx                                      *
00004  *        Copyright (C) 2002 by Computer Graphics Group, RWTH Aachen         *
00005  *                         www.rwth-graphics.de                              *
00006  *                                                                           *
00007  *---------------------------------------------------------------------------* 
00008  *                                                                           *
00009  *                                License                                    *
00010  *                                                                           *
00011  *  This library is free software; you can redistribute it and/or modify it  *
00012  *  under the terms of the GNU Library General Public License as published   *
00013  *  by the Free Software Foundation, version 2.                              *
00014  *                                                                           *
00015  *  This library is distributed in the hope that it will be useful, but      *
00016  *  WITHOUT ANY WARRANTY; without even the implied warranty of               *
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        *
00018  *  Library General Public License for more details.                         *
00019  *                                                                           *
00020  *  You should have received a copy of the GNU Library General Public        *
00021  *  License along with this library; if not, write to the Free Software      *
00022  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                *
00023  *                                                                           *
00024 \*===========================================================================*/
00025 
00026 //=============================================================================
00027 //
00028 //  CLASS Grid
00029 //
00030 //=============================================================================
00031 
00032 
00033 #ifndef ISOEX_GRIDBASE_HH
00034 #define ISOEX_GRIDBASE_HH
00035 
00036 
00037 //== INCLUDES =================================================================
00038 
00039 #include <OpenMesh/Core/Math/VectorT.hh>
00040 #include <vector>
00041 
00042 //== NAMESPACES ===============================================================
00043 
00044 namespace IsoEx {
00045 
00046 //== CLASS DEFINITION =========================================================
00047 
00048               
00055 class Grid
00056 {
00057 public:
00058    
00059   //-------------------------------------------------------------- public types
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   //------------------------------------------------------------ public methods
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   //------------------------------------------------ abstract virtual interface
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 } // namespace IsoEx
00154 //=============================================================================
00155 #endif // ISOEX_GRIDBASE_HH defined
00156 //=============================================================================

Generated on Mon Jul 5 18:07:08 2004 for IsoEx by doxygen 1.3.6-20040222