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  void convert(GEO_ConvertParms &parms);
885  void convertNew(GEO_ConvertParms &parms);
886  /// @}
887 
888  /// This routine only converts metaballs using a more comprehensive set
889  /// of parameters.
890  void convertMetaballs(
891  GEO_MetaConvertParms &parms,
892  const GA_PrimitiveGroup *prim_grp = nullptr);
893 
894  //
895  // SORTING
896  //
897 
898  /// Sort by the specified dominant axis
899  /// @{
900  void sortPoints(GA_IndexMap &array,
901  GU_AxisType axis = GU_XAXIS)
902  { sortPoints(array, GA_Range(array), axis); }
903  void sortPoints(GA_IndexMap &array, const GA_Range &range,
904  GU_AxisType axis);
905  void sortPoints(GA_OffsetArray &array,
906  GU_AxisType axis = GU_XAXIS);
907  void sortPrims(GA_IndexMap &array,
908  GU_AxisType axis = GU_XAXIS)
909  { sortPrims(array, GA_Range(array), axis); }
910  void sortPrims(GA_IndexMap &array, const GA_Range &range,
911  GU_AxisType axis);
913  { sortPoints(getIndexMap(GA_ATTRIB_POINT), axis); }
915  { sortPrims(getIndexMap(GA_ATTRIB_PRIMITIVE), axis); }
916  /// @}
917 
918  /// Sorting by spatial locality. The points and primitives will be
919  /// sorted in a way that tries to assign nearby primitives closer
920  /// primitive ids.
921  /// @{
923  { sortPointsSpatial(GA_Range(getPointMap())); }
924  void sortPointsSpatial(const GA_Range &range);
926  { sortPrimsSpatial(GA_Range(getPrimitiveMap())); }
927  void sortPrimsSpatial(const GA_Range &range);
928  /// @}
929 
930  /// Sort along an arbitrary vector
931  /// @{
932  void sortPoints(GA_IndexMap &array,
933  const UT_Vector3 &o, const UT_Vector3 &d)
934  { sortPoints(array, GA_Range(array), o, d); }
935  void sortPoints(GA_IndexMap &array, const GA_Range &range,
936  const UT_Vector3 &o, const UT_Vector3 &d);
937  void sortPrims(GA_IndexMap &array,
938  const UT_Vector3 &o, const UT_Vector3 &d)
939  { sortPrims(array, GA_Range(array), o, d); }
940  void sortPrims(GA_IndexMap &array, const GA_Range &range,
941  const UT_Vector3 &o, const UT_Vector3 &d);
942  void sortPointList(const UT_Vector3 &o, const UT_Vector3 &d)
943  { sortPoints(getIndexMap(GA_ATTRIB_POINT), o, d); }
945  const UT_Vector3 &d)
946  { sortPrims(getIndexMap(GA_ATTRIB_PRIMITIVE), o, d); }
947  /// @}
948 
949  /// Sort in random order
950  /// @{
951  void sortPoints(GA_IndexMap &array, int seed);
952  void sortPrims(GA_IndexMap &array, int seed);
953  void sortPointList(int seed)
954  { sortPoints(getIndexMap(GA_ATTRIB_POINT), seed); }
955  void sortPrimitiveList(int seed)
956  { sortPrims(getIndexMap(GA_ATTRIB_PRIMITIVE), seed); }
957  /// @}
958 
959  /// Sorting according to a provided value list
960  /// The order is indexed by the GA_Index of the elemnents, NOT the
961  /// GA_Offset or order within the range.
962  /// @{
964  { sortElements(array, GA_Range(array), order); }
966  { sortElements(array, GA_Range(array), order); }
967  void sortElements(GA_IndexMap &array, const GA_Range &range,
968  fpreal *order);
969  void sortElements(GA_IndexMap &array, const GA_Range &range,
970  exint *order);
972  { sortElements(getIndexMap(GA_ATTRIB_POINT), order); }
974  { sortElements(getIndexMap(GA_ATTRIB_POINT), order); }
976  { sortElements(getIndexMap(GA_ATTRIB_PRIMITIVE), order); }
978  { sortElements(getIndexMap(GA_ATTRIB_PRIMITIVE), order); }
979  /// @}
980 
981  /// "Rotate" (cycle) the order of vertices for all primitives in the group,
982  /// by the specified number of places.
983  void shift(int uoffset, int voffset,
984  const GA_PrimitiveGroup *group = nullptr);
985 
986  /// "Rotate" (cycle) the order of points or primitives in the detail, by the
987  /// specified number of places.
988  /// @{
990  { shiftPoints(map, GA_Range(map), offset); }
992  { shiftPrims(map, GA_Range(map), offset); }
993  void shiftPoints(GA_IndexMap &map, const GA_Range &range,
994  GA_Size offset);
995  void shiftPrims(GA_IndexMap &map, const GA_Range &range,
996  GA_Size offset);
997  void shiftPointList(GA_Size aoffset)
998  { shiftPoints(getIndexMap(GA_ATTRIB_POINT), aoffset); }
1000  { shiftPrims(getIndexMap(GA_ATTRIB_PRIMITIVE), aoffset); }
1001  /// @}
1002 
1003  /// Reverse vertices for all primitives in the group
1004  /// This sill also reverse point normals, vertex normals, and correct
1005  /// creaseweight attriutes if update_attributes is requested.
1006  void reverse(const GA_PrimitiveGroup *group = nullptr,
1007  bool update_attributes = true);
1008 
1009  /// Reverse order of points or primitives in the detail.
1010  /// @{
1012  { reversePoints(map, GA_Range(map)); }
1014  { reversePrims(map, GA_Range(map)); }
1015  void reversePoints(GA_IndexMap &map, const GA_Range &range);
1016  void reversePrims(GA_IndexMap &map, const GA_Range &range);
1018  { reversePoints(getIndexMap(GA_ATTRIB_POINT)); }
1020  { reversePrims(getIndexMap(GA_ATTRIB_PRIMITIVE)); }
1021  /// @}
1022 
1023  /// Sort points or primitives by proximity to a position
1024  /// @{
1026  const UT_Vector3 &point)
1027  { proximityPoints(points, GA_Range(points), point); }
1028  void proximityPrims(GA_IndexMap &primitives,
1029  const UT_Vector3 &point)
1030  { proximityPrims(primitives, GA_Range(primitives), point); }
1031  void proximityPoints(GA_IndexMap &points,
1032  const GA_Range &range,
1033  const UT_Vector3 &point);
1034  void proximityPrims(GA_IndexMap &primitives,
1035  const GA_Range &range,
1036  const UT_Vector3 &point);
1038  { proximityPoints(getIndexMap(GA_ATTRIB_POINT), point); }
1040  { proximityPrims(getIndexMap(GA_ATTRIB_PRIMITIVE), point); }
1041  /// @}
1042 
1043  /// Sort points by the order in which they are first referred-to by
1044  /// vertices.
1045  /// @{
1047  { vertexOrder(points, GA_Range(points)); }
1048  void vertexOrder(GA_IndexMap &points, const GA_Range &range);
1050  { vertexOrder(getIndexMap(GA_ATTRIB_POINT)); }
1051  /// @}
1052 
1053  /// Create a mesh primitive or polygon primitives representing a
1054  /// super-quadric surface specified by parms.
1055  void superEllipsoid(const GU_SuperQuadParms &parms);
1056 
1057  /// Split the specified polygon into convex polygons with at most
1058  /// maxpts vertices each. By default, this triangulates the polygon.
1059  /// If flipedges is true, it will flip edges to get the Delaunay
1060  /// triangulation, avoiding small angles where possible.
1061  /// If avoiddegeneracy is true, degenerate triangles will not be generated;
1062  /// note that this means that the mesh may not be watertight or even
1063  /// connected.
1064  void convexPoly(GEO_PrimPoly *pp, GA_ElementWranglerCache &wranglers,
1065  GA_Size maxpts = 3, const GA_Detail *restgdp=0,
1066  bool flipedges = false, bool avoiddegeneracy = false);
1067  /// Split polygons in the specified polygon soup into convex polygons
1068  /// with at most maxpts vertices each. By default, this triangulates the
1069  /// polygon. If flipedges is true, it will flip edges to get the Delaunay
1070  /// triangulation, avoiding small angles where possible.
1071  /// If avoiddegeneracy is true, degenerate triangles will not be generated;
1072  /// note that this means that the mesh may not be watertight or even
1073  /// connected.
1074  void convexPolySoup(GEO_PrimPolySoup *polysoup,
1075  GA_Size maxpts = 3, const GA_Detail*restgdp=0,
1076  bool flipedges = false,
1077  bool avoiddegeneracy = false);
1078  /// Split polygons (including in polygon soups) in the detail into convex
1079  /// polygons with at most maxpts vertices each. By default, this
1080  /// triangulates the polygon. If flipedges is true, it will flip edges to
1081  /// get the Delaunay triangulation, avoiding small angles where possible.
1082  /// If avoiddegeneracy is true, degenerate triangles will not be generated;
1083  /// note that this means that the mesh may not be watertight or even
1084  /// connected.
1085  void convex(GA_Size maxpts=3, const GA_PrimitiveGroup *primGroup=0,
1086  const GA_Detail *restgdp=0, bool flipedges = false,
1087  bool avoiddegeneracy = false);
1088 
1089  /// Add non-planar polygon primitives to nonplanargroup.
1090  GA_Size findNonPlanar(
1091  GA_PrimitiveGroup *nonplanargroup,
1092  float tol = 0.0001F,
1093  const GA_PrimitiveGroup *searchprimgroup = nullptr);
1094 
1095  /// Clip primitives, keeping everything where dot(normal, P) >= d.
1096  /// If clippts is true, disconnected points are also clipped.
1097  void clip(UT_Vector3 &normal, float d = 0, int normlize = 0,
1098  const GA_PrimitiveGroup *primGroup = 0,
1099  bool clippts = false);
1100 
1101 //
1102 // Polygon creasing
1103  void crease(UT_Vector3 &normal, float d = 0,
1104  int normlize = 0, int outputGroups = 0,
1105  GA_PrimitiveGroup *above = 0,
1106  GA_PrimitiveGroup *below = 0,
1107  const GA_PrimitiveGroup *creaseGroup = 0);
1108 //
1109 // fractals
1110  void fractalize(int seed = 1, float roughness = 0.6F,
1111  float scaleby=1, int divs=1,
1112  int fixedBoundry = 1, int useVtxNorms = 0,
1113  // Null means "N"
1114  const char *nmlattribname = nullptr,
1115  float nx = 0, float ny = 0, float nz = 1,
1116  const GA_PrimitiveGroup *fractalGroup = 0);
1117 
1118  //
1119  // Shrink Wrap and tools
1120 
1121  /// This routine is originally developed for the Bullet RBD solver to adjust
1122  /// the geometry of a convex 3D polygon to remove the space around the geometry
1123  /// caused by the collision margin required for the Bullet solver.
1124  void shrink( fpreal distance,
1125  fpreal clip_tolerance = 0.0001,
1126  fpreal consilidate_tolerance = 0.001);
1127 
1128  /// preliminary routine to setup the gdp to be shrunk by the shrink routine
1129  bool tetrahedralizeForShrink( const GA_PointGroup *ptGroup = 0,
1130  GU_Detail *gdp = 0 );
1131 
1132 
1133  /// Twist operations. The method returns 0 if everything goes OK, else -1.
1134  /// "pasted" returns 1 if at least one pasted surface was involved in
1135  /// the deformation, else 0.
1136  int nonLinearDeform(GU_DeformType type,const GU_TwistParms &parms,
1137  int &pasted);
1138 
1139  /// NOTE: This is something specific to NURBS surfaces and it uses
1140  /// pasted surface primitives, so it's probably not what you want!!!
1141  /// Creates an offset surface from the specified surface & radius.
1142  GEO_Hull *offset(const GU_OffsetParms &parms);
1143 
1144  /// Create a Gordon surface out of the given bi-linear network of faces.
1145  /// The faces don't have to be the same type or order or anything.
1146  /// We return the surface if OK and 0 otherwise. If the u or v faces
1147  /// contain only one face, we automatically generate a final curve. If
1148  /// both u faces and vfaces have 1 curve or one has 2 and the other 1,
1149  /// we generate a Coons surface. "accurate" is used when the curves do not
1150  /// intersect (i.e. when we must compute their min distances).
1151  /// @{
1152  GEO_Hull *gordon(GEO_SurfaceType surftype, int accurate,
1153  const GA_PrimitiveGroup &ufaces,
1154  const GA_PrimitiveGroup &vfaces,
1155  int reparameterize = 0);
1156  GEO_Hull *gordon(GEO_SurfaceType surftype, int accurate,
1157  const UT_Array<GEO_Primitive*> &uprims_in,
1158  const UT_Array<GEO_Primitive*> &vprims_in,
1159  GU_SkinCache& skin_cache,
1160  int reparameterize = 0);
1161  /// @}
1162 
1163  /// Generate a Coons surface out of up to 4 boundary curves. Return a
1164  /// pointer to the surface if successful and 0 otherwise. The faces do
1165  /// not have to have the same type or order.
1166  GEO_Hull *coons(GEO_SurfaceType surftype,
1167  const GEO_Face &uface1, const GEO_Face &vface1,
1168  const GEO_Face *uface2 = 0, const GEO_Face *vface2 = 0);
1169 
1170  /// Generate a skinned surface out of a set of cross-sections. The faces
1171  /// don't have to be the same type or order. We return the surface is OK
1172  /// and 0 otherwise. Specifying a vorder of 0 tells the method to
1173  /// come up with a legal default value for the surface. If "doskin" is
1174  /// true, the cross-sections will be right on the surface; otherwise, we
1175  /// build a ruled surface, which simply steals the curves' CVs and assigns
1176  /// them to the surface.
1177  GEO_Hull *skin(GU_SkinParms &parms, GU_SkinCache& skin_cache);
1178 
1179  /// This restrictive skinning method assumes the faces are of the same type
1180  /// and have the same number of CVs. order 0 means pick most suitable one.
1181  /// If doskin is false, we build a ruled surface. nprims is the number
1182  /// of faces in the group; we compute it if -1. We return the resulting
1183  /// surface and do not delete the input faces. We also assume that if
1184  /// nprims > 2 and vorder != 2 and doskin, all the faces are nonrational.
1185  /// Finally, the provided vParmValues if given specifies what v coordinate
1186  /// each of the provided faces should interpolate.
1187  /// @{
1188  GEO_Hull *skin(const GA_PrimitiveGroup &ucfaces,
1189  GEO_SurfaceType surftype = GEO_PATCH_QUADS,
1190  unsigned vorder = 0, int vwrap = 0,
1191  int doskin = 1, int nprims = -1,
1192  const UT_Vector *vParmValues = 0);
1193  GEO_Hull *skin(const UT_Array<GEO_Primitive*> & prims_in,
1194  GU_SkinCache& skin_cache,
1195  GEO_SurfaceType surftype = GEO_PATCH_QUADS,
1196  unsigned vorder = 0, int vwrap = 0,
1197  int doskin = 1, int nprims = -1,
1198  const UT_Vector *vParmValues = 0);
1199  /// @}
1200 
1201  /// See GU_Ruled.h for the various closure and interpolation types
1202  /// which are valid. Specifying an orderv of 0 makes the routine
1203  /// come up with a legal default value for the surface.
1204  int ruled( GEO_Hull *&surface, const GU_RuledParms &p,
1205  const GU_CapOptions &caps);
1206 
1207  /// This is what the Skin SOP and Sweep SOP use for skinning
1208  /// cross-sections.
1209  /// See GU_CurveNetwork.h for parameter types. This method generates
1210  /// a skinned surface, a Coons surface, or a Gordon surface depending on
1211  /// the primitive groups it is given. Specifying an orderv of 0 makes the
1212  /// routine come up with a legal default value for the surface.
1213  int curveNetwork(GEO_Hull *&hull, GU_CurveNetworkParms &p,
1214  int &count, GU_SkinCache& skin_cache);
1215 
1216  GU_ERROR sweep( GU_SweepParms parms );
1217  void rails( GU_RailParms parms );
1218 
1219  /// Join more faces or surfaces together.
1220  GEO_Primitive *join( GU_JoinParms &p, int &count);
1221 
1222  /// Generate a fillet between two curves on surfaces:
1223  GEO_Hull *filletTrims(GU_TrimFilletParms &parms, int &count);
1224 
1225  /// Generate a rounded fillet:
1226  GEO_Hull *filletRound(GU_RoundFilletParms &parms);
1227  /// NOTE: The first 5 columns of the matrix must be GEO_Curve*,
1228  /// and the other 2 columns of the matrix must be GEO_TPSurf*.
1229  void filletRoundNetwork(
1230  const UT_RefMatrix<GEO_Primitive *> &facematrix,
1231  GU_RoundFilletParms &parms);
1232 
1233  /// Fillet a set of faces/hulls
1234  /// Return 0 if OK, -1 otherwise (non face/hull types)
1235  int fillet(GU_FilletParms &parms, int &count);
1236 
1237  /// Loft (stitch) a number of polygons together without changing the number
1238  /// of points in the detail.
1239  /// @{
1240  void loft(GU_LoftParms &p, const GA_PointGroup &g1,
1241  const GA_PointGroup &g2);
1242  void loft(GU_LoftParms &p,
1243  const GA_PrimitiveGroup *group = 0);
1244  /// @}
1245 
1246  /// Revolves all curves in the given gdp (or only curves in the
1247  /// group if the group is given) around a line given by the center
1248  /// and axis. Only polygonal curves use the divisions. NURBS and
1249  /// Bezier curves are revolved a special way to create a perfectly
1250  /// round surface with a minimum number of revolution copies.
1251  int revolve( const GU_RevolveParms &parms,
1252  const GU_CapOptions &caps, int &count);
1253 
1254  /// Warp curves or surfaces. Return 0 if successful and -1 otherwise.
1255  int warp(GU_WarpParms &parms);
1256 
1257  /// Curve Clay it!
1258  GU_ERROR curveClay(const GU_CurveClayParms &ccparm);
1259 
1260  /// This puts endcaps on the specified hull
1261  int endCap(GEO_Hull &hull, const GU_CapParms &parms);
1262  int endCap(GEO_Face &face, const GU_CapParms &parms);
1263 
1264  /// This places all caps on the hull
1265  int setCaps(GEO_Hull &hull, const GU_CapOptions &parms, int &count);
1266  int setCaps(GEO_Face &face, const GU_CapOptions &parms, int &count);
1267 
1268  /// Creates a deformed copy of a source detail given a pair of
1269  /// rest and deform details. Return 1 if a pasted surface was deformed,
1270  /// else 0. If 'deform_history' is passed in, every time we deform a point
1271  /// from our source, we mark this by setting the bit in 'deform_history'
1272  /// whose index corresponds to the point's number to 1. Useful if you want
1273  /// to know which points we deformed.
1274  int lattice(const GU_Detail *source, const GU_Detail *rest,
1275  const GU_Detail *deform, int xdiv, int ydiv, int zdiv,
1276  const GA_PointGroup *ptgroup = 0,
1277  UT_BitArray *deform_history = nullptr,
1279 
1280  /// All points of the gdp are deformed according to the meta source
1281  /// field that surrounds it. The deformation is controlled by a
1282  /// transformation matrix.
1283  int magnet( const GU_MagnetParms &parms );
1284 
1285  /// trace a raster image to form closed polygons
1286  float trace(GU_TraceParms *parms);
1287 
1288  /// add point texture attributes to traced geometry
1289  void applyTraceTexture(float xres, float yres, float resolution);
1290 
1291 
1292  /// fit a sequence of discrete points to a series of bezier curves
1293  void fit2DCurve(const GU_Detail *source, float error_squared,
1294  GA_PrimitiveGroup *primGroup = 0);
1295 
1296  /// Fit a curve through its breakpoints
1297  /// @{
1298  GEO_Curve *interpCurveBreakpoints(const GEO_Face &face,
1300  int order=4,
1302  GEO_Curve *interpCurveBreakpoints(const GA_OffsetList &point_offsets,
1304  int order=4, int wrapped=0,
1306  GEO_Curve *interpCurveBreakpoints(const UT_Vector4Array &v4Data,
1308  int order=4, int wrapped=0,
1310  const bool elevate_order_if_required = true);
1311  /// @}
1312 
1313  /// interpolation data points
1314  /// @{
1315  GEO_Curve *interpCurveGlobal(const GEO_Face &face,
1317  int order=4,
1320  GEO_Curve *interpCurveGlobal(const GA_OffsetList &point_offsets,
1322  int order=4, int wrapped=0,
1325  GEO_Curve *interpCurveGlobal(const GA_Range &point_range,
1327  int order=4, int wrapped=0,
1330  GEO_Curve *interpCurveGlobal(const UT_Vector4Array &v4Data,
1332  int order=4, int wrapped=0,
1335  const bool elevate_order_if_required = true);
1336  GEO_Curve *interpCurveLocal(const GEO_Face &face,
1338  int order = 4, int corner=0);
1339  GEO_Curve *interpCurveLocal(const UT_Array<GA_Offset> &goData,
1341  int order = 4, int wrapped=0, int corner=0);
1342  GEO_Curve *interpCurveLocal(const UT_Vector4Array &v4Data,
1344  int order = 4, int wrapped=0, int corner=0);
1345 
1346  GEO_TPSurf *interpSurfGlobal(const GEO_Hull &mesh,
1348  int uOrder=4, int vOrder=4,
1354  const UT_Vector *uParmValues = 0,
1355  const UT_Vector *vParmValues = 0);
1356 
1357  GEO_TPSurf *interpSurfGlobal(const GA_OffsetMatrix &goMesh,
1359  int uOrder=4, int vOrder=4,
1360  bool uWrapped=false, bool vWrapped=false,
1366  const UT_Vector *uParmValues = 0,
1367  const UT_Vector *vParmValues = 0);
1368 
1369  GEO_TPSurf *interpSurfBreakpoints(const GEO_Hull &mesh,
1371  int uOrder=4, int vOrder=4,
1377  const UT_Vector *uParmValues = 0,
1378  const UT_Vector *vParmValues = 0);
1379 
1380  GEO_TPSurf *interpSurfBreakpoints(const GA_OffsetMatrix &goMesh,
1382  int uOrder=4, int vOrder=4,
1383  bool uWrapped=false, bool vWrapped=false,
1389  const UT_Vector *uParmValues = 0,
1390  const UT_Vector *vParmValues = 0);
1391  /// @}
1392 
1393  /// Approximate data points given a tolerance.
1394  /// Only for open endinterpolated surface.
1395  /// @{
1396  GEO_Curve *approxCurveGlobal(const GEO_Face &face,
1398  int order=4,
1399  float tol=1e-1F, float smooth=0.0F,
1400  int noMultipleKnots=1);
1401  GEO_Curve *approxCurveGlobal(const UT_Vector4Array &v4Data,
1403  int order=4, int wrapped=0,
1404  float tol=1e-1F, float smooth=0.0F,
1405  int noMultipleKnots=1);
1406 
1407  GEO_TPSurf *approxSurfGlobal(const GEO_Hull &mesh,
1409  int uOrder=4, int vOrder=4,
1411  float tol=1e-1F, float smooth=0.0F,
1412  int uNoMultipleKnots=1,
1413  int vNoMultipleKnots=1);
1414  GEO_TPSurf *approxSurfGlobal(const GA_OffsetMatrix &gpMesh,
1416  int uOrder=4, int vOrder=4,
1417  int uWrapped=0, int vWrapped=0,
1419  float tol=1e-1F, float smooth=0.0F,
1420  int uNoMultipleKnots=1,
1421  int vNoMultipleKnots=1);
1422  /// @}
1423 
1424  /// methods to refine face and hull types
1425  /// @{
1426  void refine(float *uunit, int ulen,
1427  float *vunit, int vlen,
1428  int countu=1, int countv=1,
1429  int arcspacing = 0,
1430  const GA_PrimitiveGroup *primGroup = 0);
1431 
1432  void unrefine(float umin, float umax,
1433  float vmin, float vmax,
1434  int countu=1, int countv=1,
1435  float utol=0.001F, float vtol=0.001F,
1436  const GA_PrimitiveGroup *primGroup = 0);
1437 
1438  void subdivide(float *uunit, int ulen,
1439  float *vunit, int vlen,
1440  int arcspacing = 0,
1441  const GA_PrimitiveGroup *primGroup = 0);
1442 
1443  /// Parameter pack for how to scale uunit+ulen domains by attributes.
1444  /// The attribute is a primitive attribute.
1445  /// NOTE: If scaling is present, internal divisions will be rebuilt
1446  /// to evenly distriubte the end points.
1448  {
1450 
1451  bool hasScale() const
1452  {
1453  return scale1.isValid() || scale2.isValid();
1454  }
1455  float apply(GA_Offset off, float uval, int side) const
1456  {
1457  // Select which side to read from:
1458  const GA_ROHandleF &gah = side ? scale2 : scale1;
1459 
1460  if (!gah.isValid()) return uval;
1461  return gah.get(off) * uval;
1462  }
1463  float apply(const GEO_Primitive *prim, float uval, int side) const;
1464  };
1465 
1466  /// op = {0 = isoparms, 1 = points, 2 = profiles}
1467  int extract(float *uunit, int ulen,
1468  float *vunit, int vlen,
1469  const GA_PrimitiveGroup *primGroup = 0,
1470  GA_PointGroup *newPoints = 0,
1471  int op = 0, int keepOriginal = 0,
1472  int atbreakpoints = 0, int use_arc_length = 0,
1473  DomainScaleAttribs uscale = DomainScaleAttribs(),
1474  DomainScaleAttribs vscale = DomainScaleAttribs());
1475 
1476  void extractIsoParms(float *uunit, int ulen,
1477  float *vunit, int vlen,
1478  GA_PrimitiveGroup *newPrims = 0,
1479  const GA_PrimitiveGroup *primGroup = 0,
1480  DomainScaleAttribs uscale=DomainScaleAttribs(),
1481  DomainScaleAttribs vscale=DomainScaleAttribs());
1482 
1483  void extractPoints(float *uunit, int ulen,
1484  float *vunit, int vlen,
1485  GA_PointGroup *newPoints = 0,
1486  const GA_PrimitiveGroup *primGroup = 0,
1487  bool use_arc_length = false,
1488  DomainScaleAttribs uscale=DomainScaleAttribs(),
1489  DomainScaleAttribs vscale=DomainScaleAttribs());
1490 
1491  void extractProfiles(float *uunit, int ulen,
1492  float *vunit, int vlen,
1493  const GA_PrimitiveGroup *primGroup = 0,
1494  DomainScaleAttribs uscale=DomainScaleAttribs(),
1495  DomainScaleAttribs vscale=DomainScaleAttribs());
1496 
1497  void extractIsoParmsAtBreak(float *uunit, int ulen,
1498  float *vunit, int vlen,
1499  GA_PrimitiveGroup *newPrims = 0,
1500  const GA_PrimitiveGroup *primGroup = 0,
1501  DomainScaleAttribs uscale=DomainScaleAttribs(),
1502  DomainScaleAttribs vscale=DomainScaleAttribs());
1503 
1504  void extractPointsAtBreak(float *uunit, int ulen,
1505  float *vunit, int vlen,
1506  GA_PointGroup *newPoints = 0,
1507  const GA_PrimitiveGroup *primGroup = 0,
1508  bool use_arc_length = false,
1509  DomainScaleAttribs uscale=DomainScaleAttribs(),
1510  DomainScaleAttribs vscale=DomainScaleAttribs());
1511 
1512  void extractProfilesAtBreak(float *uunit, int ulen,
1513  float *vunit, int vlen,
1514  const GA_PrimitiveGroup *primGroup = 0,
1515  DomainScaleAttribs uscale=DomainScaleAttribs(),
1516  DomainScaleAttribs vscale=DomainScaleAttribs());
1517 
1518 
1519  int cut(float *uunit, int ulen,
1520  float *vunit, int vlen,
1521  const GA_PrimitiveGroup *primGroup = 0,
1522  int keepin=1, int keepout=0, int atbreakpoints = 0,
1523  int allU = 0, int allV = 0, int use_arc_length = 0,
1524  DomainScaleAttribs uscale = DomainScaleAttribs(),
1525  DomainScaleAttribs vscale = DomainScaleAttribs());
1526  /// @}
1527 
1528 
1529  /// approximate a spline by using polygonal hull inputs
1530  /// deletes existing polygons if deleteAll is true
1531  void polySpline(GU_PolysplineParms &parms,
1532  const GA_PrimitiveGroup *primGroup = 0,
1533  bool deleteAll = true);
1534 
1535  /// approximate a patch by using polygonal or mesh hull inputs
1536  /// Returns true on success, else false if an error occurred.
1537  bool polyPatch(GU_PolypatchParms &parms,
1538  const GA_PrimitiveGroup *primGroup = 0);
1539 
1540  /// reduce the number of polygons in a detail:
1541  int polyReduce(GU_PolyReduceParms &parms,
1542  const GA_PrimitiveGroup *primGroup = 0,
1543  int *pointIndexTable = 0);
1544 
1545  /// Create polygon soup(s), i.e. GU_PrimPolySoup, where possible in this detail
1546  void polySoup(const GEO_PolySoupParms &parms , const GU_Detail *srcdetail);
1547 
1548  /// Create geometry through premise and rule substitution
1549  void lsystem(GU_LSystemParms &lp);
1550 
1551  /// Get information about a GU_Detail
1552  /// If maxlines < 0, there will be no limit to the number of groups
1553  /// If overridememusage is positive, it will be used rather than the
1554  /// getMemoryUsage().
1555  int info(std::ostream &os,
1556  int max_group_lines=15,
1557  bool pretty=false,
1558  const UT::ArraySet<const void *> *dontcounttheseblocks = 0,
1559  bool instanced=false) const;
1560  /// Get information text for the geometry. This will @b append to the work
1561  /// buffer.
1562  void info(UT_WorkBuffer &wbuf,
1563  int max_group_lines=15,
1564  bool pretty=false,
1565  const UT::ArraySet<const void *> *dontcounttheseblocks = 0,
1566  bool instanced=false) const;
1567 
1568  /// Fills in a stat structure with the volume information.
1569  void statVolumes(GA_Stat &stat, uint level/*=0xffff*/) const override;
1570 
1571  /// @c intersectRay will find the closest intersection with a primitive
1572  /// in the detail. If the dist pointer is nil, then the first intersection
1573  /// found will be returned (instead of the closest). The nml will contain
1574  /// the normal for the primitive at the point of intersection.
1575  /// Accuracy of 0 is inaccurate, 1 is normal, 2 engages Algebraic pruning
1576  /// where available.
1577  ///
1578  /// @param o The ray origin
1579  /// @param d The ray directin
1580  /// @param tmax This can be used to limit the ray to intersections within
1581  /// the given radius.
1582  /// @param tol Intersection tolerance
1583  /// @param dist Return the distance from the origin to the hit
1584  /// @param pos Return the hit position (i.e. <tt>o + dist*d</tt>)
1585  /// @param nml Return the normal of the primitive at the hit position
1586  /// @param accurate Determine primitive intersection algorithms for NURBS
1587  /// @param u The u parametric coordinate of the hit surface
1588  /// @param v The v parametric coordinate of the hit surface
1589  /// @param ignoretrim Ignore trim inside/out tests for trimmed surfaces.
1590  ///
1591  /// @warning If the @c dist parameter is 0 the first hit found will be
1592  /// returned. This may @b not be the closest hit. This can be used to
1593  /// perform a quick check to see if @b any primitives intersect the ray
1594  /// (i.e. for shadow casting).
1595  ///
1596  /// @warning This function iterates over all primitives without any
1597  /// acceleration structure. If you need to send multiple rays, please see
1598  /// GU_RayIntersect.
1599  SYS_DEPRECATED_HDK(16.0)
1600  GEO_Primitive *intersectRay(const UT_Vector3 &o, const UT_Vector3 &d,
1601  float tmax = 1E17F, float tol = 1E-12F,
1602  float *dist = 0, UT_Vector3 *pos = 0,
1603  UT_Vector3 *nml = 0, int accurate = 0,
1604  float *u = 0, float *v = 0,
1605  int ignoretrim = 1) const;
1606 
1607  /// Figure out the parameters of the face/surface that all the given
1608  /// faces/surfaces should have in order to be fully compatible with one
1609  /// another. Return 0 if all the primitive types are faces/surfaces,
1610  /// and -1 otherwise.
1611  /// @{
1612  int commonFaceConfig(
1613  const GA_PrimitiveGroup &faceGroup,
1614  GA_PrimCompat::TypeMask &type, int &order,
1615  bool &open, bool &ends) const;
1616  int commonFaceConfig(
1617  const UT_Array<GEO_Primitive*> &faces_in,
1618  GA_PrimCompat::TypeMask &type, int &order,
1619  bool &open, bool &ends) const;
1620  int commonSurfaceConfig(const GA_PrimitiveGroup &surfs,
1621  GA_PrimCompat::TypeMask &type,
1622  int &orderu, int &orderv,
1623  bool &openu, bool &openv,
1624  bool &endsu, bool &endsv) const;
1625  /// @}
1626 
1627  /// Incompatible faces in infaces are made compatible and set in outfaces.
1628  /// Return 0 of OK, -1 otherwise. If extratype is not nil and the highest
1629  /// face type of the infaces is less than *extratype, replace the common
1630  /// type by *extratype. In the method that takes 2 input groups, we make
1631  /// sure that the primitives in the 2 groups have the same type. Set
1632  /// equalcvs to true make them all have the same number of CVs too.
1633  /// @{
1634  int makeFacesCompatible(
1635  const GA_PrimitiveGroup &infaces,
1636  GA_PrimitiveGroup &outfaces,
1637  bool mustopen = false,
1638  bool mustends = false,
1639  bool nonrational = false,
1640  GA_PrimCompat::TypeMask *extratype = 0,
1641  bool equalcvs = true);
1642  int makeFacesCompatible(
1643  const UT_Array<GEO_Primitive*> &prims_in,
1644  UT_Array<GEO_Primitive*>& prims_out,
1645  bool mustopen = false,
1646  bool mustends = false,
1647  bool nonrational = false,
1648  GA_PrimCompat::TypeMask *extratype = 0,
1649  bool equalcvs = true);
1650  int makeFacesCompatible(
1651  const GA_PrimitiveGroup &infacesU,
1652  const GA_PrimitiveGroup &infacesV,
1653  GA_PrimitiveGroup &outfacesU,
1654  GA_PrimitiveGroup &outfacesV,
1655  bool mustopen = false,
1656  bool mustends = false,
1657  bool nonrational = false,
1658  GA_PrimCompat::TypeMask *extratype = 0,
1659  bool equalcvs = true);
1660  int makeFacesCompatible(
1661  const UT_Array<GEO_Primitive*> &ufaces_array,
1662  const UT_Array<GEO_Primitive*> &vfaces_array,
1663  UT_Array<GEO_Primitive*> &ucfaces_array,
1664  UT_Array<GEO_Primitive*> &vcfaces_array,
1665  bool mustopen = false,
1666  bool mustends = false,
1667  bool nonrational = false,
1668  GA_PrimCompat::TypeMask *extratype = 0,
1669  bool equalcvs = true);
1670  /// @}
1671 
1672  /// Loft a subsection of each hull and update the vertex indices where
1673  /// the subsection occurs. Does partial nurb merging if the bases is given
1674  /// Assumes the two hulls have been properly reconfigured.
1675  static int loftHulls(GEO_Hull *left, GEO_Hull *right,
1676  float lwidth1, float lwidth2,
1677  float rwidth1, float rwidth2,
1678  int sharp, int &lstart, int &rstart,
1679  int &lmax, int &rmax,
1680  int loftU, GA_NUBBasis *nubbasis);
1681 
1682  /// Refine the hull at the unit domain value and return the
1683  /// row/col index where it occurs
1684  /// @{
1685  static int getSubdividedCV(GEO_Hull *hull, int udir, float unit);
1686  static int getSubdividedCV(GEO_Face *face, float unit);
1687  /// @}
1688 
1689  /// Methods for registering and unregistering geometry io converters.
1690  /// @{
1691  static void registerIOTranslator(GEO_IOTranslator *trans);
1692  static void unregisterIOTranslator(GEO_IOTranslator *trans);
1693  static exint getIOTranslatorCount();
1694  static const GEO_IOTranslator *getIOTranslator(exint i);
1695  /// @}
1696 
1697  GA_Detail::IOStatus saveH9File(const char *filename,
1698  const GA_SaveOptions *options) const;
1699  static GA_Detail::IOStatus statH9File(const char *filename,
1700  GA_Stat &sbuf, uint level);
1701 
1702  /// Returns true if filename is a recognized extension.
1703  static bool isFormatSupported(const char *filename);
1704 
1705  /// Allocate an IO handler for a filename, or return nullptr if the handler
1706  /// is the classic format. The returned translator must be deleted. The
1707  /// easiest way to do this is with a UT_UniquePtr: @code
1708  /// UT_UniquePtr<GEO_IOTranslator> xlate(getSupportedFormat(filename));
1709  /// if (xlate)
1710  /// xlate->fileSave(gdp, ...);
1711  /// @endcode
1712  static GEO_IOTranslator *getSupportedFormat(const char *filename);
1713 
1714  /// Align a set of primitives by rotation and translation
1715  void align(GU_AlignParms &parms);
1716 
1717  /// Align a set of faces/hulls at optional levels of continuity.
1718  /// face/hull pre/posttranslate + row stitching + row tangent
1719  /// Faces are aligned with faces, hulls with hulls.
1720  /// Return 0 if OK, -1 otherwise (non face/hull types)
1721  int stitch(GU_StitchParms &parms);
1722 
1723  /// Incompatible surfaces in insurfs are made compatible and set in outsurfs.
1724  /// Return 0 of OK, -1 otherwise. If extratype is not nil and the highest
1725  /// surface type of the insurfs is less than *extratype, replace the common
1726  /// type by *extratype. Set equalcvs to true make them all have the same number
1727  /// of CVs too.
1728  int makeSurfacesCompatible(
1729  const GA_PrimitiveGroup &insurfs,
1730  GA_PrimitiveGroup &outsurfs,
1731  bool mustopenu=false, bool mustopenv=false,
1732  bool mustendsu=false, bool mustendsv=false,
1733  bool equalcvsu=true, bool equalcvsv=true,
1734  GA_PrimCompat::TypeMask *extratype = 0);
1735 
1736  /// Error Routines
1737  /// @{
1738  GU_ERROR error() const
1739  {
1740  return UTgetErrorManager()->getSeverity();
1741  }
1742 
1744  const char *msg = 0) const
1745  {
1746  UTgetErrorManager()->addMessage("GU", code, msg);
1747  }
1749  const char *msg = 0) const
1750  {
1751  UTgetErrorManager()->addWarning("GU", code, msg);
1752  }
1753  void addError(GU_ErrorCodes code, const char *msg = 0) const
1754  {
1755  UTgetErrorManager()->addError("GU", code, msg);
1756  }
1757  /// @}
1758 
1759  /// Returns a cook selection to fill in. If an already existing cook
1760  /// selection exists, of the wrong type, it is removed, and a new one
1761  /// created. Otherwise the existing cook selection is optionally cleared
1762  /// and returned.
1763  ///
1764  /// The cook selection is the selection being manipulated and displayed
1765  /// by a node.
1766  GU_SelectionHandle getOrCreateCookSelection(GA_GroupType group_type,
1767  bool ordered = false,
1768  bool clear_matching = false);
1769 
1770  /// Returns the group type of the current cook selection, or
1771  /// GA_GROUP_INVALID if there isn't one.
1772  GA_GroupType getCookSelectionGroupType() const;
1773 
1774  /// Creates a cook selection that directly references the supplied group.
1775  /// Any changes to the cook selection later will copy this group and use
1776  /// that copy.
1777  ///
1778  /// You must call removeCookSelection() if this group is later destroyed
1779  /// and the cook selection is still referencing it, which can be checked
1780  /// by calling hasShallowCookSelectionReference(group).
1781  ///
1782  /// NB: Only use this method if you know what you're doing. Any gains in
1783  /// performance are likely not to be worth the management pain.
1784  GU_SelectionHandle createShallowCookSelection(GA_Group *group);
1785 
1786  /// Returns whether this detail has a shallow cook selection referencing
1787  /// the specified group.
1788  bool hasShallowCookSelectionReference(
1789  const GA_Group *group) const;
1790 
1791  /// Returns the current cook selection;
1792  GU_SelectionHandle cookSelection() const;
1793 
1794  /// Removes the current cook selection from this detail. Since the selection
1795  /// is a shared object, there's no guarantee that it will be immediately
1796  /// destroyed, but only that this detail is no longer associated with it.
1797  void removeCookSelection();
1798 
1799  /// Bumps the data ids of the internal groups used by the cook selection
1800  /// if the selection revision has changed.
1801  void updateCookSelectionDataIds();
1802 
1803  /// Call this before the replaceWith() call when intending to follow up
1804  /// with a replaceCookSelection() call.
1805  //
1806  /// Assumes a fresh GU_CookSelectionReplaceStash instance.
1807  void stashCookSelectionBeforeReplaceWith(
1808  GU_CookSelectionReplaceStash &stash) const;
1809 
1810  /// Replace the current cook selection with a copy of the source detail's,
1811  /// with optimizations to avoid copying things that are the same.
1812  ///
1813  /// This method is intended to be called as a follow up to replaceWith(),
1814  /// and assumes that this detail is already essentially a copy of the
1815  /// source, possibly with only a subset of the attributes and groups.
1816  ///
1817  /// An optional GU_CookSelectionReplaceStash, populated by a previous
1818  /// call to stashCookSelectionBeforeReplaceWith(), can allow reusing the
1819  /// original GU_CookSelection instance in certain situations.
1820  void replaceCookSelection(
1821  const GU_Detail &src,
1822  GU_CookSelectionReplaceStash *stash);
1823 
1824  /// Do not use this method unless you know EXACTLY what you are doing. It
1825  /// forces the use of the supplied cook selection.
1826  void forceCookSelection(GU_SelectionHandle sel);
1827 
1828  /// Do not use this method unless you know EXACTLY what you are doing. It
1829  /// removes the cook selection from the detail without orphaning it so the
1830  /// only safe thing to do is to return it later using forceCookSelection().
1831  GU_SelectionHandle stealCookSelection();
1832 
1833  /// Remove points from polygons if they lie on (within a tolerance)
1834  /// the line connecting the previous and next points.
1835  void removeInlinePoints(float tol,
1836  const GA_PrimitiveGroup *prims,
1837  const GA_PointGroup *pts = nullptr);
1838 
1839  /// Remove zero area polygons
1840  /// Returns number of polygons removed
1841  /// @{
1842  GA_Size removeZeroAreaFaces(GA_PrimitiveGroup *grp,
1843  bool ignoreOpenFaces = false,
1844  float tolerance = 0.001F,
1845  bool onlyPolys = true);
1846  GA_Size removeZeroAreaFaces(const UT_IntArray &primlist,
1847  bool ignoreOpenFaces = false,
1848  float tolerance = 0.001F,
1849  bool onlyPolys = true);
1850  /// @}
1851 
1852  /// Deletes the geometry in the given group, unlike deleteEdges,
1853  /// it doesn't repair the holes left behind.
1854  void deleteGroupGeometry(const GA_Group &group);
1855 
1856  /// Deletes edge geometry
1857  SYS_DEPRECATED_HDK(16.0)
1858  void deleteEdges(GA_EdgeGroup &edgegroup,
1859  bool del_inline_points,
1860  float inlinetol,
1861  bool del_unused_points = true,
1862  bool del_bridges = true);
1863 
1864  /// There are three different ways of handling situations where all edges
1865  /// that connect polygon boundaries are dissolved.
1866  /// - GU_BRIDGEMODE_BRIDGE @n
1867  /// Insert bridge edges to connect the boundary loops.
1868  /// - GU_BRIDGEMODE_DISJOINT @n
1869  /// Create a separate polygon for each boundary loop.
1870  /// - GU_BRIDGEMODE_DELETE @n
1871  /// Delete the polygons.
1873  {
1876  GU_BRIDGEMODE_DELETE
1877  };
1878  void dissolveEdges(const GA_EdgeGroup &edgegroup,
1879  bool del_inline_points,
1880  fpreal inlinetol,
1881  bool del_unused_points,
1882  BridgeMode bridge_mode,
1883  bool del_degenerate_bridges,
1884  bool boundary_curves);
1885 
1886  /// Flips edges
1887  void flipEdges(const GA_EdgeGroup &edgegroup,
1888  int rotations = 1,
1889  bool rotattribs = false,
1890  GA_EdgeGroup *outedges = 0);
1891  /// Splits edges
1892  /// This is the main method for the PolySplit SOP. The splitlocs are
1893  /// the positions along which you wish to split polygons. When quadcut
1894  /// is false, the Shortest Path algorithm is used, otherwise the Quad Cut
1895  /// algorithm is used. The forcecut flag is used with the Shortest Path
1896  /// algorithm to force it to perform cuts where the initial cut has failed.
1897  /// To form a complete path of edges, supply the first location again as
1898  /// the last location in the splitlocs array. If quadcomplete is true and
1899  /// quadcut is false, then in certain cases extra edges will be inserted so
1900  /// that faces which began as quads get split into faces which are quads. If
1901  /// outPositions is set, it will be filled with a list of points in the path
1902  /// in RE_PRIM_LINES fashion. If fixEnds is set, either end of the path that
1903  /// is on a face will be given an extra segment to connect it to the nearest
1904  /// point to ensure that the resulting polygons don't self-intersect.
1905  void edgeSplit(const GU_SplitLocArray &splitlocs,
1906  bool quadcut = false,
1907  bool forcecut = true,
1908  GA_EdgeGroup *outedges = 0,
1909  float tolerance = SYS_FTOLERANCE,
1910  bool quadcomplete = false,
1911  bool modifyGdp = true,
1912  UT_Fpreal32Array *outPositions = nullptr,
1913  bool fixEnds = false);
1914 
1915  /// Inserts points on edges
1916  /// @{
1917  void divideEdges(const GA_EdgeGroup &edgegroup, int numdivs = 1,
1918  bool applytoall = true,
1919  bool use_shared_points = false,
1920  GA_EdgeGroup *outedges = 0,
1921  UT_Array<GA_Offset> *new_points = 0,
1922  bool preserve_edge_dir = false);
1923  void divideEdges(const GA_EdgeGroup &edgegroup,
1924  int numdivs,
1925  bool applytoall,
1926  bool use_shared_points,
1927  GA_EdgeGroup *outedges,
1928  UT_Array<GA_Offset> *new_points,
1929  bool preserve_edge_dir,
1930  float fraction);
1931  /// @}
1932 
1933  /// Inserts points on edges, with a different fraction and number of
1934  /// divisions per edge.
1936  void divideEdges(const UT_Array<GU_EdgeDiv *> &divlocs,
1937  GA_PointGroup &outgrp);
1938 
1939  /// Transform breakpoints
1940  void transformBreakpoints(const UT_Matrix4 &mat,
1941  const GA_BreakpointGroup *grp = 0,
1942  int quickxform = 0);
1943 
1944 
1945  /// Extrude faces, uses local face spaces and tries to mirror extrusions.
1946  void polyExtrude(const GU_PolyExtrudeParms &parms);
1947 
1948  /// Collapse Edges
1949  void edgeCollapse(const GA_EdgeGroup &edgegroup,
1950  bool removedegen = true,
1951  bool updatenmls = true,
1952  GA_PointGroup *outpoints = nullptr,
1953  const UT_Array<GA_Attribute *> *connect_attrib = nullptr);
1954 
1955  /// Adds crease weights to edges
1956  void edgeCrease(const GU_EdgeCreaseParms &parms);
1957 
1958  /// Insets points
1959  void pointInset(const GA_PointGroup *ptgroup,
1960  float insetdist, float nmldist);
1961 
1962  /// Find the oriented bounding box that contains the given primitives.
1963  /// The box is returned as a rotate+translate matrix to the box's
1964  /// orientation and centre, and a vector containing the boxes extents
1965  /// along its primary axes. The extents are radii, ie, one-half
1966  /// of what a bounding box size() would be.
1967  ///
1968  /// Returns zero radii if the group contains no primitives.
1969  void getOBBox(const GA_PrimitiveGroup *grp,
1971  UT_Vector3 &radii) const;
1972  /// Return the oriented bounding box that contains the given primitives,
1973  /// returning a UT_OBBox, which contains translation and rotation information
1974  void getOBBoxForPrims(const GA_PrimitiveGroup *grp,
1975  UT_OBBoxD &obb,
1976  int refinement_iterations = 6) const;
1977  /// Return the oriented bounding box that contains the given points,
1978  /// returning a UT_OBBox, which contains translation and rotation information
1979  void getOBBoxForPoints(const GA_PointGroup *grp,
1980  UT_OBBoxD &obb,
1981  int refinement_iterations = 6) const;
1982 
1983  /// Get cached bounding box. This uses the meta cache count and the data
1984  /// id on P to determine whether the bounds need to be recomputed.
1985  ///
1986  /// It's possible that the cached bounds might be invalid in some cases
1987  /// (where the geometry is modified without updates to the meta cache count
1988  /// or the data id on P.
1989  bool getCachedBounds(UT_BoundingBox &box) const;
1990 
1991  /// Get cached visible bounding box
1992  ///
1993  /// This uses the meta cache count and the data id on P to determine
1994  /// whether the bounds need to be recomputed.
1995  ///
1996  /// It's possible that the cached bounds might be invalid in some cases
1997  /// (where the geometry is modified without updates to the meta cache count
1998  /// or the data id on P.
1999  bool getCachedVisibleBounds(UT_BoundingBox &box) const;
2000 
2001  /// Forcibly clear all cached bounds (including the cached visible bounds)
2002  /// without having to update the meta cache count or data ID on P.
2003  void clearCachedBounds();
2004 
2005  /// Make each primitive planar, returns the number of primitives xformed
2006  GA_Size makePrimsPlanar(const GA_PrimitiveGroup *grp = 0);
2007 
2008  static void loadIODSOs();
2009 
2010  /// Create a list of all internal file extensions
2011  static void getFileExtensions(UT_StringArray &result);
2012 
2013  /// Check to see whether the file extension matches a known binary file
2014  /// extension. The argument is the full filename.
2015  static bool matchBinaryFileExtension(const UT_StringRef &filename);
2016 
2017  /// Check to see whether the file extension matches a known ASCII file
2018  /// extension. The argument is the full filename.
2019  static bool matchASCIIFileExtension(const UT_StringRef &filename);
2020 
2021 
2022  /// These methods assume no changes have been made to the geometry since the
2023  /// last call to incrementMetaCacheCount(). "attrib" should refer to a string
2024  /// or integer attribute.
2025  exint getUniqueValueCount(const GA_Attribute *attrib) const;
2026  exint getUniqueIntegerValue(const GA_Attribute *attrib, exint idx) const;
2027  const UT_StringHolder &getUniqueStringValue(const GA_Attribute *attrib, exint idx) const;
2028  GA_Range getRangeByValue(const GA_Attribute *attrib, exint v) const;
2029  GA_Range getRangeByValue(const GA_Attribute *attrib, const UT_StringRef &v) const;
2030 
2031 
2032  class AttribValueLookupTable;
2033  class AttribSingleValueLookupTable;
2034 
2035  const AttribValueLookupTable *getLookupTable(const GA_Attribute *attrib) const;
2036  const AttribSingleValueLookupTable *getSingleLookupTable(const GA_Attribute *attrib) const;
2037 
2038  // Creates a copy of the detail keeping the same UniqueId and
2039  // MetaCacheCount if copy_unique_id is true.
2040  // This is used by SOP_Cache to make different details act as the same.
2041  GU_Detail *cloneForCache(bool copy_unique_id) const;
2042 
2043  // Creates a copy of the detail keeping the same UniqueId and
2044  // MetaCacheCount if copy_unique_id is true.
2045  // This version Can write to an existing detail.
2046  // If copy_detail is false, the replaceWith call is skipped.
2047  void cloneForCache(GU_Detail &dest, bool copy_unique_id, bool copy_detail=true) const;
2048 
2049 protected:
2050  /// Register intrinsic attributes
2051  static GA_IntrinsicManager::Registrar
2052  registerIntrinsics(GA_PrimitiveFactory &factory);
2053 
2054 private:
2055  int twist (const GU_TwistParms &parms, int &p);
2056  int bend (const GU_TwistParms &parms, int &p);
2057  int squashStretch (const GU_TwistParms &parms, int &p);
2058  int shear (const GU_TwistParms &parms, int &p);
2059  int taper (const GU_TwistParms &parms, int &p);
2060  int linearTaper (const GU_TwistParms &parms, int &p);
2061 
2062  template <typename ArrayType>
2063  GEO_Curve * privateInterpCurveGlobal(
2064  const ArrayType &gpData,
2065  const GA_PrimitiveTypeId &type,
2066  int order, int wrapped,
2067  GA_ParameterizationType parmType,
2068  GA_KnotSpaceType knotSpaceType);
2069 
2070  void fillGrid(GEO_Hull &hull, int rows, int cols,
2071  float x_size, float y_size,
2072  float x_center, float y_center,
2073  float z_center,
2074  GU_OrientationType plane);
2075 
2076  void convertPolysToHull(
2077  GEO_ConvertParms &parms,
2078  bool keep_original);
2079  void convertToSoups(
2080  GEO_ConvertParms &parms,
2081  bool keep_original);
2082  void convertVolumesToVDBs(
2083  GEO_ConvertParms &parms,
2084  bool keep_original);
2085  void convertVDBsToVolumes(
2086  GEO_ConvertParms &parms,
2087  bool keep_original);
2088  void convertVolumesToPolys(
2089  GEO_ConvertParms &parms,
2090  bool keep_original);
2091  void convertMetasToPolys(
2092  GEO_ConvertParms &parms,
2093  bool keep_original);
2094  void convertTetsToPolys(
2095  GEO_ConvertParms &parms,
2096  bool keep_original);
2097  void doConversion(
2098  GEO_ConvertParms &parms,
2099  bool keep_original);
2100 
2101  void orientPoly(GEO_PrimPoly *poly,
2102  UT_BitArray &process,
2103  UT_BitArray &reverse);
2104 
2105  GEO_Primitive *surfCube(int xdiv, int ydiv, int zdiv,
2106  int orderx, int ordery, int orderz,
2107  float xmin, float xmax,
2108  float ymin, float ymax,
2109  float zmin, float zmax,
2110  GEO_SurfaceType type, int kind,
2111  bool consolidate);
2112 
2113  // Checks if a single primitive is dirty (see getDirtyData).
2114  bool isDirtySinglePrimitive(GA_Primitive *prim,
2115  bool checkRepPoints,
2116  float tol);
2117 
2118  void lodConvert(GA_PrimitiveGroup *grp,
2119  UT_BoundingBox &box, int cluster, float lod,
2120  bool makepolysoup = false);
2121  void divisionConvert(GA_PrimitiveGroup *grp, int adjust,
2122  UT_BoundingBox &box, int divx,int divy,int divz,
2123  const UT_Array<GA_PrimitiveGroup *> &groups,
2124  bool makepolysoup = false);
2125  int adjustStepBox(float &min, float &max, float step);
2126  void stepSizeConvert(GA_PrimitiveGroup *grp, int adjust,
2127  UT_BoundingBox &box, float sx,float sy,float sz,
2128  const UT_Array<GA_PrimitiveGroup *> &groups,
2129  bool makepolysoup = false);
2130 
2131  /// makes a single primitive planar (see makePrimsPlanar)
2132  bool primToPlane(GEO_Primitive *pprim,
2133  GA_PointGroup &fixedPoints);
2134 
2135  /// Prohibited to avoid accidentally passing by value.
2136  /// Use constructor that takes a const GU_Detail * if you
2137  /// really need to construct a copied detail.
2138  GU_Detail(const GU_Detail &src);
2139 
2140  friend class GU_PrimitiveFactory; // For intrinsic registration
2141 
2142  void construct()
2143  {
2144  myBoundingCache = nullptr;
2145  myVisibleBoundingCache = nullptr;
2146  myValueLookupCache = nullptr;
2147  }
2148 
2149  /// The sole cook selection associated with this detail.
2150  GU_SelectionHandle myCookSelection;
2151 
2152  template <bool VISIBLE_ONLY> class BoundingCacheT;
2153 
2154  template <bool VISIBLE_ONLY>
2155  static bool getCachedBoundsImpl(
2156  const GU_Detail &geo,
2157  UT_BoundingBox &box,
2158  BoundingCacheT<VISIBLE_ONLY> *&cache);
2159 
2160  mutable BoundingCacheT<false> *myBoundingCache;
2161  mutable BoundingCacheT<true> *myVisibleBoundingCache;
2162 
2163  mutable gu_ValueLookupCache *myValueLookupCache;
2164 };
2165 
2167 
2168 #endif
virtual void clearCaches()
Definition: GA_Detail.h:1923
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:937
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:963
const GA_IndexMap & getPrimitiveMap() const
Definition: GA_Detail.h:743
*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:72
GLint left
Definition: glcorearb.h:2005
getFileOption("OpenEXR:storage") storage
Definition: HDK_Image.dox:276
GA_DataIdStrategy
Definition: GA_Types.h:210
const GLdouble * v
Definition: glcorearb.h:837
GA_Precision
Definition: GA_Types.h:87
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:932
void reversePrimitiveList()
Definition: GU_Detail.h:1019
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:1017
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:999
UT_API UT_ErrorManager * UTgetErrorManager()
void proximityPoints(GA_IndexMap &points, const UT_Vector3 &point)
Definition: GU_Detail.h:1025
void vertexOrder(GA_IndexMap &points)
Definition: GU_Detail.h:1046
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:1748
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:1028
Structure for the PolySouping code.
void read(T &in, bool &v)
Definition: ImfXdr.h:502
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:235
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:678
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:196
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:641
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:973
GU_API void snapPoints(GU_Detail &qgdp, const GU_Detail *tgdp, const PointSnapParms &parms)
const GA_IndexMap & getPointMap() const
Definition: GA_Detail.h:741
float apply(GA_Offset off, float uval, int side) const
Definition: GU_Detail.h:1455
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:922
void reversePoints(GA_IndexMap &map)
Definition: GU_Detail.h:1011
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:1013
void shiftPrims(GA_IndexMap &map, GA_Size offset)
Definition: GU_Detail.h:991
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:997
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:989
void sortPointList(fpreal *order)
Definition: GU_Detail.h:971
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:953
#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:944
void sortPointList(const UT_Vector3 &o, const UT_Vector3 &d)
Definition: GU_Detail.h:942
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:965
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:1743
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:925
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:955
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:160
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:1037
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:914
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:1039
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:912
GU_TextureType
Definition: GU_Types.h:94
#define const
Definition: zconf.h:214
void sortPrims(GA_IndexMap &array, GU_AxisType axis=GU_XAXIS)
Definition: GU_Detail.h:907
SIM_API const UT_StringHolder distance
void sortByVertexOrder()
Definition: GU_Detail.h:1049
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:975
void write(T &out, bool v)
Definition: ImfXdr.h:287
type
Definition: core.h:1059
GA_API const UT_StringHolder rest
GA_KnotSpaceType
Definition: GA_Types.h:189
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:1753
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:977
GLenum src
Definition: glcorearb.h:1793