HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GEO_PrimPolySoup.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: GEO_PrimPolySoup.h (GEO Library, C++)
7  *
8  * COMMENTS: Implements a set of polygons sharing primitive attributes
9  * and some vertices, to save memory
10  */
11 
12 #pragma once
13 
14 #ifndef __GEO_PrimPolySoup__
15 #define __GEO_PrimPolySoup__
16 
17 #include "GEO_TriMesh.h"
18 #include "GEO_PrimType.h"
19 #include "GEO_PrimTypeCompat.h"
20 #include "GEO_API.h"
21 #include "GEO_PolyCounts.h"
22 #include <GA/GA_Detail.h>
23 #include <GA/GA_ElementWrangler.h>
24 #include <GA/GA_Types.h>
25 #include <UT/UT_Array.h>
26 #include <UT/UT_SafeFloat.h>
27 #include <UT/UT_Vector3.h>
28 #include <UT/UT_VectorTypes.h>
29 #include <SYS/SYS_Deprecated.h>
30 #include <SYS/SYS_Inline.h>
31 
32 class GA_Detail;
33 class GEO_PolySoupParms;
34 class GA_PrimitiveGroup;
35 class GEO_PrimPoly;
36 
37 /// A soup of polygons
39 {
40 protected:
41  /// NOTE: The constructor should only be called from subclass
42  /// constructors.
44  : GEO_TriMesh(d, offset)
45  {}
46 
47  /// NOTE: The destructor should only be called from subclass
48  /// destructors.
49  virtual ~GEO_PrimPolySoup() {}
50 
51 public:
53  {
54  public:
57  : GA_PolyCounts::const_iterator(prim.myPolygonSizeList)
58  , myPrim(&prim)
59  {}
61  : GA_PolyCounts::const_iterator(prim.myPolygonSizeList, polygon)
62  , myPrim(&prim)
63  {}
64  SYS_FORCE_INLINE const GEO_PrimPolySoup &prim() const { return *myPrim; }
66  {
68  this->myPrim = that.myPrim;
69  return *this;
70  }
72  {
73  UT_ASSERT_P(i >= 0 && i < nvertices());
74  return myPrim->myPolygonVertexList(start()+i);
75  }
77  {
78  UT_ASSERT_P(i >= 0 && i < nvertices());
79  const GA_Detail &detail = myPrim->getDetail();
80  return detail.vertexIndex(myPrim->myPolygonVertexList(start()+i));
81  }
83  {
84  UT_ASSERT_P(i >= 0 && i < nvertices());
85  return myPrim->getDetail().vertexPoint(myPrim->myPolygonVertexList(start()+i));
86  }
88  {
89  UT_ASSERT_P(i >= 0 && i < nvertices());
90  const GA_Detail &detail = myPrim->getDetail();
91  return detail.pointIndex(detail.vertexPoint(myPrim->myPolygonVertexList(start()+i)));
92  }
94  {
95  UT_ASSERT_P(i >= 0 && i < nvertices());
96  const GA_Detail &detail = myPrim->getDetail();
97  return detail.getPos3(detail.vertexPoint(myPrim->myPolygonVertexList(start()+i)));
98  }
100  {
101  UT_ASSERT_P(i >= 0 && i < nvertices());
102  const GA_Detail &detail = myPrim->getDetail();
103  return detail.getPos4(detail.vertexPoint(myPrim->myPolygonVertexList(start()+i)));
104  }
106  { return myPrim->baryCenter(*this); }
108  { return myPrim->computeNormal(*this); }
110  { return myPrim->calcPerimeter(*this); }
112  { return myPrim->calcArea(*this); }
114  { return myPrim->calcVolume(refpt, *this); }
115  SYS_FORCE_INLINE float getW() const
116  { return UTpackIntToSafeFloat(polygon()); }
117 
118  /// These are just here for interchangeability with GEO_Face
120  { return getVertexOffset(i); }
122  { return nvertices(); }
124  { return nvertices(); }
126  { return true; }
127  private:
128  const GEO_PrimPolySoup *myPrim;
129  };
130 
132  {
133  public:
134  VertexIterator(const PolygonIterator &it, GA_Size vtxnum = 0)
135  : myPrim(it.prim())
136  , myIndex(it.start()+vtxnum)
137  , myEnd(it.start()+it.nvertices())
138  {}
139  bool atEnd() const
140  {
141  return myIndex == myEnd;
142  }
144  {
145  ++myIndex;
146  return *this;
147  }
149  {
150  --myIndex;
151  return *this;
152  }
154  {
155  return VertexIterator(myPrim, myIndex + i, myEnd);
156  }
158  {
159  return VertexIterator(myPrim, myIndex - i, myEnd);
160  }
161  GA_Size number() const
162  {
163  return myIndex;
164  }
166  {
167  return myPrim.myPolygonVertexList(myIndex);
168  }
169  private:
171  : myPrim(prim)
172  , myIndex(index)
173  , myEnd(end)
174  {}
175  const GEO_PrimPolySoup &myPrim;
176  GA_Size myIndex;
177  GA_Size myEnd;
178  };
179 
180  /// Have we been deactivated and stashed?
181  void stashed(bool beingstashed,
182  GA_Offset offset = GA_INVALID_OFFSET) override;
183 
184  /// @{
185  /// Interface from GEO_TriMesh
186  UT_Vector3 computeNormal() const override;
187  void reverse() override;
188 
189  fpreal calcVolume(const UT_Vector3 &refpt) const override;
190  fpreal calcArea() const override;
191  fpreal calcPerimeter() const override;
192  /// @}
193 
194  // This is here only to avoid a compile error on baryCenter(it) below
195  UT_Vector3 baryCenter() const override
196  { return GEO_TriMesh::baryCenter(); }
197 
198  UT_Vector3 computeNormal(const PolygonIterator &it) const;
199  UT_Vector3 baryCenter(const PolygonIterator &it) const;
200  fpreal calcVolume(const UT_Vector3 &refpt, const PolygonIterator &it) const;
201  fpreal calcArea(const PolygonIterator &it) const;
202  fpreal calcPerimeter(const PolygonIterator &it) const;
203 
204  /// Get number of polygons in the soup
206  {
207  return myPolygonSizeList.getNumPolygons();
208  }
209 
210  /// Get the number of vertices in the polygon
212  {
213  UT_ASSERT_P(myPolygonSizeList.getArray().entries() != 0);
214  return myPolygonSizeList.getSize(polygon);
215  }
216 
217  /// Get the start offset into myPolygonVertexList of vertices for a
218  /// single polygon in the soup and the number of vertices in the polygon
220  GA_Size &start,
221  GA_Size &count) const
222  {
223  UT_ASSERT_P(myPolygonSizeList.getArray().entries() != 0);
224  myPolygonSizeList.getVertexRange(polygon, start, count);
225  }
226 
228  GA_Size vertexofpolygon) const
229  {
230  GA_Size start;
231  GA_Size count;
232  getPolygonVertexRange(polygon, start, count);
233  UT_ASSERT_P(vertexofpolygon < count);
234  return myPolygonVertexList(start + vertexofpolygon);
235  }
236 
238  GA_Size vertexofpolygon) const
239  {
240  return myPolygonVertexList(it.start() + vertexofpolygon);
241  }
242 
244  GA_Offset &v0,
245  GA_Offset &v1,
246  GA_Offset &v2) const
247  {
248  v0 = myPolygonVertexList(start);
249  v1 = myPolygonVertexList(start+1);
250  v2 = myPolygonVertexList(start+2);
251  }
252 
254  GA_Offset &v0,
255  GA_Offset &v1,
256  GA_Offset &v2,
257  GA_Offset &v3) const
258  {
259  v0 = myPolygonVertexList(start);
260  v1 = myPolygonVertexList(start+1);
261  v2 = myPolygonVertexList(start+2);
262  v3 = myPolygonVertexList(start+3);
263  }
264 
265  /// Return the maximum number of vertices in any face
266  inline GA_Size getMaxPolygonSize() const
267  {
269  = myPolygonSizeList.getArray();
270  if (!array.entries())
271  return -1;
272  GA_Size mx = array(0).size();
273  for (GA_Size i = 1; i < array.entries(); ++i)
274  mx = SYSmax(mx, array(i).size());
275  return mx;
276  }
277 
278  /// Return the minimum number of vertices in any face
279  inline GA_Size getMinPolygonSize() const
280  {
282  = myPolygonSizeList.getArray();
283  if (!array.entries())
284  return -1;
285  GA_Size mn = array(0).size();
286  for (GA_Size i = 1; i < array.entries(); ++i)
287  mn = SYSmin(mn, array(i).size());
288  return mn;
289  }
290 
291  /// Return the minimum and maximum number of vertices for any face
292  inline void getMinMaxPolygonSize(GA_Size &mn, GA_Size &mx) const
293  {
295  = myPolygonSizeList.getArray();
296  if (!array.entries())
297  {
298  mn = mx = -1;
299  return;
300  }
301  mn = mx = array(0).size();
302  for (GA_Size i = 1; i < array.entries(); ++i)
303  {
304  mn = SYSmin(mn, array(i).size());
305  mx = SYSmax(mx, array(i).size());
306  }
307  }
308 
309  const GA_PrimitiveJSON *getJSON() const override;
310  /// @{
311  /// Save/Load polygon list to a JSON stream
312  bool savePolygonInfo(UT_JSONWriter &w,
313  const GA_SaveMap &map) const;
314  bool loadPolygonInfo(UT_JSONParser &p,
315  const GA_LoadMap &map);
316  /// @}
317 
318  /// Appends a copy of a single polygon to this PolySoup,
319  /// with all vertices unique
320  void appendPolygonCopyUnique(const GEO_PrimPoly *polygon,
321  GA_VertexWrangler &wrangler);
322  /// Appends a copy of a single polygon to this PolySoup,
323  /// with any vertices whose attributes match being shared among
324  /// polygons in this PolySoup
325  void appendPolygonCopyShared(const GEO_PrimPoly *polygon,
326  GA_VertexWrangler &wrangler, GA_AttributeRefMap &attributemap);
327  /// Appends a copy of a single polygon to this PolySoup,
328  /// with all vertices unique
329  void appendPolygonCopyUnique(
330  const GA_OffsetListRef &polygon, const GA_Detail &srcdetail,
331  GA_VertexWrangler &wrangler);
332  /// Appends a copy of a single polygon to this PolySoup,
333  /// with any vertices whose attributes match being shared among
334  /// polygons in this PolySoup
335  void appendPolygonCopyShared(
336  const GA_OffsetListRef &polygon, const GA_Detail &srcdetail,
337  GA_VertexWrangler &wrangler, GA_AttributeRefMap &attributemap);
338  /// Appends a copy of another PolySoup to this PolySoup,
339  /// with all vertices unique
340  void appendPolySoupCopyUnique(const GEO_PrimPolySoup *that,
341  GA_VertexWrangler &wrangler);
342  /// Appends a copy of another PolySoup to this PolySoup,
343  /// with any vertices whose attributes match being shared among
344  /// polygons in this PolySoup
345  void appendPolySoupCopyShared(const GEO_PrimPolySoup *that,
346  GA_VertexWrangler &wrangler, GA_AttributeRefMap &attributemap);
347 
348  /// Appends a polygon to this PolySoup from an array of vertex offsets
349  /// NOTE: This will not wire the vertices to points or to this primitive,
350  /// so that must be done manually. This assumes the vertices have
351  /// already been added to the GEO_TriMesh level with appendVertex
352  /// or appendVertices.
353  void appendPolygon(const UT_Array<GA_Offset> &vertices);
354 
355  /// Appends polygons to this PolySoup from an array of vertex offsets
356  /// NOTE: This will not wire the vertices to points or to this primitive,
357  /// so that must be done manually. This assumes the vertices have
358  /// already been added to the GEO_TriMesh level with appendVertex
359  /// or appendVertices.
360  void appendPolygons(const GA_PolyCounts &sizes,
361  const GA_OffsetList &vertices);
362 
363  /// Returns true iff none of the vertices of the PolySoup are shared
364  /// among multiple polygons in this PolySoup.
365  /// NOTE: This assumes that every vertex of the PolySoup is in at least
366  /// one polygon in this PolySoup.
367  bool areAllVerticesUnique() const
368  { return myPolygonVertexList.entries() == myVertexList.entries(); }
369 
370  /// Forces all vertices in this polysoup to be unshared, i.e. creates
371  /// new vertices if any are used by multiple polygons in this polysoup.
372  /// NOTE: This assumes that every vertex of the PolySoup is in at least
373  /// one polygon in this PolySoup, since it calls
374  /// areAllVerticesUnique().
375  void makeAllVerticesUnique();
376 
377  /// Optimizes the internal representation of the PolySoup
378  void optimize();
379 
380  /// Remove repeated point offsets in the polygon vertices, optionally
381  /// checking distance to remove points within a specified tolerance,
382  /// then remove all degenerate polygons.
383  GA_Size cleanData(const bool removeNearPoints = false, float tol = 0.001F,
384  bool deleteOrphanedPoints = true);
385 
386  /// Remove polygons that have 0, 1, or 2 vertices, optionally deleting
387  /// orphaned points.
388  GA_Size remove012(bool deleteOrphanedPoints = true);
389 
390  /// Remove vertices that are not used by any of the soup's polygons,
391  /// and optionally remove their points if they are also unused.
392  void deleteUnusedVertices(bool andpoints = true);
393 
394  /// Replaces specified polygons with new polygons using the same vertices,
395  /// which is necessary for convexing. polygonstoremesh must be monotone
396  /// increasing.
397  void remeshPolygons(const UT_Array<GA_Size> &polygonstoremesh,
398  const GA_OffsetList &newvertices,
399  const GA_PolyCounts &newpolygonsizelist);
400 
402  const GA_RangeMemberQuery &point_query,
403  bool dry_run) override;
404 
405  void copyPrimitive(const GEO_Primitive *psrc) override;
406  GEO_Primitive *copy(int preserve_shared_pts) const override;
407  void copyUnwiredForMerge(const GA_Primitive *prim_src,
408  const GA_MergeMap &map) override;
409 
410  /// Defragmentation
411  void swapVertexOffsets(const GA_Defragment &defrag) override;
412 
413 #if 0
414  /// Converts myPolygonVertexList from storing GA_Offsets to storing
415  /// indices into myVertexList.
416  void offsetsToIndirection();
417  /// Converts myPolygonVertexList from indices of myVertexList back
418  /// into GA_Offsets
419  void indirectionToOffsets();
420 #endif
421 
423  {
424  return myPolygonVertexList.entries();
425  }
426 
427  /// These are only here because of C++ compilers erroring on the
428  /// appendVertex function below, thinking it should hide these.
429  /// NOTE: This will not add the vertex to myPolygonVertexList,
430  /// in case it is to be shared, so use
431  /// appendPolygon(const UT_Array<GA_Offset> &vertices)
432  /// to add a polygon with the vertex.
433  /// NOTE: If you leave vertices in the polysoup that are not used by any
434  /// polygons, areAllVerticesUnique() may return incorrect results,
435  /// since it just checks if the size of myPolygonVertexList is
436  /// larger than the size of myVertexList
438  { return GEO_TriMesh::appendVertex(ptoff); }
439 
440  /// This appends one vertex for each of nvertices points starting
441  /// from startptoff, in parallel, and wires them to the points and
442  /// this polysoup, then returns the starting vertex offset. Since
443  /// each point has only one vertex, this applies to making shared
444  /// vertices.
445  /// NOTE: The points can't be used by any other primitives at the
446  /// time that this is called.
447  /// NOTE: If you leave vertices in the polysoup that are not used by any
448  /// polygons, areAllVerticesUnique() may return incorrect results,
449  /// since it just checks if the size of myPolygonVertexList is
450  /// larger than the size of myVertexList
451  GA_Offset appendSharedVertices(GA_Offset startptoff, GA_Size nvertices);
452 
453  void iterateEdges(GA_IterateEdgesFunc apply_func) const override
454  {
455  GA_Detail &detail = getDetail();
456  for (PolygonIterator it(*this); !it.atEnd(); ++it)
457  {
458  if (it.nvertices() == 0)
459  continue;
460  VertexIterator vit(it);
461  const GA_Offset startptoff = detail.vertexPoint(vit.offset());
462  GA_Offset prevptoff = startptoff;
463  for (++vit; !vit.atEnd(); ++vit)
464  {
465  const GA_Offset currptoff = detail.vertexPoint(vit.offset());
466  if (!apply_func(GA_Edge(prevptoff, currptoff)))
467  return;
468  prevptoff = currptoff;
469  }
470  // NOTE: GEO_Face::edgeApply always has a wrapping edge for
471  // closed polygons, even with just 1 or 2 vertices.
472  //if (it.nvertices() > 2)
473  if (!apply_func(GA_Edge(prevptoff, startptoff)))
474  return;
475  }
476  }
477  void iterateEdgesByVertex(GA_IterateEdgesByVertexFunc apply_func) const override;
478 
479  /// This does a linear search through the whole soup.
480  /// You may regret calling it for each edge of a large soup.
481  bool hasEdge(const GA_Edge &edge) const override
482  {
483  GA_Offset a = edge.p0();
484  GA_Offset b = edge.p1();
485  for (PolygonIterator it(*this); !it.atEnd(); ++it)
486  {
487  GA_Size n = it.nvertices();
488  if (n == 0)
489  continue;
490  const GA_Offset startptoff = it.getPointOffset(0);
491  GA_Offset p0 = startptoff;
492  for (GA_Size i = 1; i < n; ++i)
493  {
494  GA_Offset p1 = it.getPointOffset(i);
495  if ( ((p0 == a) && (p1 == b)) || ((p0 == b) && (p1 == a)) )
496  return true;
497  p0 = p1;
498  }
499  // NOTE: GEO_Face::edgeApply always has a wrapping edge for
500  // closed polygons, even with just 1 or 2 vertices, even
501  // though GEO_Face::hasEdge doesn't accept the self-edge
502  // if there's only one vertex.
503  //if (it.nvertices() > 2)
504  GA_Offset p1 = startptoff;
505  if ( ((p0 == a) && (p1 == b)) || ((p0 == b) && (p1 == a)) )
506  return true;
507  }
508  return false;
509  }
510 
512  UT_Array<GA_Offset> &vtxlist,
513  UT_FloatArray &weightlist,
514  fpreal u, fpreal v, fpreal w) const override;
515 
516  /// Create polygon soup(s), i.e. GEO_PrimPolySoup, where possible in dest_detail.
517  /// src_detail *can* be the same as dest_detail.
518  static void convertDetail(GEO_Detail *dest_detail, const GEO_Detail *src_detail, const GEO_PolySoupParms &parms);
519 
520  virtual void convex(GA_Size maxpts = 3, const GA_Detail *restgdp = nullptr,
521  bool flipedges = false, bool avoiddegeneracy = false) = 0;
522 
523 protected:
525  { return GEO_TriMesh::buildFamilyMask(); }
526 
527  // Declare intrinsic definitions
528  GA_DECLARE_INTRINSICS(override)
529 
530  void appendUniqueVertexCopy(const GA_Offset vertex,
531  const GA_Detail &srcdetail,
532  GA_VertexWrangler &wrangler);
533  void appendSharedVertexCopy(const GA_Offset vertex,
534  const GA_Detail &srcdetail,
535  GA_VertexWrangler &wrangler,
536  GA_AttributeRefMap &attributemap);
537 
538  /// Evaluates the position at domain point (u,v) in the interior of the
539  /// geometry, rather than on the perimeter of the poly.
540  /// (Note that u, v don't have to be converted to unit domain. We assume
541  /// that the barycentric coords or bilinear interpolants are already
542  /// correctly scaled).
543  bool evaluateInteriorPointRefMap(GA_Offset result_vtx,
544  GA_AttributeRefMap &hlist,
545  fpreal u, fpreal v, fpreal w) const override;
546  int evaluateInteriorPointV4(UT_Vector4 &pos,
547  fpreal u, fpreal v, fpreal w) const override;
548  int evaluateNormalVector(UT_Vector3 &nml,
549  float u, float v, float w) const override;
550 
551  bool savePrivateH9(std::ostream &, bool binary) const override;
552  bool loadPrivateH9(UT_IStream &) override;
553 
554  GA_PolyCounts myPolygonSizeList;
555  GA_OffsetList myPolygonVertexList;
556 
557 private:
558  friend std::ostream &operator<<(std::ostream &os, const GEO_PrimPolySoup &d)
559  {
560  d.saveH9(os, 0,
563  return os;
564  }
566 };
568 
569 /// Structure for the PolySouping code
571 {
572 public:
576  int minPolys;
577  bool convex;
578  int maxSides;
582 
584  bool ignattr = false,
585  bool igngrp = false,
586  int minp = 1,
587  bool cvx = false,
588  int maxs = 3,
589  bool delprims = true,
591  bool mergeverts = true)
592  : primGroup(pg)
593  , ignorePrimAttributes(ignattr)
594  , ignorePrimGroups(igngrp)
595  , minPolys(minp)
596  , convex(cvx)
597  , maxSides(maxs)
598  , deleteSoupedPrimitives(delprims)
599  , typeMask(mask)
600  , mergeVertices(mergeverts)
601  { }
602 };
603 
604 #endif
605 
SYS_FORCE_INLINE float getW() const
GLuint GLsizei const GLuint const GLintptr const GLsizeiptr * sizes
Definition: glcorearb.h:2620
#define SYSmax(a, b)
Definition: SYS_Math.h:1365
GA_Size getPolygonVertexCount() const
SYS_FORCE_INLINE GA_Detail & getDetail() const
Definition: GA_Primitive.h:132
void getTriangleVertexOffsets(GA_Size start, GA_Offset &v0, GA_Offset &v1, GA_Offset &v2) const
Used to pass options and map offset values during saving.
Definition: GA_SaveMap.h:48
SYS_FORCE_INLINE PolygonIterator & operator=(const PolygonIterator &that)
virtual void copyPrimitive(const GEO_Primitive *src)
void getQuadVertexOffsets(GA_Size start, GA_Offset &v0, GA_Offset &v1, GA_Offset &v2, GA_Offset &v3) const
SYS_FORCE_INLINE fpreal calcPerimeter() const
void iterateEdges(GA_IterateEdgesFunc apply_func) const override
GA_PrimCompat::TypeMask typeMask
GA_Offset getPolygonVertexOffset(const PolygonIterator &it, GA_Size vertexofpolygon) const
virtual GEO_Primitive * copy(int preserve_shared_pts=0) const
GA_Size getPolygonCount() const
Get number of polygons in the soup.
SYS_FORCE_INLINE GA_Offset getPointOffset(GA_Size i) const
#define SYS_DEPRECATED_PUSH_DISABLE()
const GLdouble * v
Definition: glcorearb.h:836
void getMinMaxPolygonSize(GA_Size &mn, GA_Size &mx) const
Return the minimum and maximum number of vertices for any face.
UT_Vector4 getPos4(GA_Offset ptoff) const
The ptoff passed is the point offset.
Definition: GA_Detail.h:248
#define SYS_DEPRECATED_POP_DISABLE()
GLuint start
Definition: glcorearb.h:474
SYS_FORCE_INLINE UT_Vector3 baryCenter() const
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
const GLuint GLenum const void * binary
Definition: glcorearb.h:1923
SYS_FORCE_INLINE GA_Index getPointIndex(GA_Size i) const
SYS_FORCE_INLINE fpreal calcVolume(const UT_Vector3 &refpt) const
The merge map keeps track of information when merging details.
Definition: GA_MergeMap.h:53
A soup of polygons.
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1221
GLint GLuint mask
Definition: glcorearb.h:123
JSON reader class which handles parsing of JSON or bJSON files.
Definition: UT_JSONParser.h:72
#define GA_DECLARE_INTRINSICS(OVERRIDE)
Definition: GA_Primitive.h:79
SYS_FORCE_INLINE GA_Size getVertexCount() const
SYS_FORCE_INLINE UT_Vector3 getPos3(GA_Size i) const
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:32
static GA_PrimitiveFamilyMask buildFamilyMask()
Abstract base class for a range membership query object.
SYS_FORCE_INLINE UT_Vector3 getPos3(GA_Offset ptoff) const
The ptoff passed is the point offset.
Definition: GA_Detail.h:170
Structure for the PolySouping code.
GLfloat GLfloat GLfloat v2
Definition: glcorearb.h:817
virtual GA_DereferenceStatus dereferencePoints(const GA_RangeMemberQuery &pt_q, bool dry_run=false)
virtual void swapVertexOffsets(const GA_Defragment &defrag)
Defragmentation.
GA_EdgeT< GA_Offset, false > GA_Edge
Definition: GA_Edge.h:91
GLfloat GLfloat GLfloat GLfloat v3
Definition: glcorearb.h:818
SYS_FORCE_INLINE bool isClosed() const
VertexIterator operator-(GA_Size i)
png_uint_32 i
Definition: png.h:2877
exint size() const
Definition: UT_Array.h:444
exint GA_Size
Defines the bit width for index and offset types in GA.
Definition: GA_Types.h:211
GA_PrimitiveFamilyMask
GLsizeiptr size
Definition: glcorearb.h:663
virtual UT_Vector3 computeNormal() const =0
Return a normal vector for the primitive.
#define GA_INVALID_OFFSET
Definition: GA_Types.h:654
#define UT_ASSERT_P(ZZ)
Definition: UT_Assert.h:101
GA_Size appendVertex(GA_Offset ptoff) override
GA_Size getPolygonSize(GA_Size polygon) const
Get the number of vertices in the polygon.
GA_Size GA_Offset
Definition: GA_Types.h:617
SYS_FORCE_INLINE GA_Offset getFastVertexOffset(GA_Size i) const
These are just here for interchangeability with GEO_Face.
SYS_FORCE_INLINE GA_Offset getVertexOffset(GA_Size i) const
bool hasEdge(const GA_Edge &edge) const override
GLdouble n
Definition: glcorearb.h:2007
VertexIterator(const PolygonIterator &it, GA_Size vtxnum=0)
SYS_FORCE_INLINE UT_Vector4 getPos4(GA_Size i) const
SYS_FORCE_INLINE fpreal calcArea() const
virtual GA_Size appendVertex(GA_Offset ppt)
virtual fpreal calcArea() const
GA_Size getMaxPolygonSize() const
Return the maximum number of vertices in any face.
bool areAllVerticesUnique() const
GLuint GLuint end
Definition: glcorearb.h:474
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
virtual const GA_PrimitiveJSON * getJSON() const =0
GLintptr offset
Definition: glcorearb.h:664
Provide a JSON interface to a primitive.
#define GEO_API
Definition: GEO_API.h:10
std::function< bool(const GA_Edge &edge)> GA_IterateEdgesFunc
Definition: GA_Primitive.h:72
virtual void computeInteriorPointWeights(UT_Array< GA_Offset > &vtxlist, UT_FloatArray &weightlist, fpreal u, fpreal v, fpreal w) const
virtual void reverse()=0
Reverse the order of vertices.
A handle to simplify manipulation of multiple attributes.
SYS_FORCE_INLINE GA_Index vertexIndex(GA_Offset offset) const
Given a vertex's data offset, return its index.
Definition: GA_Detail.h:459
Options during loading.
Definition: GA_LoadMap.h:42
T p1() const
Definition: GA_Edge.h:33
Defragmentation of IndexMaps.
Definition: GA_Defragment.h:45
SYS_FORCE_INLINE GA_Offset vertexPoint(GA_Offset vertex) const
Given a vertex, return the point it references.
Definition: GA_Detail.h:469
std::function< bool(GA_Size, GA_Size)> GA_IterateEdgesByVertexFunc
Definition: GA_Primitive.h:73
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1221
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
Definition: GA_Types.h:611
const GA_PrimitiveGroup * primGroup
GA_Offset getPolygonVertexOffset(GA_Size polygon, GA_Size vertexofpolygon) const
virtual fpreal calcPerimeter() const
SYS_FORCE_INLINE bool atEnd() const
GLint GLsizei count
Definition: glcorearb.h:404
SYS_FORCE_INLINE UT_Vector3 computeNormal() const
GEO_PolySoupParms(const GA_PrimitiveGroup *pg=0, bool ignattr=false, bool igngrp=false, int minp=1, bool cvx=false, int maxs=3, bool delprims=true, GA_PrimCompat::TypeMask mask=GEO_PrimTypeCompat::GEOPRIMALL, bool mergeverts=true)
SYS_FORCE_INLINE GA_Size start() const
GLfloat v0
Definition: glcorearb.h:815
exint entries() const
Alias of size(). size() is preferred.
Definition: UT_Array.h:446
SYS_FORCE_INLINE GA_Index pointIndex(GA_Offset offset) const
Given a point's data offset, return its index.
Definition: GA_Detail.h:296
Contains transitional objects to provide some backward compatibility for code that references old GEO...
GEO_API const TypeMask GEOPRIMALL
virtual void stashed(bool beingstashed, GA_Offset offset=GA_INVALID_OFFSET)
double fpreal
Definition: SYS_Types.h:263
static const UT_Array< GA_AttribSaveDataH9 > & theEmptySaveAttribs
Convience objects to pass as arguments to saveH9()/loadH9().
SYS_FORCE_INLINE PolygonIterator(const GEO_PrimPolySoup &prim, GA_Size polygon)
GEO_PrimPolySoup(GA_Detail *d, GA_Offset offset=GA_INVALID_OFFSET)
SYS_FORCE_INLINE GA_Index getVertexIndex(GA_Size i) const
GLuint index
Definition: glcorearb.h:785
UT_Vector3 baryCenter() const override
SYS_FORCE_INLINE PolygonIterator(const GEO_PrimPolySoup &prim)
GLfloat GLfloat v1
Definition: glcorearb.h:816
virtual ~GEO_PrimPolySoup()
virtual fpreal calcVolume(const UT_Vector3 &) const
VertexIterator operator+(GA_Size i)
virtual void copyUnwiredForMerge(const GA_Primitive *src, const GA_MergeMap &map)
Container class for all geometry.
Definition: GA_Detail.h:96
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:856
T p0() const
Definition: GA_Edge.h:31
#define const
Definition: zconf.h:214
SYS_FORCE_INLINE GA_Size getFastVertexCount() const
#define SYSmin(a, b)
Definition: SYS_Math.h:1366
void getPolygonVertexRange(GA_Size polygon, GA_Size &start, GA_Size &count) const
T * getArray() const
Definition: UT_Array.h:604
virtual void iterateEdgesByVertex(GA_IterateEdgesByVertexFunc apply_func) const
Definition: GA_Primitive.h:352
static GA_PrimitiveFamilyMask buildFamilyMask()
Definition: GEO_TriMesh.h:250
SYS_FORCE_INLINE const GEO_PrimPolySoup & prim() const
virtual UT_Vector3 baryCenter() const
iteratorT< const GA_PolyCounts, const UT_Array< SizeCount > > & operator=(const iteratorT< const GA_PolyCounts, const UT_Array< SizeCount > > &that)
GA_Size getMinPolygonSize() const
Return the minimum number of vertices in any face.