Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

StripifierT.hh

00001 //=============================================================================
00002 //                                                                            
00003 //                               OpenMesh                                     
00004 //      Copyright (C) 2001-2003 by Computer Graphics Group, RWTH Aachen         
00005 //                           www.openmesh.org                                 
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 //   $Revision: 1.4 $
00027 //   $Date: 2003/07/21 12:33:16 $
00028 //                                                                            
00029 //=============================================================================
00030 
00031 //=============================================================================
00032 //
00033 //  CLASS StripifierT
00034 //
00035 //=============================================================================
00036 
00037 
00038 #ifndef OPENMESH_STRIPIFIERT_HH
00039 #define OPENMESH_STRIPIFIERT_HH
00040 
00041 
00042 //== INCLUDES =================================================================
00043 
00044 #include <vector>
00045 #include <OpenMesh/Core/Utils/Property.hh>
00046 
00047 
00048 //== FORWARDDECLARATIONS ======================================================
00049 
00050 
00051 //== NAMESPACES ===============================================================
00052 
00053 namespace OpenMesh {
00054 
00055 
00056 //== CLASS DEFINITION =========================================================
00057 
00058 
00059 
00060               
00065 template <class Mesh>
00066 class StripifierT
00067 {
00068 public:
00069    
00070   typedef unsigned int                      Index;
00071   typedef std::vector<Index>                Strip;
00072   typedef typename Strip::const_iterator    IndexIterator;
00073   typedef std::vector<Strip>                Strips;
00074   typedef typename Strips::const_iterator   StripsIterator;
00075 
00076 
00078   StripifierT(Mesh& _mesh) : mesh_(_mesh) {}
00079 
00081   ~StripifierT() {}
00082 
00083 
00085   unsigned int stripify();
00086 
00088   void clear() { strips_.clear(); }
00089 
00091   unsigned int n_strips() const { return strips_.size(); }
00092 
00094   bool is_valid() const { return !strips_.empty(); }
00095 
00097   StripsIterator begin() const { return strips_.begin(); }
00099   StripsIterator end()   const { return strips_.end(); }
00100 
00101 
00102 private:
00103 
00104   typedef std::vector<typename Mesh::FaceHandle>  FaceHandles;
00105 
00106 
00108   void build_strips();
00109 
00111   void build_strip(typename Mesh::HalfedgeHandle _start_hh,
00112                    Strip& _strip,
00113                    FaceHandles& _faces);
00114 
00115 
00116   bool& processed(typename Mesh::FaceHandle _fh) {
00117     return mesh_.property(processed_, _fh);
00118   }
00119   bool& used(typename Mesh::FaceHandle _fh) {
00120     return mesh_.property(used_, _fh);
00121   }
00122 
00123 
00124 
00125 private:
00126 
00127   Mesh&                mesh_;
00128   Strips               strips_;
00129   FPropHandleT<bool>   processed_, used_;
00130 };
00131 
00132 
00133 //=============================================================================
00134 } // namespace OpenMesh
00135 //=============================================================================
00136 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_STRIPIFIERT_C)
00137 #define OPENMESH_STRIPIFIERT_TEMPLATES
00138 #include "StripifierT.cc"
00139 #endif
00140 //=============================================================================
00141 #endif // OPENMESH_STRIPIFIERT_HH defined
00142 //=============================================================================

acg pic Project OpenMesh, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .