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