Blender  V2.93
GeomCleaner.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
17 #pragma once
18 
24 #include "Geom.h"
25 
26 #include "../system/FreestyleConfig.h"
27 
28 #ifdef WITH_CXX_GUARDEDALLOC
29 # include "MEM_guardedalloc.h"
30 #endif
31 
32 namespace Freestyle {
33 
34 using namespace Geometry;
35 
36 class GeomCleaner {
37  public:
38  inline GeomCleaner()
39  {
40  }
41  inline ~GeomCleaner()
42  {
43  }
44 
66  static void SortIndexedVertexArray(const float *iVertices,
67  unsigned iVSize,
68  const unsigned *iIndices,
69  unsigned iISize,
70  float **oVertices,
71  unsigned **oIndices);
72 
94  static void CompressIndexedVertexArray(const float *iVertices,
95  unsigned iVSize,
96  const unsigned *iIndices,
97  unsigned iISize,
98  float **oVertices,
99  unsigned *oVSize,
100  unsigned **oIndices);
101 
122  static void SortAndCompressIndexedVertexArray(const float *iVertices,
123  unsigned iVSize,
124  const unsigned *iIndices,
125  unsigned iISize,
126  float **oVertices,
127  unsigned *oVSize,
128  unsigned **oIndices);
129 
151  static void CleanIndexedVertexArray(const float *iVertices,
152  unsigned iVSize,
153  const unsigned *iIndices,
154  unsigned iISize,
155  float **oVertices,
156  unsigned *oVSize,
157  unsigned **oIndices);
158 
159 #ifdef WITH_CXX_GUARDEDALLOC
160  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:GeomCleaner")
161 #endif
162 };
163 
165 // inline bool operator<(const IndexedVertex& iv1, const IndexedVertex& iv2);
166 
170  private:
171  Vec3f _Vector;
172  unsigned _index;
173 
174  public:
175  inline IndexedVertex()
176  {
177  }
178 
179  inline IndexedVertex(Vec3f iVector, unsigned iIndex)
180  {
181  _Vector = iVector;
182  _index = iIndex;
183  }
184 
186  inline const Vec3f &vector() const
187  {
188  return _Vector;
189  }
190 
191  inline unsigned index()
192  {
193  return _index;
194  }
195 
196  inline float x()
197  {
198  return _Vector[0];
199  }
200 
201  inline float y()
202  {
203  return _Vector[1];
204  }
205 
206  inline float z()
207  {
208  return _Vector[2];
209  }
210 
212  inline void setVector(const Vec3f &iVector)
213  {
214  _Vector = iVector;
215  }
216 
217  inline void setIndex(unsigned iIndex)
218  {
219  _index = iIndex;
220  }
221 
224  {
225  _Vector = iv._Vector;
226  _index = iv._index;
227  return *this;
228  }
229 
230  inline float operator[](const unsigned i)
231  {
232  return _Vector[i];
233  }
234 
235  // friend inline bool operator<(const IndexedVertex& iv1, const IndexedVertex& iv2);
236  inline bool operator<(const IndexedVertex &v) const
237  {
238  return (_Vector < v._Vector);
239  }
240 
241  inline bool operator==(const IndexedVertex &v)
242  {
243  return (_Vector == v._Vector);
244  }
245 
246 #ifdef WITH_CXX_GUARDEDALLOC
247  MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:IndexedVertex")
248 #endif
249 };
250 
251 #if 0
252 bool operator<(const IndexedVertex &iv1, const IndexedVertex &iv2)
253 {
254  return iv1.operator<(iv2);
255 }
256 #endif
257 
258 } /* namespace Freestyle */
Vectors and Matrices (useful type definitions)
Read Guarded memory(de)allocation.
ATTR_WARN_UNUSED_RESULT const BMVert * v
void setIndex(unsigned iIndex)
Definition: GeomCleaner.h:217
const Vec3f & vector() const
Definition: GeomCleaner.h:186
IndexedVertex(Vec3f iVector, unsigned iIndex)
Definition: GeomCleaner.h:179
float operator[](const unsigned i)
Definition: GeomCleaner.h:230
void setVector(const Vec3f &iVector)
Definition: GeomCleaner.h:212
IndexedVertex & operator=(const IndexedVertex &iv)
Definition: GeomCleaner.h:223
bool operator<(const IndexedVertex &v) const
Definition: GeomCleaner.h:236
bool operator==(const IndexedVertex &v)
Definition: GeomCleaner.h:241
inherits from class Rep
Definition: AppCanvas.cpp:32
constexpr bool operator<(StringRef a, StringRef b)