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
00034
00035
00036
00037
00038 #ifndef OPENMESH_STRIPIFIERT_HH
00039 #define OPENMESH_STRIPIFIERT_HH
00040
00041
00042
00043
00044 #include <vector>
00045 #include <OpenMesh/Core/Utils/Property.hh>
00046
00047
00048
00049
00050
00051
00052
00053 namespace OpenMesh {
00054
00055
00056
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 }
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