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

StripifierT.hh

00001 //=============================================================================
00002 //                                                                            
00003 //                               OpenMesh                                     
00004 //      Copyright (C) 2001-2005 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.1.1.1 $
00027 //   $Date: 2004/09/06 12:37:50 $
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().swap(strips_); }
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   FPropHandleT<bool>::reference  processed(typename Mesh::FaceHandle _fh) {
00116     return mesh_.property(processed_, _fh);
00117   }
00118   FPropHandleT<bool>::reference  used(typename Mesh::FaceHandle _fh) {
00119     return mesh_.property(used_, _fh);
00120   }
00121 
00122 
00123 
00124 private:
00125 
00126   Mesh&                mesh_;
00127   Strips               strips_;
00128   FPropHandleT<bool>   processed_, used_;
00129 };
00130 
00131 
00132 //=============================================================================
00133 } // namespace OpenMesh
00134 //=============================================================================
00135 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_STRIPIFIERT_C)
00136 #define OPENMESH_STRIPIFIERT_TEMPLATES
00137 #include "StripifierT.cc"
00138 #endif
00139 //=============================================================================
00140 #endif // OPENMESH_STRIPIFIERT_HH defined
00141 //=============================================================================

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