OpenMesh
StripifierT.hh
1/* ========================================================================= *
2 * *
3 * OpenMesh *
4 * Copyright (c) 2001-2023, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openmesh.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenMesh. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 * ========================================================================= */
41
42
43
44//=============================================================================
45//
46// CLASS StripifierT
47//
48//=============================================================================
49
50
51#ifndef OPENMESH_STRIPIFIERT_HH
52#define OPENMESH_STRIPIFIERT_HH
53
54
55//== INCLUDES =================================================================
56
57#include <vector>
58#include <OpenMesh/Core/Utils/Property.hh>
59
60
61//== FORWARDDECLARATIONS ======================================================
62
63
64//== NAMESPACES ===============================================================
65
66namespace OpenMesh {
67
68
69//== CLASS DEFINITION =========================================================
70
71
72
73
78template <class Mesh>
80{
81public:
82
83 typedef unsigned int Index;
84 typedef std::vector<Index> Strip;
85 typedef typename Strip::const_iterator IndexIterator;
86 typedef std::vector<Strip> Strips;
87 typedef typename Strips::const_iterator StripsIterator;
88
89
91 explicit StripifierT(Mesh& _mesh);
92
95
97 size_t stripify();
98
100 void clear() { Strips().swap(strips_); }
101
103 size_t n_strips() const { return strips_.size(); }
104
106 bool is_valid() const { return !strips_.empty(); }
107
109 StripsIterator begin() const { return strips_.begin(); }
111 StripsIterator end() const { return strips_.end(); }
112
113
114private:
115
116 typedef std::vector<typename Mesh::FaceHandle> FaceHandles;
117
118
120 void build_strips();
121
123 void build_strip(typename Mesh::HalfedgeHandle _start_hh,
124 Strip& _strip,
125 FaceHandles& _faces);
126
127 FPropHandleT<bool>::reference processed(typename Mesh::FaceHandle _fh) {
128 return mesh_.property(processed_, _fh);
129 }
130 FPropHandleT<bool>::reference used(typename Mesh::FaceHandle _fh) {
131 return mesh_.property(used_, _fh);
132 }
133
134
135
136private:
137
138 Mesh& mesh_;
139 Strips strips_;
140 FPropHandleT<bool> processed_, used_;
141};
142
143
144//=============================================================================
145} // namespace OpenMesh
146//=============================================================================
147#if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_STRIPIFIERT_C)
148#define OPENMESH_STRIPIFIERT_TEMPLATES
149#include "StripifierT_impl.hh"
150#endif
151//=============================================================================
152#endif // OPENMESH_STRIPIFIERT_HH defined
153//=============================================================================
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
Kernel::FaceHandle FaceHandle
Scalar type.
Definition: PolyMeshT.hh:139
Kernel::HalfedgeHandle HalfedgeHandle
Scalar type.
Definition: PolyMeshT.hh:137
Handle representing a face property.
Definition: Property.hh:462
This class decomposes a triangle mesh into several triangle strips.
Definition: StripifierT.hh:80
void clear()
delete all strips
Definition: StripifierT.hh:100
StripsIterator end() const
Access strips.
Definition: StripifierT.hh:111
size_t stripify()
Compute triangle strips, returns number of strips.
Definition: StripifierT_impl.hh:82
~StripifierT()
Destructor.
Definition: StripifierT_impl.hh:75
StripifierT(Mesh &_mesh)
Default constructor.
Definition: StripifierT_impl.hh:67
bool is_valid() const
are strips computed?
Definition: StripifierT.hh:106
StripsIterator begin() const
Access strips.
Definition: StripifierT.hh:109
size_t n_strips() const
returns number of strips
Definition: StripifierT.hh:103

Project OpenMesh, ©  Visual Computing Institute, RWTH Aachen. Documentation generated using doxygen .