HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_Detail.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: GU_Detail.h (GU Library, C++)
7  *
8  * COMMENTS:
9  * GU_Detail represents a container for geometry. It contains primitives,
10  * points, vertices, etc. and all of the attributes. It also provides some
11  * conventient methods for manipulating geometry.
12  *
13  */
14 
15 #pragma once
16 
17 #ifndef __GU_Detail_h__
18 #define __GU_Detail_h__
19 
20 #include "GU_API.h"
21 #include "GU_Error.h"
22 #include "GU_PrimitiveFactory.h"
23 #include "GU_SelectType.h"
24 #include "GU_Types.h"
25 
26 #include <GEO/GEO_Detail.h>
27 #include <GEO/GEO_PrimType.h>
28 #include <GEO/GEO_SurfaceType.h>
29 
30 #include <GA/GA_Detail.h>
31 #include <GA/GA_ElementGroup.h>
32 #include <GA/GA_Handle.h>
33 #include <GA/GA_IntrinsicManager.h>
34 #include <GA/GA_OffsetList.h>
35 #include <GA/GA_PrimitiveTypeId.h>
36 #include <GA/GA_Range.h>
37 #include <GA/GA_Types.h>
38 
39 #include <UT/UT_Array.h>
40 #include <UT/UT_ArraySet.h>
41 #include <UT/UT_ErrorManager.h> // for UTgetErrorManager()
42 #include <UT/UT_Map.h>
43 #include <UT/UT_Set.h>
44 #include <UT/UT_SharedPtr.h>
45 #include <UT/UT_StringHolder.h>
46 #include <UT/UT_Vector2.h>
47 #include <UT/UT_Vector3.h>
48 #include <UT/UT_VectorTypes.h>
49 
50 #include <SYS/SYS_Deprecated.h>
51 #include <SYS/SYS_Types.h>
52 #include <SYS/SYS_Visibility.h>
53 #include <SYS/SYS_TypeDecorate.h>
54 
55 #include <iosfwd>
56 
57 
58 class UT_BitArray;
59 class UT_MemoryCounter;
60 template <typename T> class UT_OBBoxT;
62 class UT_StringArray;
63 class UT_WorkBuffer;
64 class UT_XformOrder;
65 template <typename T> class UT_RefMatrix;
66 template <typename T> class UT_VectorT;
68 
69 class GA_Attribute;
70 class GA_BreakpointGroup;
71 class GA_EdgeGroup;
73 class GA_Group;
74 class GA_IndexMap;
75 class GA_NUBBasis;
76 class GA_OffsetMatrix;
77 class GA_Primitive;
79 class GA_SaveOptions;
80 class GA_Stat;
81 namespace GA_PrimCompat { class TypeMask; }
82 
83 class GEO_ConvertParms;
84 class GEO_Curve;
85 class GEO_Delta;
86 class GEO_Face;
87 class GEO_Hull;
88 class GEO_IOTranslator;
90 class GEO_PolySoupParms;
91 class GEO_Primitive;
92 class GEO_PrimPoly;
93 class GEO_PrimPolySoup;
94 class GEO_Rolloff;
96 class GEO_TPSurf;
97 
98 class GU_EdgeDiv;
99 
100 class GU_PrimMesh;
101 class GU_PrimNURBSurf;
102 class GU_PrimPoly;
103 class GU_PrimPolySoup;
104 class GU_PrimRBezSurf;
105 
106 class GU_CookSelectionReplaceStash;
107 
108 // Parameter classes for methods
109 class GU_AlignParms;
110 class GU_CameraParms;
111 class GU_CapOptions;
112 class GU_CapParms;
113 class GU_CreepParms;
114 class GU_CurveClayParms;
116 class GU_EdgeCreaseParms;
117 class GU_ExtrudeParms;
118 class GU_FilletParms;
119 class GU_GridParms;
120 class GU_JoinParms;
121 class GU_LoftParms;
122 class GU_LSystemParms;
123 class GU_MagnetParms;
124 class GU_OffsetParms;
125 class GU_PolyExtrudeParms;
126 class GU_PolypatchParms;
127 class GU_PolyReduceParms;
128 class GU_PolysplineParms;
129 class GU_RailParms;
130 class GU_RevolveParms;
131 class GU_RoundFilletParms;
132 class GU_RuledParms;
133 class GU_SkinCache;
134 class GU_SkinParms;
135 class GU_StitchParms;
136 class GU_SuperQuadParms;
137 class GU_SweepParms;
138 class GU_TorusParms;
139 class GU_TraceParms;
140 class GU_TrimFilletParms;
141 class GU_TwistParms;
142 class GU_WarpParms;
143 
144 class IMX_Attribute;
145 
146 
147 template<typename Prec>
151 
152 extern "C" {
153  SYS_VISIBILITY_EXPORT extern void newGeometryIO(void *);
155 }
156 
157 class gu_ValueLookupCache;
158 
160 {
161 public:
162  /// NOTE: Need an explicit default constructor to work around internal
163  /// compiler error in Visual Studio 2015 Update 3.
164  /// See: https://connect.microsoft.com/VisualStudio/feedback/details/2869531
165  GU_Detail() : GU_Detail(true) {}
166  explicit GU_Detail(bool full_topology)
167  : GEO_Detail(GUgetFactory(), full_topology)
168  {
169  construct();
170  }
171  /// See GEO_Detail::merge() for documentation of the data_id_strategy
172  /// argument.
173  explicit GU_Detail(const GU_Detail *src, GA_PrimitiveGroup *primGroup,
174  GA_DataIdStrategy data_id_strategy = GA_DATA_ID_BUMP)
176  {
177  construct();
178  merge(*src, primGroup,
179  /*mergePrimGroup*/true, /*insertPrimsAtHead*/false,
180  /*keep_internal_groups*/true,
181  data_id_strategy);
182  }
183  /// See GEO_Detail::copy() for documentation of the data_id_strategy
184  /// argument.
185  explicit GU_Detail(const GU_Detail *src,
186  GA_DataIdStrategy data_id_strategy = GA_DATA_ID_BUMP)
188  {
189  construct();
190  copy(*src, GEO_COPY_ONCE,
191  /*collapse_on_end*/false,
192  /*keep_internal_groups*/true,
193  data_id_strategy);
194  }
195 
196  ~GU_Detail() override;
197 
198  /// Compute memory usage (includes all shared memory)
199  int64 getMemoryUsage(bool inclusive) const override;
200 
201  /// Count memory usage using a UT_MemoryCounter in order to count
202  /// shared memory correctly.
203  /// If inclusive is true, the size of this object is counted,
204  /// else only memory owned by this object is counted.
205  /// If this is pointed to by the calling object, inclusive should be true.
206  /// If this is contained in the calling object, inclusive should be false.
207  /// (Its memory was already counted in the size of the calling object.)
208  void countMemory(UT_MemoryCounter &counter, bool inclusive) const override;
209 
210  /// This clears any caches that subclasses of GA_Detail may have, so that
211  /// replacing the content of the detail doesn't cause crashes.
212  void clearCaches() override;
213 
214  void duplicate(const GU_Detail& gdp, int = 0,
215  GA_DataIdStrategy data_id_strategy = GA_DATA_ID_BUMP);
216 
217  /// Create a new detail that has all the same attributes, groups, etc. but
218  /// has no elements.
219  /// Subclasses should look at: cloneCopyGroupsAndAttributes()
220  GA_Detail *cloneEmptyDetail(bool clone_attributes) const override;
221 
222  class RingRef
223  {
224  public:
226  const UT_IntArray &ringvalence)
227  : myRingZero(ringzero)
228  , myRingValence(ringvalence)
229  {
230  }
231 
233  { return myRingZero; }
234  const UT_IntArray & ringValence() const
235  { return myRingValence; }
236 
237  public:
240  };
241 
242  /// This initializes the passed in int array so it is 0 where
243  /// points are a boundary and 1 where they are not a boundary.
244  /// This handles meshes, etc, properly. It doesn't handle non-manifold
245  /// properly. The checkuv flag determines if it should check uv
246  /// boundaries, if set, it will mark as 1 any points which have
247  /// differing UV texture coordinates in their vertices.
248  /// For efficiency, you may call buildRingZero() once and pass the built
249  /// data structures to it.
250  void findBoundaryPoints(
251  UT_BitArray &isboundary,
252  bool checkuv,
253  const RingRef *ringref = nullptr,
254  const UT_StringHolder &uvattribname = "uv"_UTsh) const;
255 
256  /// This takes an array which should be the same size as the number
257  /// of points, and has 1 wherever a point is to be considered
258  /// selected. It then initializes & sets 1 in the isboundary array
259  /// any point which is on the 8-way boundary of the selection.
260  void findSelectionBoundaryPoints(
261  const UT_BitArray &pointselection,
262  UT_BitArray &isboundary) const;
263 
264  /// Fills the ringzero array, (which is indexed by point GA_Index,
265  /// not GA_Offset), with the GA_Offsets of each point's neighbours,
266  /// (i.e. they share an edge in some primitive). It avoids
267  /// duplicates within each point's list of neighbours.
268  /// If ringvalence is non-nullptr, it is filled with the number of
269  /// half-edges each point is part of, i.e. including duplicates
270  /// and both directions.
271  void buildRingZeroPoints(
272  UT_Array<GA_OffsetArray> &ringzero,
273  UT_IntArray *ringvalence = 0) const;
274 
275  /// Fills the ringzero array, (which is indexed by point GA_Index,
276  /// not GA_Offset), with the GA_Offsets of each point's neighbours,
277  /// (i.e. they share an edge in some primitive). It avoids
278  /// duplicates within each point's list of neighbours.
279  /// If ringvalence is non-nullptr, it is filled with the number of
280  /// half-edges each point is part of, i.e. including duplicates
281  /// and both directions.
282  ///
283  /// In this version, an edge is only counted if it is in a primitive
284  /// in primgroup (if non-nullptr). Although only entries for
285  /// points in ptgroup (if non-nullptr) are written-to in ringzero
286  /// and ringvalence (if non-nullptr), neighbours outside of ptgroup
287  /// will be listed.
288  void buildRingZeroPoints(
289  const GA_PointGroup *ptgroup,
290  UT_Array<GA_OffsetArray> &ringzero,
291  UT_IntArray *ringvalence = 0,
292  const GA_PrimitiveGroup *primgroup = 0) const;
293 
294  /// NOTE: Unlike buildRingZeroPoints, the array in buildRingZeroVertices
295  /// is indexed by GA_Offset, not GA_Index, for simplicity.
296  void buildRingZeroVertices(
297  UT_Array<GA_OffsetArray> &ringzero,
298  const GA_PrimitiveGroup *prims=0) const;
299 
300  void buildRingZeroPrimitives(
301  UT_Array<GA_OffsetArray> &ringzero) const;
302 
303  /// Builds a new CEAttribute for the given topology. This is not
304  /// cached internally anywhere, nor does it use any existing cache.
306  GA_Topology::TopologyCE topotype,
309  int &tuplesize,
310  bool isarray,
311  bool read, bool write) const override;
312 
313  //
314  // Build various geometries. Returns the first primitive of the new
315  // geometry.
316  //
317 
318  /// Creates a polygon cube in this detail.
319  /// NOTE: Set doConsolidatePoints to true in order to have
320  /// correctly connected polygons. The default behaviour
321  /// produces disconnected sides!
322  GU_PrimPoly *cube(float xmin = -1, float xmax = 1,
323  float ymin = -1, float ymax = 1,
324  float zmin = -1, float zmax = 1,
325  int xdiv = 0, int ydiv = 0, int zdiv = 0,
326  int enforcementBars = 0,
327  int doConsolidatePoints = 0);
328 
329  GU_PrimNURBSurf *nurbCube(int xdiv, int ydiv, int zdiv,
330  int orderx = 4, int ordery = 4, int orderz=4,
331  float xmin = -0.5F, float xmax = 0.5F,
332  float ymin = -0.5F, float ymax = 0.5F,
333  float zmin = -0.5F, float zmax = 0.5F,
335  bool consolidate = false);
336 
337  GU_PrimRBezSurf *bezCube(int xdiv, int ydiv, int zdiv,
338  int orderx = 4, int ordery = 4, int orderz=4,
339  float xmin = -0.5F, float xmax = 0.5F,
340  float ymin = -0.5F, float ymax = 0.5F,
341  float zmin = -0.5F, float zmax = 0.5F,
343  bool consolidate = false);
344 
345  GU_PrimMesh *meshCube(int xdiv, int ydiv, int zdiv,
346  float xmin = -0.5F, float xmax = 0.5F,
347  float ymin = -0.5F, float ymax = 0.5F,
348  float zmin = -0.5F, float zmax = 0.5F,
350  bool consolidate = false);
351 
352  GU_PrimPoly *polymeshCube(int xdiv, int ydiv, int zdiv,
353  float xmin = -0.5F, float xmax = 0.5F,
354  float ymin = -0.5F, float ymax = 0.5F,
355  float zmin = -0.5F, float zmax = 0.5F,
357  bool consolidate = false);
358 
359  /// Creates a grid in this detail based on parms.
360  /// Returns the offset of the first polygon primitive.
363 
364 
365  /// Builds point representation of a detached attribute
366  /// Returns offset of first point.
367  GA_Offset buildAttributePoints(UT_SharedPtr<const IMX_Attribute> attrib);
368 
369  /// Creates a grid of points in this detail.
370  /// NOTE: If startpoint is valid, it must refer to a *contiguous*
371  /// block of rows*cols point offsets, in which case, this
372  /// just sets point positions, so can be used on polygon
373  /// or polysoup grids with a consistent point order too.
374  /// NOTE: When plane is GU_PLANE_XY, cols corresponds with x, and
375  /// rows corresponds with y.
376  GA_Offset pointGrid(int rows, int cols,
377  float xsize=1, float ysize=1,
378  float xc = 0, float yc = 0, float zc = 0,
380  GA_Offset startpoint = GA_INVALID_OFFSET);
381 
382  /// Creates a grid of polygons in this detail.
383  /// Returns the offset of the first polygon primitive.
384  GA_Offset polyGrid(int rows, int cols,
385  float xsize=1, float ysize=1,
386  float xc = 0, float yc = 0, float zc = 0,
389  /// Creates a grid that is a single polygon soup in this detail.
390  GU_PrimPolySoup *polySoupGrid(int rows, int cols,
391  float xsize=1, float ysize=1,
392  float xc = 0, float yc = 0, float zc = 0,
395  GU_PrimMesh *meshGrid(int rows, int cols,
396  float xsize=1, float ysize=1,
397  float xc = 0, float yc = 0, float zc = 0,
400  int wrapu = 0, int wrapv = 0);
401  GU_PrimNURBSurf *nurbGrid(int rows, int cols,
402  int orderu = 4, int orderv = 4,
403  int interpEndsU = 1, int interpEndsV = 1,
404  float xsize=1, float ysize=1,
405  float xc = 0, float yc = 0, float zc = 0,
408  int wrapu = 0, int wrapv = 0);
409  GU_PrimRBezSurf *bezGrid(int rows, int cols,
410  int orderu = 4, int orderv = 4,
411  float xsize=1, float ysize=1,
412  float xc = 0, float yc = 0, float zc = 0,
415  int wrapu = 0, int wrapv = 0);
416 
417  /// Creates a torus in this detail, based on parms.
418  /// type is one of the values in the enum in GA_PrimitiveTypes.h .
419  /// GA_PRIMPOLY, GA_PRIMPOLYSOUP, GA_PRIMMESH, GA_PRIMBEZSURF,
420  /// and GA_PRIMNURBSURF are supported.
421  void torus(unsigned type, GU_TorusParms &parms);
422 
423  /// poly-iso surfaces
424  /// To find the primitives created, place
425  /// GA_IndexMap::Marker marker(gdp->getPrimitiveMap());
426  /// before the call, and call marker.getRange() afterward.
427  void polyIsoSurface(
428  float (*ptOutside)(const UT_Vector3 &, void *),
429  void *data,
430  const UT_BoundingBox &bbox,
431  int xdiv, int ydiv, int zdiv,
432  bool makepolysoup = false);
433 
434  /// When building a meta-surface, the new surface is built in this
435  /// gdp. If desired, src can be "this" as well...
436  void buildMetaSurface(const GU_Detail *src, float lod,
437  const GA_PrimitiveGroup *primGroup = 0,
438  bool makepolysoup = false);
439 
440  void buildMetaSurface(const GU_Detail *src,
441  int divx, int divy, int divz,
442  const GA_PrimitiveGroup *primGroup = 0,
443  bool makepolysoup = false);
444 
445  /// A faster way of conversion is to build cross sections. However, this
446  /// doesn't build real surfaces
447  void buildMetaXsection(
448  const GU_Detail *src,
449  int nsections,
450  int axis = 2,
451  int maxdepth = 4,
452  const GA_PrimitiveGroup *primGroup = nullptr);
453 
454  //
455  // Geometry filters
456  //
457 
458 
459  /// orient all the polygonal faces to have the same winding direction
460  void orient(const GA_PrimitiveGroup *group = 0);
461 
462  /// inset and extrude a face
463  void extrude(GU_ExtrudeParms &parms);
464 
465  /// create a weighted sum of two source inputs
466  /// This bumps data IDs of any attributes that are modified, and of
467  /// the primitive list, if any primitives are modified.
468  void blend(const GU_Detail *source, float weight,
469  bool doPos, bool doClr, bool doNml, bool doTxt,
470  bool doVoxels, bool doSlerp,
471  const char *ptidattr, const char *primidattr);
472 
473 
474  /// create a weighted sum of size source inputs
475  /// Return 1 if at least one pasted surface was involved in the blend,
476  /// else 0.
477  /// This bumps data IDs of any attributes that are modified, and of
478  /// the primitive list, if any primitives are modified.
479  int blend(const GU_Detail *gdps[], const float weights[],
480  int size, bool doPos, bool doClr,
481  bool doNml, bool doTxt,
482  bool doVoxels, bool doSlerp,
483  const char *ptidattr, const char *primidattr,
484  const GA_PointGroup *ptGroup);
485 
486  /// Transform points to follow surface of path input
487  void creep(GU_CreepParms &parms);
488 
489  /// Consolidate points within a specified distance (returns num done)
490  /// If a point group is specified, then, only points in that
491  /// group are consolidated. If the forceConsAll flag is set then
492  /// all points will be consolidated in a greedy fashion using a
493  /// branch and bound algorithm.
494  SYS_DEPRECATED_HDK_REPLACE(17.5,GU_Snap)
495  GA_Size consolidatePoints(fpreal distance,
496  const GA_PointGroup *ptGrp = 0,
497  bool forceConsAll = false,
498  bool mark = false,
499  bool accurate = false);
500 
501  /// Performs fast consolidation by calling onlyConsolidatePoints.
502  /// By default, calls removeUnused when done to remove any unused points
503  /// When deleteConsOnly is set, then only consolidated points are removed.
504  SYS_DEPRECATED_HDK_REPLACE(17.5,GU_Snap)
505  GA_Size fastConsolidatePoints(fpreal distance,
506  const GA_PointGroup *ptGrp=0,
507  bool mark = false,
508  bool accurate = false);
509 
510  /// Specifies methods by which points after consolidation will
511  /// get their group names. ONLYCONS_GRP_PROP_LEAST means that the
512  /// points will belong to the same group as the original point
513  /// with least point number. ONLYCONS_GRP_PROP_UNION means that the
514  /// points will belong to the full set of groups represented
515  /// by the original points (so if orig. point 1 is in group A, B and
516  /// orig. point 2 is in group B, C, the final point will be in A B C).
517  /// INTERSECT means the point will only belong in groups that are common
518  /// to all original points. With the example above, it will belong in
519  /// B.
521  {
522  ONLYCONS_GRP_PROP_LEAST = 0,
524  ONLYCONS_GRP_PROP_INTERSECT
525  };
526  /// This does fast consolidation but does *not* call removeUnused when
527  /// done. This means that degenerate primitives will be left along
528  /// with orphaned points. If deleteconsolidated is set, the consolidated
529  /// points only will be deleted. grouppropagate controls which groups
530  /// the new points will belong to.
531  SYS_DEPRECATED_HDK_REPLACE(17.5,GU_Snap)
532  GA_Size onlyConsolidatePoints(fpreal distance,
533  const GA_PointGroup *ptgrp = 0,
534  bool mark = false,
535  bool deleteconsolidated = false,
536  OnlyConsGroupPropagateType
537  grouppropagate =
538  ONLYCONS_GRP_PROP_LEAST,
539  bool accurate = false);
540 
541  GA_Size consolidateNormals(fpreal distance,
542  const GA_PointGroup *ptGrp = 0,
543  bool forceConsAll = false,
544  bool accurate = false);
545  GA_Size fastConsolidateNormals(fpreal distance,
546  const GA_PointGroup *ptGrp = 0,
547  bool accurate = false);
548  /// Consolidate UV attributes within a specified distance.
549  /// This distance can be in UV space or XYZ space.
550  /// There are various methods of placing the consolidated UVs.
551  ///
552  /// metric: 0 => UV space
553  /// 1 => XYZ space
554  ///
555  /// method: 0 => Average
556  /// 1 => First in Group
557  /// 2 => Specify uvw coordinate
558  SYS_DEPRECATED_HDK_REPLACE(17.5,GU_Snap)
559  int fastConsolidatePointUVs(float distance,
560  const GA_PointGroup &ptGrp,
561  const GU_MetricType metric,
562  int method,
563  UT_Vector3 &uvw);
564  SYS_DEPRECATED_HDK_REPLACE(17.5,GU_Snap)
565  int fastConsolidatePointUVs(const GA_RWHandleV3 &uvattrib,
566  float distance,
567  const GA_PointGroup &ptGrp,
568  const GU_MetricType metric,
569  int method,
570  UT_Vector3 &uvw);
571  int fastConsolidateVertexUVs(float distance,
572  const GA_VertexGroup &vtxGrp,
573  const GU_MetricType metric,
574  int method,
575  UT_Vector3 &uvw);
576  int fastConsolidateVertexUVs(const GA_RWHandleV3 &uvattrib,
577  float distance,
578  const GA_VertexGroup &vtxGrp,
579  const GU_MetricType metric,
580  int method,
581  UT_Vector3 &uvw);
582 
583  /// Snap points within a specified distance (returns num done)
584  /// If a point group is specified, then, only points in that
585  /// group are consolidated.
586  /// Snapping doesn't fuse the points together, just makes their
587  /// positions match.
588  /// The type is 0 for average, 1 for round to lowest point number
589  /// and 2 for highest point number.
590  /// snappointpos controls whether the point positions will be
591  /// snapped.
592  /// snapptattribs can be set to indicate that point attributes
593  /// are to be snapped.
594  /// ptattribhandles is a list of attribute handles for the
595  /// attributes that will be snapped.
596  SYS_DEPRECATED_HDK_REPLACE(17.5,GU_Snap)
597  GA_Size snapPoints(int type, fpreal distance,
598  const GA_PointGroup *ptgrp=0,
599  bool snapptpos = true,
600  UT_Array<GA_Attribute *> *ptattribs = 0,
601  bool accurate = true);
602 
603  /// Methods for snapping attributes (for use with snapAttributes).
604  /// SNAP_ATTRIBUTE_AVERAGE averages the attributes together.
605  /// SNAP_ATTRIBUTE_INDEX tells snapAttributes to use an index
606  /// into the list of snapped points to set the attributes for
607  /// other points.
609  {
610  SNAP_ATTRIBUTES_AVERAGE = 0,
611  SNAP_ATTRIBUTES_INDEX
612  };
613 
614  /// This version of snapping snaps onto grid coordinates. You specify
615  /// the number of lines per HUnit, so "2" for example will snap to 0.5
616  /// boundaries.
617  /// type is 0 for round nearest, 1 for round down, 2 for round up.
618  /// 0.5 rounds up in nearest.
619  SYS_DEPRECATED_HDK_REPLACE(17.5,GU_Snap)
620  void snapGrid(int type,
621  float xlines, float ylines, float zlines,
622  float xoff, float yoff, float zoff,
623  float tol,
624  const GA_PointGroup *ptGrp=0);
625  /// Same as above, but with UVs...
626  SYS_DEPRECATED_HDK_REPLACE(17.5,GU_Snap)
627  void snapGridPointUVs(int type,
628  float xlines, float ylines, float zlines,
629  float xoff, float yoff, float zoff,
630  float tol,
631  const GA_PointGroup *ptGrp=0);
632  SYS_DEPRECATED_HDK_REPLACE(17.5,GU_Snap)
633  void snapGridPointUVs(
634  const GA_RWHandleV3 &uvattrib, int type,
635  float xlines, float ylines, float zlines,
636  float xoff, float yoff, float zoff,
637  float tol,
638  const GA_PointGroup *ptGrp=0);
639  SYS_DEPRECATED_HDK_REPLACE(17.5,GU_Snap)
640  void snapGridVertexUVs(int type,
641  float xlines, float ylines, float zlines,
642  float xoff, float yoff, float zoff,
643  float tol,
644  const GA_VertexGroup *vtxGrp=0);
645  SYS_DEPRECATED_HDK_REPLACE(17.5,GU_Snap)
646  void snapGridVertexUVs(
647  const GA_RWHandleV3 &uvattrib, int type,
648  float xlines, float ylines, float zlines,
649  float xoff, float yoff, float zoff,
650  float tol,
651  const GA_VertexGroup *vtxGrp=0);
652 
653  /// Build holes in the geometry by bridging the holes to their outlines
654  /// The angle should be specified as the angle (in degrees) between
655  /// the normals.
656  int buildHoles(float dist = 0.001F, float angle = 0.2F,
657  int snapFace=0,
658  const GA_PrimitiveGroup *primGroup=0);
659 
660  /// Remove bridged holes from other than polygons
661  void unHole(const GA_PrimitiveGroup *primGroup=0);
662 
663  /// Unique all points in the detail. If a point group is specified,
664  /// then only points in that group are uniqued
665  /// If a primitive group is specified, only those primitives will
666  /// have their points uniqued.
668  void uniquePoints(const GA_PointGroup *group=0);
669 
670  /// Unique all the points that are in this primitive, even if referenced
671  /// by other primitives.
673  void uniquePrimitive(GEO_Primitive *prim);
674 
675  /// Remove repeated references of vertices in the faces, then remove all
676  /// degenerate primitives regardless of their type.
677  /// Set removeRepPoints flag to remove the repeat points as well and
678  /// the deletePoints flag to delete the points that were part of the
679  /// degenerate primitive.
680  GA_Size cleanData (const GA_PrimitiveGroup *primGrp=0,
681  bool removeRepPoints = false,
682  float tol = 0.001F,
683  bool deleteDegenPrimPoints = false,
684  bool deleteOrphanedPoints = false,
685  bool deleteDegenerateBridges = false);
686 
687  /// Identify dirty data, which is the degenerate primitives that would
688  /// be deleted by cleanData. Return them in the returnGrp, and return
689  /// the number of dirty primitives. If returnGrp is nullptr then only
690  /// return the count.
691  GA_Size getDirtyData (GA_PrimitiveGroup *returnGrp,
692  const GA_PrimitiveGroup *primGrp=0,
693  bool checkRepPoints = false,
694  float tol = 0.001F);
695 
696  /// If the applyToVertex is less than 0, the "natural" place will be use,
697  /// otherwise 0 = point attrib, 1 = vertex attrib
698  /// Returns false if the attribute failed to be created, else true.
699  bool applyTexture(GU_TextureType type, GU_AxisType axis,
700  const GA_PrimitiveGroup *primGroup=0,
701  int applyToVertex = -1, int fixPolySeams = 0,
702  const GU_CameraParms *userData = 0);
703  /// If the applyToVertex is less than 0, the "natural" place will be use,
704  /// otherwise 0 = point attrib, 1 = vertex attrib
705  /// Returns false if the attribute failed to be created, else true.
706  bool applyTexture(const UT_StringRef &uvattribname,
707  GU_TextureType type, GU_AxisType axis,
708  const GA_PrimitiveGroup *primGroup=0,
709  int applyToVertex = -1, int fixPolySeams = 0,
710  const GU_CameraParms *userData = 0);
711  /// The scaleTexture() and rotateTexture() methods are depreciated. Please
712  /// use the GU_MODIFY_TEX projection and simply create the approprate
713  /// post-transform.
714  /// Returns false if the attribute failed to be created, else true.
715  bool scaleTexture(float umult = 1, float uoff = 0,
716  float vmult = 1, float voff = 0,
717  float wmult = 1, float woff = 0,
718  const GA_PrimitiveGroup *primGroup=0);
719  bool scaleTexture(const UT_StringRef &uvattribname,
720  float umult = 1, float uoff = 0,
721  float vmult = 1, float voff = 0,
722  float wmult = 1, float woff = 0,
723  const GA_PrimitiveGroup *primGroup=0);
724  bool rotateTexture(float angle,
725  const GA_PrimitiveGroup *primGroup=0);
726  bool rotateTexture(const UT_StringRef &uvattribname,
727  float angle,
728  const GA_PrimitiveGroup *primGroup=0);
729 
730  /// Methods for transforming point and vertex texture attributes:
731  void transformPointTexture(const UT_Matrix4& mat,
732  const GA_PointGroup *ptGroup=nullptr,
733  GEO_Delta *geodelta=0);
734 
735  void transformPointTexture(
736  const GA_RWHandleV3 &pth,
737  const UT_Matrix4& mat,
738  const GA_PointGroup *ptGroup=nullptr,
739  GEO_Delta *geodelta=0);
740 
741  /// Precompute a list of points to soft transform, along with
742  /// the distance (squared) to the closest "hard" point.
743  /// The metric specifies how distance is measured in space.
744  void computeSoftTransformPointTextureCache(
745  GEO_SoftTransformCache &cache,
746  const GA_PointGroup *ptgroup,
747  const GEO_Rolloff &rolloff,
748  const GU_MetricType metric) const;
749 
750  /// Precompute a list of points to soft transform, along with
751  /// the distance (squared) to the closest "hard" point.
752  /// The metric specifies how distance is measured in space.
753  void computeSoftTransformPointTextureCache(
754  const GA_ROHandleV3 &pttxth,
755  GEO_SoftTransformCache &cache,
756  const GA_PointGroup *ptgroup,
757  const GEO_Rolloff &rolloff,
758  const GU_MetricType metric) const;
759 
760  /// falloff_output - any non-zero falloffs used during this call will be
761  /// written to this attribute when provided
762  /// falloff_written - will be set to true when provided if falloff_output
763  /// is provided, and this call did not skip processing
764  /// any non-zero falloffs. If not set, you must call
765  /// computeSoftPointFalloff() to obtain the falloffs.
766  void softTransformPointTexture(
767  const UT_XformOrder &order,
768  float tx, float ty, float tz,
769  float rx, float ry, float rz,
770  float sx, float sy, float sz,
771  float s_xy, float s_xz, float s_yz,
772  float px, float py, float pz,
773  const GEO_SoftTransformCache &cache,
774  const GEO_Rolloff &rolloff,
775  GEO_Delta *geodelta = 0,
776  const GA_RWHandleF *falloff_output = nullptr,
777  bool *falloff_written = nullptr);
778 
779  /// falloff_output - any non-zero falloffs used during this call will be
780  /// written to this attribute when provided
781  /// falloff_written - will be set to true when provided if falloff_output
782  /// is provided, and this call did not skip processing
783  /// any non-zero falloffs. If not set, you must call
784  /// computeSoftPointFalloff() to obtain the falloffs.
785  void softTransformPointTexture(
786  const GA_RWHandleV3 &ptattr,
787  const UT_XformOrder &order,
788  float tx, float ty, float tz,
789  float rx, float ry, float rz,
790  float sx, float sy, float sz,
791  float s_xy, float s_xz, float s_yz,
792  float px, float py, float pz,
793  const GEO_SoftTransformCache &cache,
794  const GEO_Rolloff &rolloff,
795  GEO_Delta *geodelta = 0,
796  const GA_RWHandleF *falloff_output = nullptr,
797  bool *falloff_written = nullptr);
798 
799  void transformVertexTexture(const UT_Matrix4& mat,
800  const GA_VertexGroup *vertexGroup=nullptr,
801  GEO_Delta *geodelta=0);
802 
803  void transformVertexTexture(
804  const GA_RWHandleV3 &vtxh,
805  const UT_Matrix4& mat,
806  const GA_VertexGroup *vertexGroup=nullptr,
807  GEO_Delta *geodelta=0);
808 
809  /// Precompute a list of vertices to soft transform, along with
810  /// the distance (squared) to the closest "hard" point.
811  /// The metric specifies how distance is measured in space.
812  /// ignore_uv_connectivity controls whether we affect vertices
813  /// which are not in the same uvw-wise connected component.
814  void computeSoftTransformVertexTextureCache(
815  GEO_SoftTransformCache &cache,
816  const GA_VertexGroup *vtxgroup,
817  const GEO_Rolloff &rolloff,
818  const GU_MetricType metric,
819  bool ignore_uv_connectivity) const;
820 
821  /// Precompute a list of vertices to soft transform, along with
822  /// the distance (squared) to the closest "hard" point.
823  /// The metric specifies how distance is measured in space.
824  /// ignore_uv_connectivity controls whether we affect vertices
825  /// which are not in the same uvw-wise connected component.
826  void computeSoftTransformVertexTextureCache(
827  const GA_ROHandleV3 &vtxh,
828  GEO_SoftTransformCache &cache,
829  const GA_VertexGroup *vtxgroup,
830  const GEO_Rolloff &rolloff,
831  const GU_MetricType metric,
832  bool ignore_uv_connectivity) const;
833 
834  /// falloff_output - any non-zero falloffs used during this call will be
835  /// written to this attribute when provided
836  /// falloff_written - will be set to true when provided if falloff_output
837  /// is provided, and this call did not skip processing
838  /// any non-zero falloffs. If not set, you must call
839  /// computeSoftPointFalloff() to obtain the falloffs.
840  void softTransformVertexTexture(
841  const UT_XformOrder &order,
842  float tx, float ty, float tz,
843  float rx, float ry, float rz,
844  float sx, float sy, float sz,
845  float s_xy, float s_xz, float s_yz,
846  float px, float py, float pz,
847  const GEO_SoftTransformCache &cache,
848  const GEO_Rolloff &rolloff,
849  GEO_Delta *geodelta = 0,
850  const GA_RWHandleF *falloff_output = nullptr,
851  bool *falloff_written = nullptr);
852 
853  /// falloff_output - any non-zero falloffs used during this call will be
854  /// written to this attribute when provided
855  /// falloff_written - will be set to true when provided if falloff_output
856  /// is provided, and this call did not skip processing
857  /// any non-zero falloffs. If not set, you must call
858  /// computeSoftPointFalloff() to obtain the falloffs.
859  void softTransformVertexTexture(
860  const GA_RWHandleV3 &vtxh,
861  const UT_XformOrder &order,
862  float tx, float ty, float tz,
863  float rx, float ry, float rz,
864  float sx, float sy, float sz,
865  float s_xy, float s_xz, float s_yz,
866  float px, float py, float pz,
867  const GEO_SoftTransformCache &cache,
868  const GEO_Rolloff &rolloff,
869  GEO_Delta *geodelta = 0,
870  const GA_RWHandleF *falloff_output = nullptr,
871  bool *falloff_written = nullptr);
872 
873  /// This routine will compute the average normal of a group of points.
874  /// Returns true on success and false on failure.
875  /// NOTE: The version that doesn't take a point normal attribute handle
876  /// will temporarily create a detached point normal attribute if a point N
877  /// doesn't already exist. The caller may or may not want to cache
878  /// a detached attribute and pass it in, instead.
879  /// @{
880  bool computeAvgNormal(
881  const GA_PointGroup *group,
882  const GA_ROHandleV3 &normals,
883  UT_Vector3 &avg_normal) const;
884  bool computeAvgNormal(
885  const GA_PointGroup *group,
886  UT_Vector3 &avg_normal) const;
887  /// @}
888 
889  /// Reverse polygons
890  void reversePolys(const GA_PrimitiveGroup *prmGrp=0);
891 
892  /// Conversion Routines - to convert from one primitive to another
893  /// @{
894  /// Performs conversion in-place, removing source primitives
896  /// Performs conversion, keeping the source primitives
897  void convertNew(GEO_ConvertParms &parms);
898  /// @}
899 
900  /// This routine only converts metaballs using a more comprehensive set
901  /// of parameters.
902  void convertMetaballs(
903  GEO_MetaConvertParms &parms,
904  const GA_PrimitiveGroup *prim_grp = nullptr);
905 
906  //
907  // SORTING
908  //
909 
910  /// Sort by the specified dominant axis
911  /// @{
912  void sortPoints(GA_IndexMap &array,
913  GU_AxisType axis = GU_XAXIS)
914  { sortPoints(array, GA_Range(array), axis); }
915  void sortPoints(GA_IndexMap &array, const GA_Range &range,
916  GU_AxisType axis);
917  void sortPoints(GA_OffsetArray &array,
918  GU_AxisType axis = GU_XAXIS);
919  void sortPrims(GA_IndexMap &array,
920  GU_AxisType axis = GU_XAXIS)
921  { sortPrims(array, GA_Range(array), axis); }
922  void sortPrims(GA_IndexMap &array, const GA_Range &range,
923  GU_AxisType axis);
925  { sortPoints(getIndexMap(GA_ATTRIB_POINT), axis); }
927  { sortPrims(getIndexMap(GA_ATTRIB_PRIMITIVE), axis); }
928  /// @}
929 
930  /// Sorting by spatial locality. The points and primitives will be
931  /// sorted in a way that tries to assign nearby primitives closer
932  /// primitive ids.
933  /// @{
935  { sortPointsSpatial(GA_Range(getPointMap())); }
936  void sortPointsSpatial(const GA_Range &range);
938  { sortPrimsSpatial(GA_Range(getPrimitiveMap())); }
939  void sortPrimsSpatial(const GA_Range &range);
940  /// @}
941 
942  /// Sort along an arbitrary vector
943  /// @{
944  void sortPoints(GA_IndexMap &array,
945  const UT_Vector3 &o, const UT_Vector3 &d)
946  { sortPoints(array, GA_Range(array), o, d); }
947  void sortPoints(GA_IndexMap &array, const GA_Range &range,
948  const UT_Vector3 &o, const UT_Vector3 &d);
949  void sortPrims(GA_IndexMap &array,
950  const UT_Vector3 &o, const UT_Vector3 &d)
951  { sortPrims(array, GA_Range(array), o, d); }
952  void sortPrims(GA_IndexMap &array, const GA_Range &range,
953  const UT_Vector3 &o, const UT_Vector3 &d);
954  void sortPointList(const UT_Vector3 &o, const UT_Vector3 &d)
955  { sortPoints(getIndexMap(GA_ATTRIB_POINT), o, d); }
957  const UT_Vector3 &d)
958  { sortPrims(getIndexMap(GA_ATTRIB_PRIMITIVE), o, d); }
959  /// @}
960 
961  /// Sort in random order
962  /// @{
963  void sortPoints(GA_IndexMap &array, int seed);
964  void sortPrims(GA_IndexMap &array, int seed);
965  void sortPointList(int seed)
966  { sortPoints(getIndexMap(GA_ATTRIB_POINT), seed); }
967  void sortPrimitiveList(int seed)
968  { sortPrims(getIndexMap(GA_ATTRIB_PRIMITIVE), seed); }
969  /// @}
970 
971  /// Sorting according to a provided value list
972  /// The order is indexed by the GA_Index of the elemnents, NOT the
973  /// GA_Offset or order within the range.
974  /// @{
976  { sortElements(array, GA_Range(array), order); }
978  { sortElements(array, GA_Range(array), order); }
979  void sortElements(GA_IndexMap &array, const GA_Range &range,
980  fpreal *order);
981  void sortElements(GA_IndexMap &array, const GA_Range &range,
982  exint *order);
984  { sortElements(getIndexMap(GA_ATTRIB_POINT), order); }
986  { sortElements(getIndexMap(GA_ATTRIB_POINT), order); }
988  { sortElements(getIndexMap(GA_ATTRIB_PRIMITIVE), order); }
990  { sortElements(getIndexMap(GA_ATTRIB_PRIMITIVE), order); }
991  /// @}
992 
993  /// Sort according to a component an attribute
994  /// @{
995  void sortElements(const GA_Range &range,
996  const GA_Attribute *order,
997  int component=0);
998  /// @}
999 
1000  /// "Rotate" (cycle) the order of vertices for all primitives in the group,
1001  /// by the specified number of places.
1002  void shift(int uoffset, int voffset,
1003  const GA_PrimitiveGroup *group = nullptr);
1004 
1005  /// "Rotate" (cycle) the order of points or primitives in the detail, by the
1006  /// specified number of places.
1007  /// @{
1009  { shiftPoints(map, GA_Range(map), offset); }
1011  { shiftPrims(map, GA_Range(map), offset); }
1012  void shiftPoints(GA_IndexMap &map, const GA_Range &range,
1013  GA_Size offset);
1014  void shiftPrims(GA_IndexMap &map, const GA_Range &range,
1015  GA_Size offset);
1016  void shiftPointList(GA_Size aoffset)
1017  { shiftPoints(getIndexMap(GA_ATTRIB_POINT), aoffset); }
1019  { shiftPrims(getIndexMap(GA_ATTRIB_PRIMITIVE), aoffset); }
1020  /// @}
1021 
1022  /// Reverse vertices for all primitives in the group
1023  /// This sill also reverse point normals, vertex normals, and correct
1024  /// creaseweight attriutes if update_attributes is requested.
1025  void reverse(const GA_PrimitiveGroup *group = nullptr,
1026  bool update_attributes = true);
1027 
1028  /// Reverse order of points or primitives in the detail.
1029  /// @{
1031  { reversePoints(map, GA_Range(map)); }
1033  { reversePrims(map, GA_Range(map)); }
1034  void reversePoints(GA_IndexMap &map, const GA_Range &range);
1035  void reversePrims(GA_IndexMap &map, const GA_Range &range);
1037  { reversePoints(getIndexMap(GA_ATTRIB_POINT)); }
1039  { reversePrims(getIndexMap(GA_ATTRIB_PRIMITIVE)); }
1040  /// @}
1041 
1042  /// Sort points or primitives by proximity to a position
1043  /// @{
1045  const UT_Vector3 &point)
1046  { proximityPoints(points, GA_Range(points), point); }
1047  void proximityPrims(GA_IndexMap &primitives,
1048  const UT_Vector3 &point)
1049  { proximityPrims(primitives, GA_Range(primitives), point); }
1050  void proximityPoints(GA_IndexMap &points,
1051  const GA_Range &range,
1052  const UT_Vector3 &point);
1053  void proximityPrims(GA_IndexMap &primitives,
1054  const GA_Range &range,
1055  const UT_Vector3 &point);
1057  { proximityPoints(getIndexMap(GA_ATTRIB_POINT), point); }
1059  { proximityPrims(getIndexMap(GA_ATTRIB_PRIMITIVE), point); }
1060  /// @}
1061 
1062  /// Sort points by the order in which they are first referred-to by
1063  /// vertices.
1064  /// @{
1066  { vertexOrder(points, GA_Range(points)); }
1067  void vertexOrder(GA_IndexMap &points, const GA_Range &range);
1069  { vertexOrder(getIndexMap(GA_ATTRIB_POINT)); }
1070  /// @}
1071 
1072  /// Create a mesh primitive or polygon primitives representing a
1073  /// super-quadric surface specified by parms.
1074  void superEllipsoid(const GU_SuperQuadParms &parms);
1075 
1076  /// Split the specified polygon into convex polygons with at most
1077  /// maxpts vertices each. By default, this triangulates the polygon.
1078  /// If flipedges is true, it will flip edges to get the Delaunay
1079  /// triangulation, avoiding small angles where possible.
1080  /// If avoiddegeneracy is true, degenerate triangles will not be generated;
1081  /// note that this means that the mesh may not be watertight or even
1082  /// connected.
1083  void convexPoly(GEO_PrimPoly *pp, GA_ElementWranglerCache &wranglers,
1084  GA_Size maxpts = 3, const GA_Detail *restgdp=0,
1085  bool flipedges = false, bool avoiddegeneracy = false);
1086  /// Split polygons in the specified polygon soup into convex polygons
1087  /// with at most maxpts vertices each. By default, this triangulates the
1088  /// polygon. If flipedges is true, it will flip edges to get the Delaunay
1089  /// triangulation, avoiding small angles where possible.
1090  /// If avoiddegeneracy is true, degenerate triangles will not be generated;
1091  /// note that this means that the mesh may not be watertight or even
1092  /// connected.
1093  void convexPolySoup(GEO_PrimPolySoup *polysoup,
1094  GA_Size maxpts = 3, const GA_Detail*restgdp=0,
1095  bool flipedges = false,
1096  bool avoiddegeneracy = false);
1097  /// Split polygons (including in polygon soups) in the detail into convex
1098  /// polygons with at most maxpts vertices each. By default, this
1099  /// triangulates the polygon. If flipedges is true, it will flip edges to
1100  /// get the Delaunay triangulation, avoiding small angles where possible.
1101  /// If avoiddegeneracy is true, degenerate triangles will not be generated;
1102  /// note that this means that the mesh may not be watertight or even
1103  /// connected.
1104  void convex(GA_Size maxpts=3, const GA_PrimitiveGroup *primGroup=0,
1105  const GA_Detail *restgdp=0, bool flipedges = false,
1106  bool avoiddegeneracy = false);
1107 
1108  /// Add non-planar polygon primitives to nonplanargroup.
1109  GA_Size findNonPlanar(
1110  GA_PrimitiveGroup *nonplanargroup,
1111  float tol = 0.0001F,
1112  const GA_PrimitiveGroup *searchprimgroup = nullptr);
1113 
1114  /// Clip primitives, keeping everything where dot(normal, P) >= d.
1115  /// If clippts is true, disconnected points are also clipped.
1116  void clip(UT_Vector3 &normal, float d = 0, int normlize = 0,
1117  const GA_PrimitiveGroup *primGroup = 0,
1118  bool clippts = false);
1119 
1120  /// Clip the primitives that lie beneath the plane.
1121  /// If fill is true, fills in the on-plane edges with polygons.
1122  /// If on_edges is non-nullptr, adds the edges that lie on the plane.
1123  /// If on_prims is non-nullptr, adds the primitives that lie partially or
1124  /// entirely on the plane.
1125  /// If filled_polygons is non-nullptr, adds the filled in polygons.
1126  void clip(
1127  bool fill,
1128  const UT_Vector3F &origin,
1129  const UT_Vector3F &normal,
1130  fpreal tolerance = 0.00001,
1131  const GA_PrimitiveGroup *group = nullptr,
1132  GA_EdgeGroup *on_edges = nullptr,
1133  GA_PrimitiveGroup *on_polygons = nullptr,
1134  GA_PrimitiveGroup *filled_polygons = nullptr);
1135 
1136 //
1137 // Polygon creasing
1138  void crease(UT_Vector3 &normal, float d = 0,
1139  int normlize = 0, int outputGroups = 0,
1140  GA_PrimitiveGroup *above = 0,
1141  GA_PrimitiveGroup *below = 0,
1142  const GA_PrimitiveGroup *creaseGroup = 0);
1143 
1144  /// Crease the polygons where they intersect with the plane.
1145  /// If split is true, the creased polygons are disconnected at the plane.
1146  /// If fill is true, the creased polygons are split and then filled in.
1147  ///
1148  /// If on_edges is non-nullptr, adds the edges that lie on the plane.
1149  /// If on_prims is non-nullptr, adds polygons that lie partially or entirely
1150  /// on the plane, or other prims types with bounds that intersect the plane.
1151  /// If above_prims is non-nullptr, adds the primitives above the plane.
1152  /// If below_prims is non-nullptr, adds the primitives below the plane.
1153  /// If fill_polygons is non-nullptr, adds the filled polygons.
1154  void crease(bool split,
1155  bool fill,
1156  const UT_Vector3F &origin,
1157  const UT_Vector3F &normal,
1158  fpreal tolerance = 0.00001,
1159  const GA_PrimitiveGroup *group = nullptr,
1160  GA_EdgeGroup *on_edges = nullptr,
1161  GA_PrimitiveGroup *on_prims = nullptr,
1162  GA_PrimitiveGroup *above_prims = nullptr,
1163  GA_PrimitiveGroup *below_prims = nullptr,
1164  GA_PrimitiveGroup *filled_polygons = nullptr);
1165 
1166 //
1167 // fractals
1168  void fractalize(int seed = 1, float roughness = 0.6F,
1169  float scaleby=1, int divs=1,
1170  int fixedBoundry = 1, int useVtxNorms = 0,
1171  // Null means "N"
1172  const char *nmlattribname = nullptr,
1173  float nx = 0, float ny = 0, float nz = 1,
1174  const GA_PrimitiveGroup *fractalGroup = 0);
1175 
1176  //
1177  // Shrink Wrap and tools
1178 
1179  /// This routine is originally developed for the Bullet RBD solver to adjust
1180  /// the geometry of a convex 3D polygon to remove the space around the geometry
1181  /// caused by the collision margin required for the Bullet solver.
1182  void shrink( fpreal distance,
1183  fpreal clip_tolerance = 0.0001,
1184  fpreal consilidate_tolerance = 0.001);
1185 
1186  /// preliminary routine to setup the gdp to be shrunk by the shrink routine
1187  bool tetrahedralizeForShrink( const GA_PointGroup *ptGroup = 0,
1188  GU_Detail *gdp = 0 );
1189 
1190 
1191  /// Twist operations. The method returns 0 if everything goes OK, else -1.
1192  /// "pasted" returns 1 if at least one pasted surface was involved in
1193  /// the deformation, else 0.
1194  int nonLinearDeform(GU_DeformType type,const GU_TwistParms &parms,
1195  int &pasted);
1196 
1197  /// NOTE: This is something specific to NURBS surfaces and it uses
1198  /// pasted surface primitives, so it's probably not what you want!!!
1199  /// Creates an offset surface from the specified surface & radius.
1200  GEO_Hull *offset(const GU_OffsetParms &parms);
1201 
1202  /// Create a Gordon surface out of the given bi-linear network of faces.
1203  /// The faces don't have to be the same type or order or anything.
1204  /// We return the surface if OK and 0 otherwise. If the u or v faces
1205  /// contain only one face, we automatically generate a final curve. If
1206  /// both u faces and vfaces have 1 curve or one has 2 and the other 1,
1207  /// we generate a Coons surface. "accurate" is used when the curves do not
1208  /// intersect (i.e. when we must compute their min distances).
1209  /// @{
1210  GEO_Hull *gordon(GEO_SurfaceType surftype, int accurate,
1211  const GA_PrimitiveGroup &ufaces,
1212  const GA_PrimitiveGroup &vfaces,
1213  int reparameterize = 0);
1214  GEO_Hull *gordon(GEO_SurfaceType surftype, int accurate,
1215  const UT_Array<GEO_Primitive*> &uprims_in,
1216  const UT_Array<GEO_Primitive*> &vprims_in,
1217  GU_SkinCache& skin_cache,
1218  int reparameterize = 0);
1219  /// @}
1220 
1221  /// Generate a Coons surface out of up to 4 boundary curves. Return a
1222  /// pointer to the surface if successful and 0 otherwise. The faces do
1223  /// not have to have the same type or order.
1224  GEO_Hull *coons(GEO_SurfaceType surftype,
1225  const GEO_Face &uface1, const GEO_Face &vface1,
1226  const GEO_Face *uface2 = 0, const GEO_Face *vface2 = 0);
1227 
1228  /// Generate a skinned surface out of a set of cross-sections. The faces
1229  /// don't have to be the same type or order. We return the surface is OK
1230  /// and 0 otherwise. Specifying a vorder of 0 tells the method to
1231  /// come up with a legal default value for the surface. If "doskin" is
1232  /// true, the cross-sections will be right on the surface; otherwise, we
1233  /// build a ruled surface, which simply steals the curves' CVs and assigns
1234  /// them to the surface.
1235  GEO_Hull *skin(GU_SkinParms &parms, GU_SkinCache& skin_cache);
1236 
1237  /// This restrictive skinning method assumes the faces are of the same type
1238  /// and have the same number of CVs. order 0 means pick most suitable one.
1239  /// If doskin is false, we build a ruled surface. nprims is the number
1240  /// of faces in the group; we compute it if -1. We return the resulting
1241  /// surface and do not delete the input faces. We also assume that if
1242  /// nprims > 2 and vorder != 2 and doskin, all the faces are nonrational.
1243  /// Finally, the provided vParmValues if given specifies what v coordinate
1244  /// each of the provided faces should interpolate.
1245  /// @{
1246  GEO_Hull *skin(const GA_PrimitiveGroup &ucfaces,
1247  GEO_SurfaceType surftype = GEO_PATCH_QUADS,
1248  unsigned vorder = 0, int vwrap = 0,
1249  int doskin = 1, int nprims = -1,
1250  const UT_Vector *vParmValues = 0);
1251  GEO_Hull *skin(const UT_Array<GEO_Primitive*> & prims_in,
1252  GU_SkinCache& skin_cache,
1253  GEO_SurfaceType surftype = GEO_PATCH_QUADS,
1254  unsigned vorder = 0, int vwrap = 0,
1255  int doskin = 1, int nprims = -1,
1256  const UT_Vector *vParmValues = 0);
1257  /// @}
1258 
1259  /// See GU_Ruled.h for the various closure and interpolation types
1260  /// which are valid. Specifying an orderv of 0 makes the routine
1261  /// come up with a legal default value for the surface.
1262  int ruled( GEO_Hull *&surface, const GU_RuledParms &p,
1263  const GU_CapOptions &caps);
1264 
1265  /// This is what the Skin SOP and Sweep SOP use for skinning
1266  /// cross-sections.
1267  /// See GU_CurveNetwork.h for parameter types. This method generates
1268  /// a skinned surface, a Coons surface, or a Gordon surface depending on
1269  /// the primitive groups it is given. Specifying an orderv of 0 makes the
1270  /// routine come up with a legal default value for the surface.
1271  int curveNetwork(GEO_Hull *&hull, GU_CurveNetworkParms &p,
1272  int &count, GU_SkinCache& skin_cache);
1273 
1274  GU_ERROR sweep( GU_SweepParms parms );
1275  void rails( GU_RailParms parms );
1276 
1277  /// Join more faces or surfaces together.
1278  GEO_Primitive *join( GU_JoinParms &p, int &count);
1279 
1280  /// Generate a fillet between two curves on surfaces:
1281  GEO_Hull *filletTrims(GU_TrimFilletParms &parms, int &count);
1282 
1283  /// Generate a rounded fillet:
1284  GEO_Hull *filletRound(GU_RoundFilletParms &parms);
1285  /// NOTE: The first 5 columns of the matrix must be GEO_Curve*,
1286  /// and the other 2 columns of the matrix must be GEO_TPSurf*.
1287  void filletRoundNetwork(
1288  const UT_RefMatrix<GEO_Primitive *> &facematrix,
1290 
1291  /// Fillet a set of faces/hulls
1292  /// Return 0 if OK, -1 otherwise (non face/hull types)
1293  int fillet(GU_FilletParms &parms, int &count);
1294 
1295  /// Loft (stitch) a number of polygons together without changing the number
1296  /// of points in the detail.
1297  /// @{
1298  void loft(GU_LoftParms &p, const GA_PointGroup &g1,
1299  const GA_PointGroup &g2);
1300  void loft(GU_LoftParms &p,
1301  const GA_PrimitiveGroup *group = 0);
1302  /// @}
1303 
1304  /// Revolves all curves in the given gdp (or only curves in the
1305  /// group if the group is given) around a line given by the center
1306  /// and axis. Only polygonal curves use the divisions. NURBS and
1307  /// Bezier curves are revolved a special way to create a perfectly
1308  /// round surface with a minimum number of revolution copies.
1309  int revolve( const GU_RevolveParms &parms,
1310  const GU_CapOptions &caps, int &count);
1311 
1312  /// Warp curves or surfaces. Return 0 if successful and -1 otherwise.
1313  int warp(GU_WarpParms &parms);
1314 
1315  /// Curve Clay it!
1316  GU_ERROR curveClay(const GU_CurveClayParms &ccparm);
1317 
1318  /// This puts endcaps on the specified hull
1319  int endCap(GEO_Hull &hull, const GU_CapParms &parms);
1320  int endCap(GEO_Face &face, const GU_CapParms &parms);
1321 
1322  /// This places all caps on the hull
1323  int setCaps(GEO_Hull &hull, const GU_CapOptions &parms, int &count);
1324  int setCaps(GEO_Face &face, const GU_CapOptions &parms, int &count);
1325 
1326  /// Creates a deformed copy of a source detail given a pair of
1327  /// rest and deform details. Return 1 if a pasted surface was deformed,
1328  /// else 0. If 'deform_history' is passed in, every time we deform a point
1329  /// from our source, we mark this by setting the bit in 'deform_history'
1330  /// whose index corresponds to the point's number to 1. Useful if you want
1331  /// to know which points we deformed.
1332  int lattice(const GU_Detail *source,
1333  const GU_Detail *lattice_rest,
1334  const GU_Detail *lattice_deform,
1335  int xdiv, int ydiv, int zdiv,
1336  const GA_PointGroup *ptgroup = nullptr,
1337  UT_BitArray *deform_history = nullptr,
1339 
1340  /// All points of the gdp are deformed according to the meta source
1341  /// field that surrounds it. The deformation is controlled by a
1342  /// transformation matrix.
1343  int magnet( const GU_MagnetParms &parms );
1344 
1345  /// trace a raster image to form closed polygons
1346  float trace(GU_TraceParms *parms);
1347 
1348  /// add point texture attributes to traced geometry
1349  void applyTraceTexture(float xres, float yres, float resolution);
1350 
1351 
1352  /// fit a sequence of discrete points to a series of bezier curves
1353  void fit2DCurve(const GU_Detail *source, float error_squared,
1354  GA_PrimitiveGroup *primGroup = 0);
1355 
1356  /// Fit a curve through its breakpoints
1357  /// @{
1358  GEO_Curve *interpCurveBreakpoints(const GEO_Face &face,
1360  int order=4,
1362  GEO_Curve *interpCurveBreakpoints(const GA_OffsetList &point_offsets,
1364  int order=4, int wrapped=0,
1366  GEO_Curve *interpCurveBreakpoints(const UT_Vector4Array &v4Data,
1368  int order=4, int wrapped=0,
1370  const bool elevate_order_if_required = true);
1371  /// @}
1372 
1373  /// interpolation data points
1374  /// @{
1375  GEO_Curve *interpCurveGlobal(const GEO_Face &face,
1377  int order=4,
1380  GEO_Curve *interpCurveGlobal(const GA_OffsetList &point_offsets,
1382  int order=4, int wrapped=0,
1385  GEO_Curve *interpCurveGlobal(const GA_Range &point_range,
1387  int order=4, int wrapped=0,
1390  GEO_Curve *interpCurveGlobal(const UT_Vector4Array &v4Data,
1392  int order=4, int wrapped=0,
1395  const bool elevate_order_if_required = true);
1396  GEO_Curve *interpCurveLocal(const GEO_Face &face,
1398  int order = 4, int corner=0);
1399  GEO_Curve *interpCurveLocal(const UT_Array<GA_Offset> &goData,
1401  int order = 4, int wrapped=0, int corner=0);
1402  GEO_Curve *interpCurveLocal(const UT_Vector4Array &v4Data,
1404  int order = 4, int wrapped=0, int corner=0);
1405 
1406  GEO_TPSurf *interpSurfGlobal(const GEO_Hull &mesh,
1408  int uOrder=4, int vOrder=4,
1414  const UT_Vector *uParmValues = 0,
1415  const UT_Vector *vParmValues = 0);
1416 
1417  GEO_TPSurf *interpSurfGlobal(const GA_OffsetMatrix &goMesh,
1419  int uOrder=4, int vOrder=4,
1420  bool uWrapped=false, bool vWrapped=false,
1426  const UT_Vector *uParmValues = 0,
1427  const UT_Vector *vParmValues = 0);
1428 
1429  GEO_TPSurf *interpSurfBreakpoints(const GEO_Hull &mesh,
1431  int uOrder=4, int vOrder=4,
1437  const UT_Vector *uParmValues = 0,
1438  const UT_Vector *vParmValues = 0);
1439 
1440  GEO_TPSurf *interpSurfBreakpoints(const GA_OffsetMatrix &goMesh,
1442  int uOrder=4, int vOrder=4,
1443  bool uWrapped=false, bool vWrapped=false,
1449  const UT_Vector *uParmValues = 0,
1450  const UT_Vector *vParmValues = 0);
1451  /// @}
1452 
1453  /// Approximate data points given a tolerance.
1454  /// Only for open endinterpolated surface.
1455  /// @{
1456  GEO_Curve *approxCurveGlobal(const GEO_Face &face,
1458  int order=4,
1459  float tol=1e-1F, float smooth=0.0F,
1460  int noMultipleKnots=1);
1461  GEO_Curve *approxCurveGlobal(const UT_Vector4Array &v4Data,
1463  int order=4, int wrapped=0,
1464  float tol=1e-1F, float smooth=0.0F,
1465  int noMultipleKnots=1);
1466 
1467  GEO_TPSurf *approxSurfGlobal(const GEO_Hull &mesh,
1469  int uOrder=4, int vOrder=4,
1471  float tol=1e-1F, float smooth=0.0F,
1472  int uNoMultipleKnots=1,
1473  int vNoMultipleKnots=1);
1474  GEO_TPSurf *approxSurfGlobal(const GA_OffsetMatrix &gpMesh,
1476  int uOrder=4, int vOrder=4,
1477  int uWrapped=0, int vWrapped=0,
1479  float tol=1e-1F, float smooth=0.0F,
1480  int uNoMultipleKnots=1,
1481  int vNoMultipleKnots=1);
1482  /// @}
1483 
1484  /// methods to refine face and hull types
1485  /// @{
1486  void refine(float *uunit, int ulen,
1487  float *vunit, int vlen,
1488  int countu=1, int countv=1,
1489  int arcspacing = 0,
1490  const GA_PrimitiveGroup *primGroup = 0);
1491 
1492  void unrefine(float umin, float umax,
1493  float vmin, float vmax,
1494  int countu=1, int countv=1,
1495  float utol=0.001F, float vtol=0.001F,
1496  const GA_PrimitiveGroup *primGroup = 0);
1497 
1498  void subdivide(float *uunit, int ulen,
1499  float *vunit, int vlen,
1500  int arcspacing = 0,
1501  const GA_PrimitiveGroup *primGroup = 0);
1502 
1503  /// Parameter pack for how to scale uunit+ulen domains by attributes.
1504  /// The attribute is a primitive attribute.
1505  /// NOTE: If scaling is present, internal divisions will be rebuilt
1506  /// to evenly distriubte the end points.
1508  {
1510 
1511  bool hasScale() const
1512  {
1513  return scale1.isValid() || scale2.isValid();
1514  }
1515  float apply(GA_Offset off, float uval, int side) const
1516  {
1517  // Select which side to read from:
1518  const GA_ROHandleF &gah = side ? scale2 : scale1;
1519 
1520  if (!gah.isValid()) return uval;
1521  return gah.get(off) * uval;
1522  }
1523  float apply(const GEO_Primitive *prim, float uval, int side) const;
1524  };
1525 
1526  /// op = {0 = isoparms, 1 = points, 2 = profiles}
1527  int extract(float *uunit, int ulen,
1528  float *vunit, int vlen,
1529  const GA_PrimitiveGroup *primGroup = 0,
1530  GA_PointGroup *newPoints = 0,
1531  int op = 0, int keepOriginal = 0,
1532  int atbreakpoints = 0, int use_arc_length = 0,
1533  DomainScaleAttribs uscale = DomainScaleAttribs(),
1534  DomainScaleAttribs vscale = DomainScaleAttribs());
1535 
1536  void extractIsoParms(float *uunit, int ulen,
1537  float *vunit, int vlen,
1538  GA_PrimitiveGroup *newPrims = 0,
1539  const GA_PrimitiveGroup *primGroup = 0,
1540  DomainScaleAttribs uscale=DomainScaleAttribs(),
1541  DomainScaleAttribs vscale=DomainScaleAttribs());
1542 
1543  void extractPoints(float *uunit, int ulen,
1544  float *vunit, int vlen,
1545  GA_PointGroup *newPoints = 0,
1546  const GA_PrimitiveGroup *primGroup = 0,
1547  bool use_arc_length = false,
1548  DomainScaleAttribs uscale=DomainScaleAttribs(),
1549  DomainScaleAttribs vscale=DomainScaleAttribs());
1550 
1551  void extractProfiles(float *uunit, int ulen,
1552  float *vunit, int vlen,
1553  const GA_PrimitiveGroup *primGroup = 0,
1554  DomainScaleAttribs uscale=DomainScaleAttribs(),
1555  DomainScaleAttribs vscale=DomainScaleAttribs());
1556 
1557  void extractIsoParmsAtBreak(float *uunit, int ulen,
1558  float *vunit, int vlen,
1559  GA_PrimitiveGroup *newPrims = 0,
1560  const GA_PrimitiveGroup *primGroup = 0,
1561  DomainScaleAttribs uscale=DomainScaleAttribs(),
1562  DomainScaleAttribs vscale=DomainScaleAttribs());
1563 
1564  void extractPointsAtBreak(float *uunit, int ulen,
1565  float *vunit, int vlen,
1566  GA_PointGroup *newPoints = 0,
1567  const GA_PrimitiveGroup *primGroup = 0,
1568  bool use_arc_length = false,
1569  DomainScaleAttribs uscale=DomainScaleAttribs(),
1570  DomainScaleAttribs vscale=DomainScaleAttribs());
1571 
1572  void extractProfilesAtBreak(float *uunit, int ulen,
1573  float *vunit, int vlen,
1574  const GA_PrimitiveGroup *primGroup = 0,
1575  DomainScaleAttribs uscale=DomainScaleAttribs(),
1576  DomainScaleAttribs vscale=DomainScaleAttribs());
1577 
1578 
1579  int cut(float *uunit, int ulen,
1580  float *vunit, int vlen,
1581  const GA_PrimitiveGroup *primGroup = 0,
1582  int keepin=1, int keepout=0, int atbreakpoints = 0,
1583  int allU = 0, int allV = 0, int use_arc_length = 0,
1584  DomainScaleAttribs uscale = DomainScaleAttribs(),
1585  DomainScaleAttribs vscale = DomainScaleAttribs());
1586  /// @}
1587 
1588 
1589  /// approximate a spline by using polygonal hull inputs
1590  /// deletes existing polygons if deleteAll is true
1591  void polySpline(GU_PolysplineParms &parms,
1592  const GA_PrimitiveGroup *primGroup = 0,
1593  bool deleteAll = true);
1594 
1595  /// approximate a patch by using polygonal or mesh hull inputs
1596  /// Returns true on success, else false if an error occurred.
1597  bool polyPatch(GU_PolypatchParms &parms,
1598  const GA_PrimitiveGroup *primGroup = 0);
1599 
1600  /// reduce the number of polygons in a detail:
1601  int polyReduce(GU_PolyReduceParms &parms,
1602  const GA_PrimitiveGroup *primGroup = 0,
1603  int *pointIndexTable = 0);
1604 
1605  /// Create polygon soup(s), i.e. GU_PrimPolySoup, where possible in this detail
1606  void polySoup(const GEO_PolySoupParms &parms , const GU_Detail *srcdetail);
1607 
1608  /// Create geometry through premise and rule substitution
1609  void lsystem(GU_LSystemParms &lp);
1610 
1611  /// Get information about a GU_Detail
1612  /// If maxlines < 0, there will be no limit to the number of groups
1613  /// If overridememusage is positive, it will be used rather than the
1614  /// getMemoryUsage().
1615  int info(std::ostream &os,
1616  int max_group_lines=15,
1617  bool pretty=false,
1618  const UT::ArraySet<const void *> *dontcounttheseblocks = 0,
1619  bool instanced=false) const;
1620  /// Get information text for the geometry. This will @b append to the work
1621  /// buffer.
1622  void info(UT_WorkBuffer &wbuf,
1623  int max_group_lines=15,
1624  bool pretty=false,
1625  const UT::ArraySet<const void *> *dontcounttheseblocks = 0,
1626  bool instanced=false) const;
1627 
1628  /// Fills in a stat structure with the volume information.
1629  void statVolumes(GA_Stat &stat, uint level/*=0xffff*/) const override;
1630 
1631  /// @c intersectRay will find the closest intersection with a primitive
1632  /// in the detail. If the dist pointer is nil, then the first intersection
1633  /// found will be returned (instead of the closest). The nml will contain
1634  /// the normal for the primitive at the point of intersection.
1635  /// Accuracy of 0 is inaccurate, 1 is normal, 2 engages Algebraic pruning
1636  /// where available.
1637  ///
1638  /// @param o The ray origin
1639  /// @param d The ray directin
1640  /// @param tmax This can be used to limit the ray to intersections within
1641  /// the given radius.
1642  /// @param tol Intersection tolerance
1643  /// @param dist Return the distance from the origin to the hit
1644  /// @param pos Return the hit position (i.e. <tt>o + dist*d</tt>)
1645  /// @param nml Return the normal of the primitive at the hit position
1646  /// @param accurate Determine primitive intersection algorithms for NURBS
1647  /// @param u The u parametric coordinate of the hit surface
1648  /// @param v The v parametric coordinate of the hit surface
1649  /// @param ignoretrim Ignore trim inside/out tests for trimmed surfaces.
1650  ///
1651  /// @warning If the @c dist parameter is 0 the first hit found will be
1652  /// returned. This may @b not be the closest hit. This can be used to
1653  /// perform a quick check to see if @b any primitives intersect the ray
1654  /// (i.e. for shadow casting).
1655  ///
1656  /// @warning This function iterates over all primitives without any
1657  /// acceleration structure. If you need to send multiple rays, please see
1658  /// GU_RayIntersect.
1659  SYS_DEPRECATED_HDK(16.0)
1660  GEO_Primitive *intersectRay(const UT_Vector3 &o, const UT_Vector3 &d,
1661  float tmax = 1E17F, float tol = 1E-12F,
1662  float *dist = 0, UT_Vector3 *pos = 0,
1663  UT_Vector3 *nml = 0, int accurate = 0,
1664  float *u = 0, float *v = 0,
1665  int ignoretrim = 1) const;
1666 
1667  /// Figure out the parameters of the face/surface that all the given
1668  /// faces/surfaces should have in order to be fully compatible with one
1669  /// another. Return 0 if all the primitive types are faces/surfaces,
1670  /// and -1 otherwise.
1671  /// @{
1672  int commonFaceConfig(
1673  const GA_PrimitiveGroup &faceGroup,
1674  GA_PrimCompat::TypeMask &type, int &order,
1675  bool &open, bool &ends) const;
1676  int commonFaceConfig(
1677  const UT_Array<GEO_Primitive*> &faces_in,
1678  GA_PrimCompat::TypeMask &type, int &order,
1679  bool &open, bool &ends) const;
1680  int commonSurfaceConfig(const GA_PrimitiveGroup &surfs,
1681  GA_PrimCompat::TypeMask &type,
1682  int &orderu, int &orderv,
1683  bool &openu, bool &openv,
1684  bool &endsu, bool &endsv) const;
1685  /// @}
1686 
1687  /// Incompatible faces in infaces are made compatible and set in outfaces.
1688  /// Return 0 of OK, -1 otherwise. If extratype is not nil and the highest
1689  /// face type of the infaces is less than *extratype, replace the common
1690  /// type by *extratype. In the method that takes 2 input groups, we make
1691  /// sure that the primitives in the 2 groups have the same type. Set
1692  /// equalcvs to true make them all have the same number of CVs too.
1693  /// @{
1694  int makeFacesCompatible(
1695  const GA_PrimitiveGroup &infaces,
1696  GA_PrimitiveGroup &outfaces,
1697  bool mustopen = false,
1698  bool mustends = false,
1699  bool nonrational = false,
1700  GA_PrimCompat::TypeMask *extratype = 0,
1701  bool equalcvs = true);
1702  int makeFacesCompatible(
1703  const UT_Array<GEO_Primitive*> &prims_in,
1704  UT_Array<GEO_Primitive*>& prims_out,
1705  bool mustopen = false,
1706  bool mustends = false,
1707  bool nonrational = false,
1708  GA_PrimCompat::TypeMask *extratype = 0,
1709  bool equalcvs = true);
1710  int makeFacesCompatible(
1711  const GA_PrimitiveGroup &infacesU,
1712  const GA_PrimitiveGroup &infacesV,
1713  GA_PrimitiveGroup &outfacesU,
1714  GA_PrimitiveGroup &outfacesV,
1715  bool mustopen = false,
1716  bool mustends = false,
1717  bool nonrational = false,
1718  GA_PrimCompat::TypeMask *extratype = 0,
1719  bool equalcvs = true);
1720  int makeFacesCompatible(
1721  const UT_Array<GEO_Primitive*> &ufaces_array,
1722  const UT_Array<GEO_Primitive*> &vfaces_array,
1723  UT_Array<GEO_Primitive*> &ucfaces_array,
1724  UT_Array<GEO_Primitive*> &vcfaces_array,
1725  bool mustopen = false,
1726  bool mustends = false,
1727  bool nonrational = false,
1728  GA_PrimCompat::TypeMask *extratype = 0,
1729  bool equalcvs = true);
1730  /// @}
1731 
1732  /// Loft a subsection of each hull and update the vertex indices where
1733  /// the subsection occurs. Does partial nurb merging if the bases is given
1734  /// Assumes the two hulls have been properly reconfigured.
1735  static int loftHulls(GEO_Hull *left, GEO_Hull *right,
1736  float lwidth1, float lwidth2,
1737  float rwidth1, float rwidth2,
1738  int sharp, int &lstart, int &rstart,
1739  int &lmax, int &rmax,
1740  int loftU, GA_NUBBasis *nubbasis);
1741 
1742  /// Refine the hull at the unit domain value and return the
1743  /// row/col index where it occurs
1744  /// @{
1745  static int getSubdividedCV(GEO_Hull *hull, int udir, float unit);
1746  static int getSubdividedCV(GEO_Face *face, float unit);
1747  /// @}
1748 
1749  /// Methods for registering and unregistering geometry io converters.
1750  /// @{
1751  static void registerIOTranslator(GEO_IOTranslator *trans);
1752  static void unregisterIOTranslator(GEO_IOTranslator *trans);
1753  static exint getIOTranslatorCount();
1754  static const GEO_IOTranslator *getIOTranslator(exint i);
1755  /// @}
1756 
1757  GA_Detail::IOStatus saveH9File(const char *filename,
1758  const GA_SaveOptions *options) const;
1759  static GA_Detail::IOStatus statH9File(const char *filename,
1760  GA_Stat &sbuf, uint level);
1761 
1762  /// Returns true if filename is a recognized extension.
1763  static bool isFormatSupported(const char *filename);
1764 
1765  /// Allocate an IO handler for a filename, or return nullptr if the handler
1766  /// is the classic format. The returned translator must be deleted. The
1767  /// easiest way to do this is with a UT_UniquePtr: @code
1768  /// UT_UniquePtr<GEO_IOTranslator> xlate(getSupportedFormat(filename));
1769  /// if (xlate)
1770  /// xlate->fileSave(gdp, ...);
1771  /// @endcode
1772  static GEO_IOTranslator *getSupportedFormat(const char *filename);
1773 
1774  /// Align a set of primitives by rotation and translation
1775  void align(GU_AlignParms &parms);
1776 
1777  /// Align a set of faces/hulls at optional levels of continuity.
1778  /// face/hull pre/posttranslate + row stitching + row tangent
1779  /// Faces are aligned with faces, hulls with hulls.
1780  /// Return 0 if OK, -1 otherwise (non face/hull types)
1781  int stitch(GU_StitchParms &parms);
1782 
1783  /// Incompatible surfaces in insurfs are made compatible and set in outsurfs.
1784  /// Return 0 of OK, -1 otherwise. If extratype is not nil and the highest
1785  /// surface type of the insurfs is less than *extratype, replace the common
1786  /// type by *extratype. Set equalcvs to true make them all have the same number
1787  /// of CVs too.
1788  int makeSurfacesCompatible(
1789  const GA_PrimitiveGroup &insurfs,
1790  GA_PrimitiveGroup &outsurfs,
1791  bool mustopenu=false, bool mustopenv=false,
1792  bool mustendsu=false, bool mustendsv=false,
1793  bool equalcvsu=true, bool equalcvsv=true,
1794  GA_PrimCompat::TypeMask *extratype = 0);
1795 
1796  /// Error Routines
1797  /// @{
1798  GU_ERROR error() const
1799  {
1800  return UTgetErrorManager()->getSeverity();
1801  }
1802 
1804  const char *msg = 0) const
1805  {
1806  UTgetErrorManager()->addMessage("GU", code, msg);
1807  }
1809  const char *msg = 0) const
1810  {
1811  UTgetErrorManager()->addWarning("GU", code, msg);
1812  }
1813  void addError(GU_ErrorCodes code, const char *msg = 0) const
1814  {
1815  UTgetErrorManager()->addError("GU", code, msg);
1816  }
1817  /// @}
1818 
1819  /// Returns a cook selection to fill in. If an already existing cook
1820  /// selection exists, of the wrong type, it is removed, and a new one
1821  /// created. Otherwise the existing cook selection is optionally cleared
1822  /// and returned.
1823  ///
1824  /// The cook selection is the selection being manipulated and displayed
1825  /// by a node.
1826  GU_SelectionHandle getOrCreateCookSelection(GA_GroupType group_type,
1827  bool ordered = false,
1828  bool clear_matching = false);
1829 
1830  /// Returns the group type of the current cook selection, or
1831  /// GA_GROUP_INVALID if there isn't one.
1832  GA_GroupType getCookSelectionGroupType() const;
1833 
1834  /// Creates a cook selection that directly references the supplied group.
1835  /// Any changes to the cook selection later will copy this group and use
1836  /// that copy.
1837  ///
1838  /// You must call removeCookSelection() if this group is later destroyed
1839  /// and the cook selection is still referencing it, which can be checked
1840  /// by calling hasShallowCookSelectionReference(group).
1841  ///
1842  /// NB: Only use this method if you know what you're doing. Any gains in
1843  /// performance are likely not to be worth the management pain.
1844  GU_SelectionHandle createShallowCookSelection(GA_Group *group);
1845 
1846  /// Returns whether this detail has a shallow cook selection referencing
1847  /// the specified group.
1848  bool hasShallowCookSelectionReference(
1849  const GA_Group *group) const;
1850 
1851  /// Returns the current cook selection;
1852  GU_SelectionHandle cookSelection() const;
1853 
1854  /// Removes the current cook selection from this detail. Since the selection
1855  /// is a shared object, there's no guarantee that it will be immediately
1856  /// destroyed, but only that this detail is no longer associated with it.
1857  void removeCookSelection();
1858 
1859  /// Bumps the data ids of the internal groups used by the cook selection
1860  /// if the selection revision has changed.
1861  void updateCookSelectionDataIds();
1862 
1863  /// Call this before the replaceWith() call when intending to follow up
1864  /// with a replaceCookSelection() call.
1865  //
1866  /// Assumes a fresh GU_CookSelectionReplaceStash instance.
1867  void stashCookSelectionBeforeReplaceWith(
1868  GU_CookSelectionReplaceStash &stash) const;
1869 
1870  /// Replace the current cook selection with a copy of the source detail's,
1871  /// with optimizations to avoid copying things that are the same.
1872  ///
1873  /// This method is intended to be called as a follow up to replaceWith(),
1874  /// and assumes that this detail is already essentially a copy of the
1875  /// source, possibly with only a subset of the attributes and groups.
1876  ///
1877  /// An optional GU_CookSelectionReplaceStash, populated by a previous
1878  /// call to stashCookSelectionBeforeReplaceWith(), can allow reusing the
1879  /// original GU_CookSelection instance in certain situations.
1880  void replaceCookSelection(
1881  const GU_Detail &src,
1882  GU_CookSelectionReplaceStash *stash);
1883 
1884  /// Do not use this method unless you know EXACTLY what you are doing. It
1885  /// forces the use of the supplied cook selection.
1886  void forceCookSelection(GU_SelectionHandle sel);
1887 
1888  /// Do not use this method unless you know EXACTLY what you are doing. It
1889  /// removes the cook selection from the detail without orphaning it so the
1890  /// only safe thing to do is to return it later using forceCookSelection().
1891  GU_SelectionHandle stealCookSelection();
1892 
1893  /// Remove points from polygons if they lie on (within a tolerance)
1894  /// the line connecting the previous and next points.
1895  void removeInlinePoints(float tol,
1896  const GA_PrimitiveGroup *prims,
1897  const GA_PointGroup *pts = nullptr);
1898 
1899  /// Remove zero area polygons
1900  /// Returns number of polygons removed
1901  /// @{
1902  GA_Size removeZeroAreaFaces(GA_PrimitiveGroup *grp,
1903  bool ignoreOpenFaces = false,
1904  float tolerance = 0.001F,
1905  bool onlyPolys = true);
1906  GA_Size removeZeroAreaFaces(const UT_IntArray &primlist,
1907  bool ignoreOpenFaces = false,
1908  float tolerance = 0.001F,
1909  bool onlyPolys = true);
1910  /// @}
1911 
1912  /// Deletes the geometry in the given group, unlike deleteEdges,
1913  /// it doesn't repair the holes left behind.
1914  void deleteGroupGeometry(const GA_Group &group);
1915 
1916  /// Deletes edge geometry
1917  SYS_DEPRECATED_HDK(16.0)
1918  void deleteEdges(GA_EdgeGroup &edgegroup,
1919  bool del_inline_points,
1920  float inlinetol,
1921  bool del_unused_points = true,
1922  bool del_bridges = true);
1923 
1924  /// There are three different ways of handling situations where all edges
1925  /// that connect polygon boundaries are dissolved.
1926  /// - GU_BRIDGEMODE_BRIDGE @n
1927  /// Insert bridge edges to connect the boundary loops.
1928  /// - GU_BRIDGEMODE_DISJOINT @n
1929  /// Create a separate polygon for each boundary loop.
1930  /// - GU_BRIDGEMODE_DELETE @n
1931  /// Delete the polygons.
1933  {
1936  GU_BRIDGEMODE_DELETE
1937  };
1938  void dissolveEdges(const GA_EdgeGroup &edgegroup,
1939  bool del_inline_points,
1940  fpreal inlinetol,
1941  bool del_unused_points,
1942  BridgeMode bridge_mode,
1943  bool del_degenerate_bridges,
1944  bool boundary_curves);
1945 
1946  /// Flips edges
1947  void flipEdges(const GA_EdgeGroup &edgegroup,
1948  int rotations = 1,
1949  bool rotattribs = false,
1950  GA_EdgeGroup *outedges = 0);
1951  /// Splits edges
1952  /// This is the main method for the PolySplit SOP. The splitlocs are
1953  /// the positions along which you wish to split polygons. When quadcut
1954  /// is false, the Shortest Path algorithm is used, otherwise the Quad Cut
1955  /// algorithm is used. The forcecut flag is used with the Shortest Path
1956  /// algorithm to force it to perform cuts where the initial cut has failed.
1957  /// To form a complete path of edges, supply the first location again as
1958  /// the last location in the splitlocs array. If quadcomplete is true and
1959  /// quadcut is false, then in certain cases extra edges will be inserted so
1960  /// that faces which began as quads get split into faces which are quads. If
1961  /// outPositions is set, it will be filled with a list of points in the path
1962  /// in RE_PRIM_LINES fashion. If fixEnds is set, either end of the path that
1963  /// is on a face will be given an extra segment to connect it to the nearest
1964  /// point to ensure that the resulting polygons don't self-intersect.
1965  void edgeSplit(const GU_SplitLocArray &splitlocs,
1966  bool quadcut = false,
1967  bool forcecut = true,
1968  GA_EdgeGroup *outedges = 0,
1969  float tolerance = SYS_FTOLERANCE,
1970  bool quadcomplete = false,
1971  bool modifyGdp = true,
1972  UT_Fpreal32Array *outPositions = nullptr,
1973  bool fixEnds = false,
1974  bool grpExcludeExtraEdges = false);
1975 
1976  /// Inserts points on edges
1977  /// @{
1978  void divideEdges(const GA_EdgeGroup &edgegroup, int numdivs = 1,
1979  bool applytoall = true,
1980  bool use_shared_points = false,
1981  GA_EdgeGroup *outedges = 0,
1982  UT_Array<GA_Offset> *new_points = 0,
1983  bool preserve_edge_dir = false);
1984  void divideEdges(const GA_EdgeGroup &edgegroup,
1985  int numdivs,
1986  bool applytoall,
1987  bool use_shared_points,
1988  GA_EdgeGroup *outedges,
1989  UT_Array<GA_Offset> *new_points,
1990  bool preserve_edge_dir,
1991  float fraction);
1992  /// @}
1993 
1994  /// Inserts points on edges, with a different fraction and number of
1995  /// divisions per edge.
1997  void divideEdges(const UT_Array<GU_EdgeDiv *> &divlocs,
1998  GA_PointGroup &outgrp);
1999 
2000  /// Transform breakpoints
2001  void transformBreakpoints(const UT_Matrix4 &mat,
2002  const GA_BreakpointGroup *grp = 0,
2003  int quickxform = 0);
2004 
2005 
2006  /// Extrude faces, uses local face spaces and tries to mirror extrusions.
2007  void polyExtrude(const GU_PolyExtrudeParms &parms);
2008 
2009  /// Collapse Edges
2010  void edgeCollapse(const GA_EdgeGroup &edgegroup,
2011  bool removedegen = true,
2012  bool updatenmls = true,
2013  GA_PointGroup *outpoints = nullptr,
2014  const UT_Array<GA_Attribute *> *connect_attrib = nullptr);
2015 
2016  /// Adds crease weights to edges
2017  void edgeCrease(const GU_EdgeCreaseParms &parms);
2018 
2019  /// Insets points
2020  void pointInset(const GA_PointGroup *ptgroup,
2021  float insetdist, float nmldist);
2022 
2023  /// Find the oriented bounding box that contains the given primitives.
2024  /// The box is returned as a rotate+translate matrix to the box's
2025  /// orientation and centre, and a vector containing the boxes extents
2026  /// along its primary axes. The extents are radii, ie, one-half
2027  /// of what a bounding box size() would be.
2028  ///
2029  /// Returns zero radii if the group contains no primitives.
2030  void getOBBox(const GA_PrimitiveGroup *grp,
2032  UT_Vector3 &radii) const;
2033  /// Return the oriented bounding box that contains the given primitives,
2034  /// returning a UT_OBBox, which contains translation and rotation information
2035  void getOBBoxForPrims(const GA_PrimitiveGroup *grp,
2036  UT_OBBoxD &obb,
2037  int refinement_iterations = 6) const;
2038  /// Return the oriented bounding box that contains the given points,
2039  /// returning a UT_OBBox, which contains translation and rotation information
2040  void getOBBoxForPoints(const GA_PointGroup *grp,
2041  UT_OBBoxD &obb,
2042  int refinement_iterations = 6) const;
2043 
2044  /// Get cached bounding box. This uses the meta cache count and the data
2045  /// id on P to determine whether the bounds need to be recomputed.
2046  ///
2047  /// It's possible that the cached bounds might be invalid in some cases
2048  /// (where the geometry is modified without updates to the meta cache count
2049  /// or the data id on P.
2050  bool getCachedBounds(UT_BoundingBox &box) const;
2051 
2052  /// Get cached visible bounding box
2053  ///
2054  /// This uses the meta cache count and the data id on P to determine
2055  /// whether the bounds need to be recomputed.
2056  ///
2057  /// It's possible that the cached bounds might be invalid in some cases
2058  /// (where the geometry is modified without updates to the meta cache count
2059  /// or the data id on P.
2060  bool getCachedVisibleBounds(UT_BoundingBox &box) const;
2061 
2062  /// Forcibly clear all cached bounds (including the cached visible bounds)
2063  /// without having to update the meta cache count or data ID on P.
2064  void clearCachedBounds();
2065 
2066  /// Make each primitive planar, returns the number of primitives xformed
2067  GA_Size makePrimsPlanar(const GA_PrimitiveGroup *grp = 0);
2068 
2069  static void loadIODSOs();
2070  static bool runDSO(const char* lib_path);
2071 
2072  /// Create a list of all internal file extensions
2073  static void getFileExtensions(UT_StringArray &result);
2074 
2075  /// Check to see whether the file extension matches a known binary file
2076  /// extension. The argument is the full filename.
2077  static bool matchBinaryFileExtension(const UT_StringRef &filename);
2078 
2079  /// Check to see whether the file extension matches a known ASCII file
2080  /// extension. The argument is the full filename.
2081  static bool matchASCIIFileExtension(const UT_StringRef &filename);
2082 
2083 
2084  /// These methods assume no changes have been made to the geometry since the
2085  /// last call to incrementMetaCacheCount(). "attrib" should refer to a string
2086  /// or integer attribute.
2087  exint getUniqueValueCount(const GA_Attribute *attrib) const;
2088  exint getUniqueIntegerValue(const GA_Attribute *attrib, exint idx) const;
2089  const UT_StringHolder &getUniqueStringValue(const GA_Attribute *attrib, exint idx) const;
2090  GA_Range getRangeByValue(const GA_Attribute *attrib, exint v) const;
2091  GA_Range getRangeByValue(const GA_Attribute *attrib, const UT_StringRef &v) const;
2092 
2093 
2094  class AttribValueLookupTable;
2095  class AttribSingleValueLookupTable;
2096 
2097  const AttribValueLookupTable *getLookupTable(const GA_Attribute *attrib) const;
2098  const AttribSingleValueLookupTable *getSingleLookupTable(const GA_Attribute *attrib) const;
2099 
2100  // Creates a copy of the detail keeping the same UniqueId and
2101  // MetaCacheCount if copy_unique_id is true.
2102  // This is used by SOP_Cache to make different details act as the same.
2103  GU_Detail *cloneForCache(bool copy_unique_id) const;
2104 
2105  // Creates a copy of the detail keeping the same UniqueId and
2106  // MetaCacheCount if copy_unique_id is true.
2107  // This version Can write to an existing detail.
2108  // If copy_detail is false, the replaceWith call is skipped.
2109  void cloneForCache(GU_Detail &dest, bool copy_unique_id, bool copy_detail=true) const;
2110 
2111  /// Converts a UT_Options into attributes
2112  /// Uses UT_EncodeVar to encode illegal names
2113  void createAttributesFromOptions(const UT_Options *opts,
2114  const GA_AttributeOwner owner,
2115  const GA_Offset offset);
2116 
2117 protected:
2118  /// Register intrinsic attributes
2119  static GA_IntrinsicManager::Registrar
2120  registerIntrinsics(GA_PrimitiveFactory &factory);
2121 
2122 private:
2123  int twist (const GU_TwistParms &parms, int &p);
2124  int bend (const GU_TwistParms &parms, int &p);
2125  int squashStretch (const GU_TwistParms &parms, int &p);
2126  int shear (const GU_TwistParms &parms, int &p);
2127  int taper (const GU_TwistParms &parms, int &p);
2128  int linearTaper (const GU_TwistParms &parms, int &p);
2129 
2130  template <typename ArrayType>
2131  GEO_Curve * privateInterpCurveGlobal(
2132  const ArrayType &gpData,
2133  const GA_PrimitiveTypeId &type,
2134  int order, int wrapped,
2135  GA_ParameterizationType parmType,
2136  GA_KnotSpaceType knotSpaceType);
2137 
2138  void fillGrid(GEO_Hull &hull, int rows, int cols,
2139  float x_size, float y_size,
2140  float x_center, float y_center,
2141  float z_center,
2142  GU_OrientationType plane);
2143 
2144  void convertPolysToHull(
2145  GEO_ConvertParms &parms,
2146  bool keep_original);
2147  void convertToSoups(
2148  GEO_ConvertParms &parms,
2149  bool keep_original);
2150  void convertVolumesToVDBs(
2151  GEO_ConvertParms &parms,
2152  bool keep_original);
2153  void convertVDBsToVolumes(
2154  GEO_ConvertParms &parms,
2155  bool keep_original);
2156  void convertVolumesToPolys(
2157  GEO_ConvertParms &parms,
2158  bool keep_original);
2159  void convertMetasToPolys(
2160  GEO_ConvertParms &parms,
2161  bool keep_original);
2162  void convertTetsToPolys(
2163  GEO_ConvertParms &parms,
2164  bool keep_original);
2165  void doConversion(
2166  GEO_ConvertParms &parms,
2167  bool keep_original);
2168 
2169  void orientPoly(GEO_PrimPoly *poly,
2171  UT_BitArray &reverse);
2172 
2173  GEO_Primitive *surfCube(int xdiv, int ydiv, int zdiv,
2174  int orderx, int ordery, int orderz,
2175  float xmin, float xmax,
2176  float ymin, float ymax,
2177  float zmin, float zmax,
2178  GEO_SurfaceType type, int kind,
2179  bool consolidate);
2180 
2181  // Checks if a single primitive is dirty (see getDirtyData).
2182  bool isDirtySinglePrimitive(GA_Primitive *prim,
2183  bool checkRepPoints,
2184  float tol);
2185 
2186  void lodConvert(GA_PrimitiveGroup *grp,
2187  UT_BoundingBox &box, int cluster, float lod,
2188  bool makepolysoup = false);
2189  void divisionConvert(GA_PrimitiveGroup *grp, int adjust,
2190  UT_BoundingBox &box, int divx,int divy,int divz,
2191  const UT_Array<GA_PrimitiveGroup *> &groups,
2192  bool makepolysoup = false);
2193  int adjustStepBox(float &min, float &max, float step);
2194  void stepSizeConvert(GA_PrimitiveGroup *grp, int adjust,
2195  UT_BoundingBox &box, float sx,float sy,float sz,
2196  const UT_Array<GA_PrimitiveGroup *> &groups,
2197  bool makepolysoup = false);
2198 
2199  /// makes a single primitive planar (see makePrimsPlanar)
2200  bool primToPlane(GEO_Primitive *pprim,
2201  GA_PointGroup &fixedPoints);
2202 
2203 
2204  /// Prohibited to avoid accidentally passing by value.
2205  /// Use constructor that takes a const GU_Detail * if you
2206  /// really need to construct a copied detail.
2207  GU_Detail(const GU_Detail &src);
2208 
2209  friend class GU_PrimitiveFactory; // For intrinsic registration
2210 
2211  void construct()
2212  {
2213  myBoundingCache = nullptr;
2214  myVisibleBoundingCache = nullptr;
2215  myValueLookupCache = nullptr;
2216  }
2217 
2218  /// The sole cook selection associated with this detail.
2219  GU_SelectionHandle myCookSelection;
2220 
2221  template <bool VISIBLE_ONLY> class BoundingCacheT;
2222 
2223  template <bool VISIBLE_ONLY>
2224  static bool getCachedBoundsImpl(
2225  const GU_Detail &geo,
2226  UT_BoundingBox &box,
2227  BoundingCacheT<VISIBLE_ONLY> *&cache);
2228 
2229  mutable BoundingCacheT<false> *myBoundingCache;
2230  mutable BoundingCacheT<true> *myVisibleBoundingCache;
2231 
2232  mutable gu_ValueLookupCache *myValueLookupCache;
2233 };
2234 
2236 
2237 #endif
virtual void clearCaches()
Definition: GA_Detail.h:1952
A class to manage an ordered array which has fixed offset handles.
Definition: GA_IndexMap.h:63
void sortPrims(GA_IndexMap &array, const UT_Vector3 &o, const UT_Vector3 &d)
Definition: GU_Detail.h:949
UT_ErrorSeverity getSeverity()
GA_API const UT_StringHolder dist
Definition of a geometry attribute.
Definition: GA_Attribute.h:203
SYS_VISIBILITY_EXPORT void newGeometryIO(void *)
GT_API const UT_StringHolder filename
virtual UT_UniquePtr< GA_CEAttribute > buildTopologyCEAttribute(GA_Topology::TopologyCE topotype, GA_StorageClass storage, GA_Precision precision, int &tuplesize, bool isarray, bool read, bool write) const
GU_MetricType
Definition: GU_Types.h:87
GLenum GLint * range
Definition: glcorearb.h:1925
GLdouble GLdouble GLint GLint const GLdouble * points
Definition: glad.h:2676
void sortElements(GA_IndexMap &array, fpreal *order)
Definition: GU_Detail.h:975
const GA_IndexMap & getPrimitiveMap() const
Definition: GA_Detail.h:755
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
Definition: thread.h:632
GU_DeformType
Definition: GU_Types.h:58
SIM_API const UT_StringHolder angle
MatType shear(Axis axis0, Axis axis1, typename MatType::value_type shear)
Set the matrix to a shear along axis0 by a fraction of axis1.
Definition: Mat.h:688
#define SYS_VISIBILITY_EXPORT
void
Definition: png.h:1083
GA_StorageClass
Definition: GA_Types.h:75
GLint left
Definition: glcorearb.h:2005
getFileOption("OpenEXR:storage") storage
Definition: HDK_Image.dox:276
GA_DataIdStrategy
Definition: GA_Types.h:218
const GLdouble * v
Definition: glcorearb.h:837
GA_Precision
Definition: GA_Types.h:91
Transformation order of scales, rotates, and translates.
Definition: UT_XformOrder.h:23
const UT_IntArray & ringValence() const
Definition: GU_Detail.h:234
virtual GA_Detail * cloneEmptyDetail(bool clone_attributes) const =0
SYS_VISIBILITY_EXPORT void newGeometryPrim(GA_PrimitiveFactory *factory)
#define SYS_DEPRECATED_HDK_REPLACE(__V__, __R__)
void sortPoints(GA_IndexMap &array, const UT_Vector3 &o, const UT_Vector3 &d)
Definition: GU_Detail.h:944
TIL_API bool stitch(StitchWriter &w, const UT_Span< TileReader * > &tiles, bool top_down)
void reversePrimitiveList()
Definition: GU_Detail.h:1038
GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint vorder
Definition: glad.h:2682
GLdouble right
Definition: glad.h:2817
GA_API const UT_StringHolder twist
int64 exint
Definition: SYS_Types.h:125
Arbitrarily Oriented Bounding (OBB)
Definition: GU_Detail.h:60
GLint level
Definition: glcorearb.h:108
A soup of polygons.
int64 getMemoryUsage(bool inclusive) const override
Compute memory usage (includes all shared memory)
void reversePointList()
Definition: GU_Detail.h:1036
OnlyConsGroupPropagateType
Definition: GU_Detail.h:520
PUGI__FN void reverse(I begin, I end)
Definition: pugixml.cpp:7458
UT_ErrorSeverity
Definition: UT_Error.h:25
void shiftPrimitiveList(GA_Size aoffset)
Definition: GU_Detail.h:1018
UT_API UT_ErrorManager * UTgetErrorManager()
void proximityPoints(GA_IndexMap &points, const UT_Vector3 &point)
Definition: GU_Detail.h:1044
void vertexOrder(GA_IndexMap &points)
Definition: GU_Detail.h:1065
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
Manager to keep track of global handle to name mappings.
void addWarning(GU_ErrorCodes code, const char *msg=0) const
Definition: GU_Detail.h:1808
Tto convert(const Tfrom &source)
void merge(const GEO_Detail &src, const GA_PrimitiveGroup *primGrp=nullptr, bool mergePrimGroup=true, bool insertPrimsAtHead=false, bool keep_internal_groups=true, GA_DataIdStrategy data_id_strategy=GA_DATA_ID_BUMP)
**But if you need a result
Definition: thread.h:622
void proximityPrims(GA_IndexMap &primitives, const UT_Vector3 &point)
Definition: GU_Detail.h:1047
Structure for the PolySouping code.
UT_ErrorSeverity addError(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0)
exint GA_Size
Defines the bit width for index and offset types in GA.
Definition: GA_Types.h:243
FMT_NOINLINE FMT_CONSTEXPR auto fill(OutputIt it, size_t n, const fill_t< Char > &fill) -> OutputIt
Definition: format.h:1860
SnapAttributesType
Definition: GU_Detail.h:608
GU_GridType
Definition: GU_Types.h:70
const UT_Array< GA_OffsetArray > & myRingZero
Definition: GU_Detail.h:238
#define GA_INVALID_OFFSET
Definition: GA_Types.h:694
GU_API void GUdivideEdges(GU_Detail &detail, const UT_Array< GU_PerEdgeDiv > &div_locs, GA_PointGroup &new_points_group)
A range of elements in an index-map.
Definition: GA_Range.h:42
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
< returns > If no error
Definition: snippets.dox:2
GR_API bool buildGrid(RE_RenderContext r, UT_Vector2F size, UT_UniquePtr< RV_Geometry > &out_geo)
GA_ParameterizationType
Definition: GA_Types.h:204
GU_LatticeType
Definition: GU_Types.h:109
#define SYS_DEPRECATED_REPLACE(__V__, __R__)
GU_AxisType
Definition: GU_Types.h:24
GA_Size GA_Offset
Definition: GA_Types.h:653
OIIO_FORCEINLINE bool extract(const vbool4 &a)
Definition: simd.h:3542
vint4 blend(const vint4 &a, const vint4 &b, const vbool4 &mask)
Definition: simd.h:4949
void sortPointList(exint *order)
Definition: GU_Detail.h:985
GU_API void snapPoints(GU_Detail &qgdp, const GU_Detail *tgdp, const PointSnapParms &parms)
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:108
const GA_IndexMap & getPointMap() const
Definition: GA_Detail.h:753
float apply(GA_Offset off, float uval, int side) const
Definition: GU_Detail.h:1515
GLintptr offset
Definition: glcorearb.h:665
GA_Size GEO_API GEOsplitPoints(GEO_Detail *detail, const GA_ElementGroup *group=nullptr, const GA_AttributeFilter *filter=nullptr)
GU_Detail(const GU_Detail *src, GA_DataIdStrategy data_id_strategy=GA_DATA_ID_BUMP)
Definition: GU_Detail.h:185
int open(float queuesize) override
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:36
GA_API const UT_StringHolder trans
void sortPointsSpatial()
Definition: GU_Detail.h:934
CE_API bool refine(const CE_OSDRefinement &topo, const CE_OSDEvaluator &eval, const cl::Buffer &coarse, CE_FloatArray &refined_data)
void reversePoints(GA_IndexMap &map)
Definition: GU_Detail.h:1030
GU_API void snapGrid(GU_Detail &gdp, const GridSnapParms &parms)
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:803
void reversePrims(GA_IndexMap &map)
Definition: GU_Detail.h:1032
void shiftPrims(GA_IndexMap &map, GA_Size offset)
Definition: GU_Detail.h:1010
const GA_IndexMap & getIndexMap(GA_AttributeOwner owner) const
NURBS basis classes which maintain knot vectors.
Definition: GA_NUBBasis.h:44
void shiftPointList(GA_Size aoffset)
Definition: GU_Detail.h:1016
GLdouble GLdouble GLint GLint order
Definition: glad.h:2676
long long int64
Definition: SYS_Types.h:116
void shiftPoints(GA_IndexMap &map, GA_Size offset)
Definition: GU_Detail.h:1008
void sortPointList(fpreal *order)
Definition: GU_Detail.h:983
png_const_structrp png_const_inforp int * unit
Definition: png.h:2161
SYS_FORCE_INLINE T get(GA_Offset off, int comp=0) const
Definition: GA_Handle.h:210
void sortPointList(int seed)
Definition: GU_Detail.h:965
#define GU_API
Definition: GU_API.h:14
HUSD_API const char * resolution()
#define SYS_DEPRECATED_HDK(__V__)
SYS_DECLARE_LEGACY_TR(GU_Detail)
void sortPrimitiveList(const UT_Vector3 &o, const UT_Vector3 &d)
Definition: GU_Detail.h:956
void sortPointList(const UT_Vector3 &o, const UT_Vector3 &d)
Definition: GU_Detail.h:954
UT_Array< GU_SplitLoc * > GU_SplitLocArray
Definition: GU_Detail.h:150
GA_API const UT_StringHolder transform
bool copy(const GEO_Detail &src, GEO_CopyMethod method=GEO_COPY_ONCE, bool this_parameter_is_ignored=true, bool keep_internal_groups=true, GA_DataIdStrategy data_id_strategy=GA_DATA_ID_BUMP)
UT_SharedPtr< GU_Selection > GU_SelectionHandle
GA_API const UT_StringHolder orient
GU_OrientationType
Definition: GU_Types.h:32
GU_Detail(bool full_topology)
Definition: GU_Detail.h:166
void sortElements(GA_IndexMap &array, exint *order)
Definition: GU_Detail.h:977
IMATH_HOSTDEVICE constexpr int divs(int x, int y) IMATH_NOEXCEPT
Definition: ImathFun.h:140
ImageBuf OIIO_API warp(const ImageBuf &src, M33fParam M, string_view filtername=string_view(), float filterwidth=0.0f, bool recompute_roi=false, ImageBuf::WrapMode wrap=ImageBuf::WrapDefault, ROI roi={}, int nthreads=0)
void addMessage(GU_ErrorCodes code, const char *msg=0) const
Definition: GU_Detail.h:1803
uint8_t ArrayType
Definition: NanoVDB.h:5566
SYS_FORCE_INLINE bool isValid() const
Definition: GA_Handle.h:194
GLenum GLint GLint * precision
Definition: glcorearb.h:1925
IFDmantra py
Definition: HDK_Image.dox:266
void sortPrimsSpatial()
Definition: GU_Detail.h:937
GLsizeiptr size
Definition: glcorearb.h:664
GA_AttributeOwner
Definition: GA_Types.h:35
A map of string to various well defined value types.
Definition: UT_Options.h:87
Class to return information about a GA_Detail.
Definition: GA_Stat.h:51
ImageBuf OIIO_API cut(const ImageBuf &src, ROI roi={}, int nthreads=0)
GA_API const UT_StringHolder parms
virtual bool smooth(GA_AttributeOperand &d, GA_AttributeOperand &min, GA_AttributeOperand &max, GA_AttributeOperand &t) const
d = SYSsmooth(min, max, t);
const UT_IntArray & myRingValence
Definition: GU_Detail.h:239
void sortPrimitiveList(int seed)
Definition: GU_Detail.h:967
fpreal64 fpreal
Definition: SYS_Types.h:283
UT_ErrorSeverity addWarning(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0)
GA_GroupType
An ordinal enum for the different types of groups in GA.
Definition: GA_Types.h:167
RingRef(const UT_Array< GA_OffsetArray > &ringzero, const UT_IntArray &ringvalence)
Definition: GU_Detail.h:225
void countMemory(UT_MemoryCounter &counter, bool inclusive) const override
void proximityToPointList(const UT_Vector3 &point)
Definition: GU_Detail.h:1056
GLbyte ny
Definition: glad.h:2247
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
GLbyte GLbyte nz
Definition: glad.h:2247
GU_API GA_PrimitiveFactory & GUgetFactory()
void sortPrimitiveList(GU_AxisType axis)
Definition: GU_Detail.h:926
bool process(T &func, UT_WorkBuffer &fullpath, exint fullpath_len, const UT_StringArray &paths, const UT_Array< FS_Stat > &stats)
Utility function to process the contents of the traverse() function.
Definition: FS_Traverse.h:24
GEO_SurfaceType
Container class for all geometry.
Definition: GA_Detail.h:105
const UT_Array< GA_OffsetArray > & ringZero() const
Definition: GU_Detail.h:232
#define SYS_FTOLERANCE
Definition: SYS_Types.h:208
void proximityToPrimitiveList(const UT_Vector3 &point)
Definition: GU_Detail.h:1058
void sortPointList(GU_AxisType axis)
Definition: GU_Detail.h:924
GU_TextureType
Definition: GU_Types.h:94
void OIIO_UTIL_API split(string_view str, std::vector< string_view > &result, string_view sep=string_view(), int maxsplit=-1)
void sortPrims(GA_IndexMap &array, GU_AxisType axis=GU_XAXIS)
Definition: GU_Detail.h:919
SIM_API const UT_StringHolder distance
void sortByVertexOrder()
Definition: GU_Detail.h:1068
GU_Detail(const GU_Detail *src, GA_PrimitiveGroup *primGroup, GA_DataIdStrategy data_id_strategy=GA_DATA_ID_BUMP)
Definition: GU_Detail.h:173
void sortPrimitiveList(fpreal *order)
Definition: GU_Detail.h:987
GA_KnotSpaceType
Definition: GA_Types.h:197
IMATH_INTERNAL_NAMESPACE_HEADER_ENTER IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T clip(const T &p, const Box< T > &box) IMATH_NOEXCEPT
Definition: ImathBoxAlgo.h:29
unsigned int uint
Definition: SYS_Types.h:45
GLint lod
Definition: glcorearb.h:2765
GU_ErrorCodes
Definition: GU_Error.h:20
GLint GLsizei count
Definition: glcorearb.h:405
Definition: format.h:1821
auto join(It begin, Sentinel end, string_view sep) -> join_view< It, Sentinel >
Definition: format.h:4489
void addError(GU_ErrorCodes code, const char *msg=0) const
Definition: GU_Detail.h:1813
UT_ErrorSeverity addMessage(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0)
void sortPrimitiveList(exint *order)
Definition: GU_Detail.h:989
GLenum src
Definition: glcorearb.h:1793