HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_PolyBridge.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_PolyBridge.h (GU Library, C++)
7  *
8  * COMMENTS:
9  *
10  */
11 
12 
13 #ifndef __GU_PolyBridge_h__
14 #define __GU_PolyBridge_h__
15 
16 #include "GU_API.h"
17 #include <UT/UT_Array.h>
18 #include <UT/UT_Ramp.h>
19 #include <GA/GA_Types.h>
20 #include <GA/GA_Edge.h>
21 #include <GA/GA_ElementGroup.h>
22 #include <GA/GA_Handle.h>
23 #include <GA/GA_ElementWrangler.h>
24 #include <GEO/GEO_Face.h>
25 #include <GEO/GEO_PolyCounts.h>
26 
27 class GU_Detail;
28 class GEO_Face;
29 class GA_EdgeGroup;
30 class GA_Attribute;
31 class UT_StringStream;
32 class GA_AttributeRefMap;
33 class GU_Spine;
34 class GEO_PrimPoly;
35 
36 /// A GU_Spine encapsulates a "spine curve": an open curve together
37 /// with a rotation minimizing orthonormal frame at every point. You can
38 /// create a spine by supplying the two points and the tangents to the curve
39 /// at each of them as well as the curve normal at the first point. This
40 /// will normally create a smooth curve between the two points with the given
41 /// tangents. The magnitudes of the tangents can be controlled. Furthermore,
42 /// it is possible to force the spine to move straight along a tangent for a
43 /// an initial part of the curve and only start to blend into the other
44 /// direction during a given range. It is also possible to provide an external
45 /// curve after which to model the spine. The external curve is positioned
46 /// according to the supplied positioning method and the source and destination
47 /// directions are blended separately according to their respective blending
48 /// ranges with this curve. The two resulting curves are then blended using a
49 /// cubic smooth step function. The main output method is sample() which
50 /// samples the generated spine to produce arrays of point positions, tangents,
51 /// and normals. An evaluate spine method is also provided which evaluates
52 /// the spine curve on a [0-1] parameterization. Note that rotation minimizing
53 /// frames are only evaluated during sampling and cannot be accessed for
54 /// random access.
55 
57 {
58 public:
60  {
61  AS_IS = 0,
68  TRANSLATE_TO_DST
69  };
70 
72  {
73  PARAMETER_UNIFORM = 0,
75  CURVATURE_ADAPTIVE
76  };
77 
78  explicit GU_Spine(const GEO_Face *curve = nullptr,
79  bool reverse = false,
80  fpreal u0 = 0.0, fpreal u1 = 1.0,
81  bool straight = false);
82 
83  ~GU_Spine() = default;
84 
85  void position(UT_Vector3 src_pos, UT_Vector3 src_tan,
86  UT_Vector3 src_norm, UT_Vector3 dst_pos,
87  UT_Vector3 dst_tan, Positioning = SRC_TO_DST,
88  fpreal axial_rotation = 0.0);
89 
90  void sample(int size, SampleMode sample_mode,
91  UT_Vector3Array &pos,
93  UT_Vector3Array &norm,
94  UT_FprealArray &uvals,
95  bool miter, UT_Vector3Array *expands);
96 
97  void setStiffness(fpreal s0, fpreal s1)
98  { mySrcStiffness = s0; myDstStiffness = s1; }
99 
100  void setBlend(fpreal b0, fpreal b1)
101  { mySrcBlend = b0; myDstBlend = b1; }
102 
104  { myClipU0 = c0; myClipU1 = c1; }
105 
106  void getClip0(UT_Vector3 &p, UT_Vector3 &t, UT_Vector3 &n);
107  void getClip1(UT_Vector3 &p, UT_Vector3 &t, UT_Vector3 &n);
108 
109  /// Evaluate the spine curve at parameter value u. The second parameter
110  /// du can only be 0 or 1 to evaluate the point position or the tangent
111  /// vector.
112 
113  UT_Vector3 evalSpine(fpreal u, int du);
114 
115  fpreal evalExternalAttribF(GA_ROHandleF ah, fpreal u,
117  UT_FloatArray &weights,
118  GA_AttributeOwner owner);
119 
120 private:
121  void setup();
122  void sampleParameter(SampleMode sample_mode,
123  UT_FprealArray &sample_u);
124 
125  UT_Vector3 evalBaseCurve(fpreal u, int du);
126  UT_Vector3 evalSrcCurve(fpreal u, int du);
127  UT_Vector3 evalDstCurve(fpreal u, int du);
128  UT_Vector3 evalPolyLineCurve(fpreal u, int du);
129  void getPolyLineWeights(fpreal u, int &i0, int &i1,
130  fpreal &w0, fpreal &w1);
131 
132 
133  void setupPolyLineSpineCurve();
134 
135  inline fpreal unitToRealDomain(fpreal u_unit);
136 
137  inline UT_Vector3 evalExternalCurve(fpreal u, int du = 0);
138 
139  UT_Vector3 positionCurvePoint(UT_Vector3 x);
140 
142  int getNumCVs()
143  {
144  return myCurve
145  ? int(myCurve->getFastVertexCount())
146  : myNumCVs;
147  }
148 
149  inline UT_Vector3 getCV(int i)
150  {
151  return (myCurve) ?
152  positionCurvePoint(
153  myCurve->getDetail().getPos3(
154  myCurve->getPointOffset(i))) :
155  myCVs[i];
156  }
157 
158  fpreal myClipU0 = 0.0;
159  fpreal myClipU1 = 1.0;
160  fpreal myU0, myU1;
161 
162  UT_Vector3 myClipP0, myClipT0, myClipN0;
163  UT_Vector3 myClipP1, myClipT1, myClipN1;
164 
165  UT_Vector3 mySrcP = { 0.0, 0.0, 0.0 };
166  UT_Vector3 mySrcT = { 0.0, 0.0, 0.0 };
167  UT_Vector3 mySrcN = { 0.0, 0.0, 0.0 };
168  UT_Vector3 myDstP = { 0.0, 0.0, 0.0 };
169  UT_Vector3 myDstT = { 0.0, 0.0, 0.0 };
170 
171  fpreal mySrcStiffness, myDstStiffness;
172  fpreal mySrcBlend, myDstBlend;
173 
174  Positioning myPositioninig;
175  fpreal myAxialRotation = 0.0;
176 
177  bool myIsPolyLine = false;
178  bool myReverse = false;
179  bool myStraight = false;
180  bool myTrivial = true;
181  bool myInternalSpine = false;
182 
183  const GEO_Face *myCurve = nullptr;
184 
185  // For a polyline spine:
186  fpreal myLength = 0.0;
187  UT_FprealArray myBreakpoints;
188 
189  // For Bezier spine from tangent/normal pairs at ends.
190  int myNumCVs = 0;
191  UT_Vector3 myCVs[6];
192 
193  fpreal myScale;
194  UT_Vector3 myOrigin;
195  UT_Vector3 myTranslate;
196  UT_Quaternion myCurveToBridgeQ;
197  UT_Quaternion myAxialRotationQ;
198 
199 
200 };
201 
202 fpreal
203 GU_Spine::unitToRealDomain(fpreal u_unit)
204 {
205  if (u_unit < 0.0f)
206  u_unit = 0.0f;
207  else if (u_unit > 1.0f)
208  u_unit = 1.0f;
209 
210  return u_unit * fpreal(myNumCVs - 3);
211 }
212 
213 /// GU_PolyBridge encapsulates most of the functionality of the polybridge sop.
214 /// It can generate a bridge between a source and a destination edge loop each
215 /// of which can be open or closed.
216 
217 
219 {
220 public:
221 
223  {
224  INTERPOLATE = -1,
227  PROPORTIONAL
228  };
229 
231  {
232  FIT_UNIT_SQUARE = 0,
234  MATCH_UV
235  };
236 
238  const GA_OffsetArray &src_chain,
239  bool src_chain_closed,
240  const GA_OffsetArray &dst_chain,
241  bool dst_chain_closed,
242  bool straight_bridge = true,
243  bool allow_coincident_centroids = false);
244 
245  ~GU_PolyBridge() = default;
246 
247  typedef std::pair<int, int> IndexPair;
249 
250  inline void buildTopology(int divisions,
251  int src_divisions = 0,
252  int dst_divisions = 0,
253  IndexPairArray *pairings = nullptr)
254  {
255  computeBridge(GA_INVALID_OFFSET, GA_INVALID_OFFSET, divisions,
256  src_divisions, dst_divisions, 0, pairings);
257  }
258 
259  inline void writeGeometry(GA_Offset ptoff0,
260  GA_Offset primoff0,
261  int num_twists = 0,
262  const GU_Detail *tgdp = nullptr,
263  const GA_Offset *src_rep_vtx = nullptr,
264  const GA_Offset *dst_rep_vtx = nullptr,
265  GA_PointWrangler *pt_wrangler = nullptr,
266  GA_PrimitiveWrangler *prim_wrangler = nullptr,
267  GA_VertexWrangler *vtx_wrangler = nullptr)
268  {
269  computeBridge(ptoff0, primoff0, -1, -1, -1, num_twists, nullptr, tgdp,
270  src_rep_vtx, dst_rep_vtx, pt_wrangler, prim_wrangler,
271  vtx_wrangler);
272  }
273 
274  int getNumMeshPolys() const
275  { return int(myQuadSizeList.getNumPolygons()); }
276 
277  int getNumMeshPolyVtxs() const
278  { return int(myQuadPtNums.size()); }
279 
280  GA_Offset setupBatchBuild(GA_Offset ptoff0,
281  UT_IntArray &quad_pt_nums,
282  GEO_PolyCounts &quad_size_list);
283 
284  void fillGroups(GA_Offset ptoff0,
285  GA_Offset primoff0,
286  GA_OffsetArray *user_link_grp,
287  GA_OffsetArray *auto_link_grp,
288  GA_OffsetArray *boundary_link_grp,
289  GA_OffsetArray *src_chain_grp,
290  GA_OffsetArray *dst_chain_grp);
292  {
293  DIR_SIGN_AUTO = 0,
295  DIR_SIGN_NEG
296  };
297 
299  {
300  LINEAR = 0,
302  };
303 
306 
308  { setupEnds(); return mySrcCtr; }
309 
311  { setupEnds(); return myDstCtr; }
312 
314  { myWarningStream = w; }
315 
317  { mySpineThickness = attrib; }
318 
320  { mySpineTwist = attrib; }
321 
323  { myMorphMethod = m; }
324 
325  void setMagnitudes(fpreal s = 1.0, fpreal d = 1.0)
326  { mySrcMagnitude = s; myDstMagnitude = d; }
327 
328  void setStiffnesses(fpreal s = 0.0, fpreal d = 0.0)
329  { mySrcStiffness = s; myDstStiffness = d; }
330 
332  { myAxialRotation = r; }
333 
334  void setExternalSpine(const GEO_Face *curve)
335  { myExternalSpine = curve; }
336 
338  { myThicknessRamp = ramp; }
339 
340  void setTwistRamp(UT_Ramp *ramp)
341  { myTwistRamp = ramp; }
342 
344  { mySrcDir = dir; mySrcDirGiven = true; }
345 
347  { myDstDir = dir; myDstDirGiven = true; }
348 
350  { mySrcCtr = ctr; mySrcCtrGiven = true; }
351 
353  { myDstCtr = ctr; myDstCtrGiven = true; }
354 
355  void setAttachToSrc(bool attach)
356  { myAttachToSrc = attach; }
357 
358  void setAttachToDst(bool attach)
359  { myAttachToDst = attach; }
360 
362  { myThicknessUnit = s; }
363 
365  { myMinTwist = min; myMaxTwist = max; }
366 
367  void setReverseSpine(bool r)
368  { myReverseSpine = r; }
369 
371  { mySrcDirSign = t; }
372 
374  { myDstDirSign = t; }
375 
377  { myClipStart = s; myClipEnd = e; }
378 
379  void setGenerateSpine(bool b)
380  { myDoGenerateSpine = b; }
381 
383  { mySpinePointGroup = grp; }
384 
385  void setGenerateMesh(bool b)
386  { myDoGenerateMesh = b; }
387 
389  { myMeshPrimGroup = grp; }
390 
392  { myTangentAttrib = attrib; }
393 
395  { myNormalAttrib = attrib; }
396 
398  { myBinormalAttrib = attrib; }
399 
400  void pairByEdgeCount(bool b)
401  { myPairByEdgeCount = b; }
402 
403  void setPairingShift(int s)
404  { myPairingShift = s; }
405 
407  { mySpineStart = s; mySpineEnd = e; }
408 
409  void setExtSpineBlend(fpreal s = 0.0, fpreal d = 0.0)
410  { mySrcBlend = s; myDstBlend = d; }
411 
413  { mySpinePlacement = p; }
414 
416  { mySpineSampleMethod = m; }
417 
418  void setMiterJoints(bool b)
419  { myMiterJoints = b; }
420 
421  void setScaleInvariant(bool b)
422  { myScaleInvariant = b; }
423 
425  { myPreTwist = t; }
426 
428  { mySrcEdgeGroup = grp; }
429 
431  { myDstEdgeGroup = grp; }
432 
433  void setChainRefs(int src_ref, int dst_ref)
434  { mySrcRef = src_ref; myDstRef = dst_ref; }
435 
437  { mySrcFrameUpDir = dir;
438  mySrcFrameUpDirGiven = true; }
439 
441  { myDstFrameUpDir = dir;
442  myDstFrameUpDirGiven = true; }
443 
444  int getNumSrcLoopPts() const
445  { return int(mySrcLoop.entries()); }
446 
447  int getNumDstLoopPts() const
448  { return int(myDstLoop.entries()); }
449 
450  void setCollectedLinks(bool user_links, bool auto_links,
451  bool boundary_links);
452 
453  void fillWrangleDetail(GA_Offset base_offset,
454  GA_Offset *src_vtx_rep,
455  GA_Offset *dst_vtx_rep,
456  const GA_Offset *supplied_src_vtx_rep,
457  const GA_Offset *supplied_dst_vtx_rep,
458  GA_PrimitiveWrangler *prim_wrangler,
459  GA_VertexWrangler *vtx_wrangler,
460  bool is_edge_extrusion,
462  TextureMode uv_style = INTERPOLATE,
463  TextureScaling uv_scaling = FIT_UNIT_SQUARE);
464 
465 private:
466 
467  void computeBridge(GA_Offset ptoff0,
468  GA_Offset primoff0,
469  int divisions,
470  int src_divisions = 0,
471  int dst_divisions = 0,
472  int num_twists = 0,
473  IndexPairArray *pairings = nullptr,
474  const GU_Detail *tgdp = nullptr,
475  const GA_Offset *src_rep_vtx = nullptr,
476  const GA_Offset *dst_rep_vtx = nullptr,
477  GA_PointWrangler *pt_wrangler = nullptr,
478  GA_PrimitiveWrangler *prim_wrangler = nullptr,
479  GA_VertexWrangler *vtx_wrangler = nullptr);
480 
481  void generateLinks(UT_FprealArray &srcs,
482  int src_first, int src_last,
483  UT_FprealArray &dst_breakpoitns,
484  int dst_first, int dst_last,
485  IndexPairArray &links,
486  bool do_full_circle);
487 
488  fpreal unitize(UT_FprealArray &breakpoints,
489  int i, int first = 0, int last = -1) const;
490 
491  UT_Vector3 getLinkPointPosition(int i, fpreal t);
492 
493 
494  UT_Vector3 getLinkPointPositionLinear(int i, fpreal t);
495  GU_Spine *sampleSpine(int divisions);
496 
497  /// All of these methods return true if their results differ from the
498  /// cached previous ones.
499  bool setupEnds();
500  bool setupDirs();
501 
502  bool calcDefaultPairingRefs();
503  void calcPositionsInEndFrames();
504  void buildLinks(IndexPairArray *forced_pairs);
505 
506  /// Given a gramgement of a chain 'cycle', interpreted cyclically, with
507  /// two reference indices 'start_cycle_ref' and 'end_cycle_ref'
508  /// (respectively the indices at which the fragment starts and ends, and a
509  /// second chain 'path', interpreted linearly, with two references indices
510  /// 'path_prefix_end_ref' and 'path_suffix_begin_ref, with the former
511  /// always being less than or equal to the latter, return the index
512  /// 'idx' withing the cycle fragment which breaks it best in the sense that
513  /// the ratio between the lengths "from cycle_start_ref to idx" and
514  /// "from idx to cycle_end_ref" is as close as possible to
515  /// ratio between length of the prefix of the path that ends at index
516  /// path_prefix_end_ref and the suffix of the path that starts at
517  /// index path_suffix_begin_ref. Note that start_cycle_ref may be equal
518  /// to end_cycle_ref indicating that we want to divide the entire cycle.
519  /// It is also possible for the path_pref_end_ref and path_suffix_begin_ref
520  /// to be equal.
521 
522  int breakCycleRange(GA_OffsetArray &cycle,
523  int start_cycle_ref, int end_cycle_ref,
525  int path_prefix_end_ref,
526  int path_suffix_start_ref);
527 
528 
529  /// Given a set of pre-specified pairings between source and destination
530  /// chain points, we must *sort* them out before generating the lines
531  /// between consecutive pairs. When one or both links are closed (circular)
532  /// this sorting becomes non-trivial. We deal with this by using the first
533  /// pre-specified pair (s0, d0) of source and destination indices as a
534  /// references. If both chains are closed, then we use s0 and d0
535  /// respectively as the starting indices for the two circular lists. If
536  /// one of the chains is open, then we pick the starting index on the
537  /// closed chain so that all
538 
539  void findChainBaseIndices(IndexPairArray *forced_pairs,
540  int &src_base_idx,
541  int &dst_base_idx);
542 
543  void monotonizePairs(IndexPairArray &pairs,
544  IndexPairArray &dropped_pairs,
545  bool circular_first = false,
546  bool circular_second = false);
547 
548  UT_Vector3 calcLoopCentroid(const GA_OffsetArray &loop,
549  bool closed);
550  UT_Vector3 calcLoopNormalAndRadius(GA_OffsetArray &loop,
551  bool closed, UT_Vector3 center,
552  fpreal &radius, fpreal &length);
553 
554  int findLoopFarthestPoint(GA_OffsetArray &loop,
555  UT_Vector3 from_pos,
556  fpreal max_dist = -1.0,
557  UT_Vector3 halfspace_normal
558  = UT_Vector3(0.0, 0.0, 0.0),
559  fpreal topple_bump_factor = 0.01);
560 
561  GA_Offset appendPt(GA_Offset &baseoff,
562  GA_Offset ptoff = GA_INVALID_OFFSET);
563 
564  void addLinksToEdgeGroup(const IndexPairArray &pairs,
565  GA_EdgeGroup *grp);
566 
567  int findTwoAxisExtremePoint(const GA_OffsetArray &pts,
568  UT_Vector3 ctr, UT_Vector3 tie_breaker,
569  UT_Vector3 x_dir, UT_Vector3 y_dir,
570  fpreal tol);
571 
572  void calcTextureRange(UT_Array<GA_ROHandleV3> &uvs,
573  TextureMode uv_style, TextureScaling uv_scaling,
574  UT_FprealArray &ranges, bool is_edge_extrusion);
575 
576 
577  void setWrangleDetailTextureCoords(GA_Offset base_offset,
578  GA_OffsetArray &loop,
579  int ref_idx, fpreal u, fpreal v_min,
580  fpreal v_max, fpreal loop_len,
581  GA_RWHandleV3 &uvh);
582 
584  fpreal spineLength() const { return mySpineArcLength.last(); }
585  enum LinkType
586  {
587  LINK_TYPE_NORMAL = 0,
588  LINK_TYPE_USER,
589  LINK_TYPE_AUTO,
590  LINK_TYPE_BOUNDARY
591  };
592 
593  void dumpChains();
594  void dumpLinks(IndexPairArray *links,
595  int src_base_idx = 0,
596  int dst_base_idx = 0,
597  UT_Array<LinkType> *types = nullptr);
598 
599  class FirstThenSecond
600  {
601  public:
602  inline bool operator()(const IndexPair &a, const IndexPair &b) const
603  {
604  if (a.first == b.first)
605  return a.second < b.second;
606  else
607  return a.first < b.first;
608  }
609  };
610 
611 
612  class SecondThenFirst
613  {
614  public:
615  inline bool operator()(const IndexPair &a, const IndexPair &b) const
616  {
617  if (a.second == b.second)
618  return a.first < b.first;
619  else
620  return a.second < b.second;
621  }
622  };
623 
624  bool myEndsAreSetUp = false;
625  bool myDirsAreSetUp = false;
626  bool myHaveDefaultPairingRefs = false;
627  bool myReverseSpine = false;
628  bool myMiterJoints = true;
629 
630  bool mySrcDirGiven = false;
631  bool myDstDirGiven = false;
632  bool mySrcCtrGiven = false;
633  bool myDstCtrGiven = false;
634 
635  bool mySrcFrameUpDirGiven = false;
636  bool myDstFrameUpDirGiven = false;
637 
638  bool myDoGenerateSpine = false;
639  bool myDoGenerateMesh = true;
640 
641  bool myPairByEdgeCount = false;
642 
643  bool mySrcClosed = true;
644  bool myDstClosed = true;
645  bool myAttachToSrc = true;
646  bool myAttachToDst = true;
647 
648  bool myCollectUserLinks = false;
649  bool myCollectAutoLinks = false;
650  bool myCollectBoundaryLinks = false;
651 
652  bool mySpineIsStraight: 1;
653  bool myAllowCoincidentCentroids = false;
654  bool myScaleInvariant = true;
655 
656  int myPairingShift = 0;
657  int mySrcRef = -1;
658  int myDstRef = -1;
659 
660  GU_Spine *mySpine = nullptr;
661  GA_PrimitiveGroup *myMeshPrimGroup = nullptr;
662  GA_PointGroup *mySpinePointGroup = nullptr;
663 
664  GA_RWHandleV3 myTangentAttrib;
665  GA_RWHandleV3 myNormalAttrib;
666  GA_RWHandleV3 myBinormalAttrib;
667 
668  GA_OffsetArray mySrcLoop, myDstLoop;
669 
670  fpreal mySrcRadius = 0.0;
671  fpreal myDstRadius = 0.0;
672  fpreal mySrcMagnitude = 1.0;
673  fpreal myDstMagnitude = 1.0;
674  fpreal mySrcStiffness = 0.0;
675  fpreal myDstStiffness = 0.0;
676  fpreal myClipStart = 0.0;
677  fpreal myClipEnd = 1.0;
678  fpreal mySpineStart = 0.0;
679  fpreal mySpineEnd = 1.0;
680  fpreal mySrcLength = 0.0;
681  fpreal myDstLength = 0.0;
682  UT_FprealArray mySpineArcLength;
683 
684  UT_Vector3 mySrcDir = { 0.0, 0.0, 0.0 };
685  UT_Vector3 myDstDir = { 0.0, 0.0, 0.0 };
686  UT_Vector3 mySrcCtr = { 0.0, 0.0, 0.0 };
687  UT_Vector3 myDstCtr = { 0.0, 0.0, 0.0 };
688  UT_Vector3 mySrcLoopNormal = { 0.0, 0.0, 0.0 };
689  UT_Vector3 myDstLoopNormal = { 0.0, 0.0, 0.0 };
690  UT_Vector3 mySrcFrameUpDir = { 0.0, 0.0, 0.0 };
691  UT_Vector3 myDstFrameUpDir = { 0.0, 0.0, 0.0 };
692 
693  UT_Vector3Array mySrcLocalPos, myDstLocalPos;
694 
695  UT_IntArray myLinkSrcs, myLinkDsts;
696  UT_Array<LinkType> myLinkTypes;
697 
698  MorphMethod myMorphMethod = ROTATING_FRAME;
699 
700  UT_Ramp *myThicknessRamp = nullptr;
701  fpreal myThicknessUnit = 1.0;
702 
703  UT_Ramp *myTwistRamp = nullptr;
704  fpreal myMaxTwist = M_PI;
705  fpreal myMinTwist = -M_PI;
706 
707  const GEO_Face *myExternalSpine = nullptr;
708 
709  SpinePositioning mySpinePlacement = GU_Spine::SRC_TO_DST;
710  UT_Vector3 mySpineTranslate = { 0.0, 0.0, 0.0 };
711  UT_Quaternion myCurveToBridgeQ;
712  fpreal myAxialRotation = 0.0;
713  UT_Quaternion myAxialRotationQ;
714 
715  DirectionSign mySrcDirSign = DIR_SIGN_POS;
716  DirectionSign myDstDirSign = DIR_SIGN_POS;
717 
718  UT_StringStream *myWarningStream = nullptr;
719 
720  UT_Vector3Array mySpineP, mySpineT, mySpineN, myExpands;
721  UT_FprealArray mySpineU;
722 
723  UT_Vector3 myStartClipP, myStartClipT, myStartClipN;
724  UT_Vector3 myEndClipP, myEndClipT, myEndClipN;
725 
726  GU_Detail *myGdp;
727 
728  GA_RWHandleF mySpineThickness;
729  GA_RWHandleF mySpineTwist;
730 
731  fpreal myPreTwist = 0.0;
732  fpreal mySrcBlend = 0.0;
733  fpreal myDstBlend = 0.0;
734 
735  GA_EdgeGroup *mySrcEdgeGroup = nullptr;
736  GA_EdgeGroup *myDstEdgeGroup = nullptr;
737 
738  SpineSampleMethod mySpineSampleMethod = GU_Spine::PARAMETER_UNIFORM;
739 
740  int myNumQuads = 0;
741  int myNumNewPts = 0;
742 
743  GA_OffsetArray myLocalPtOffset;
744  GA_OffsetArray myQuadPtNums;
745  GEO_PolyCounts myQuadSizeList;
746 
747  GA_OffsetArray mySrcQuads, myDstQuads;
748  GA_OffsetArray mySpinePts;
749 
750  GA_OffsetArray myUserLinkEdges;
751  GA_OffsetArray myAutoLinkEdges;
752  GA_OffsetArray myBoundaryLinkEdges;
753 
754  GA_Offset myInputLastPrimOffset;
755 
756  int myDivs = -1;
757  int mySrcDivs = -1;
758  int myDstDivs = -1;
759 
760 };
761 
763  GU_PolyBridge **bridges,
764  bool is_edge_extrusion,
765  int num_bridges,
766  const GA_Offset *src_rep_vtxs = nullptr,
767  const GA_Offset *dst_rep_vtxs = nullptr,
768  GA_PrimitiveGroup *mesh_prims = nullptr,
769  GA_OffsetArray *user_link_grp = nullptr,
770  GA_OffsetArray *auto_link_grp = nullptr,
771  GA_OffsetArray *boundary_link_grp = nullptr,
772  GA_OffsetArray *src_chain_grp = nullptr,
773  GA_OffsetArray *dst_chain_grp = nullptr,
774  int num_twists = 0,
775  bool wrangle_pt_attribs = true,
776  bool wrangle_prim_attribs = true,
777  bool wrangle_vtx_attribs = true,
782 
783 /// This is a very useful tool to find the Minimum Rotation Frame for a
784 /// movement from x0 to x1 along a curve with tangent and normal t0 and n0
785 /// at x0 and tangent t1 and x1. It is based on the double-reflection method
786 /// of Wang, Juttler, Zheng, and Liu described in a paper titled
787 /// "Computation of Rotation Minimizing Frames", from ACM Transactions on
788 /// Graphics 2008.
789 
791  UT_Vector3 n0, UT_Vector3 x1, UT_Vector3 t1);
792 
793 
794 #endif
GLint first
Definition: glcorearb.h:405
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
Definition of a geometry attribute.
Definition: GA_Attribute.h:198
void setDstCtr(UT_Vector3 ctr)
void setExtSpinePositioning(SpinePositioning p)
UT_Array< IndexPair > IndexPairArray
UT_Array< IndexPair > IndexPairArray
Definition: USD_Utils.h:224
GU_API void GUbatchBuildBridges(GU_Detail *gdp, GU_PolyBridge **bridges, bool is_edge_extrusion, int num_bridges, const GA_Offset *src_rep_vtxs=nullptr, const GA_Offset *dst_rep_vtxs=nullptr, GA_PrimitiveGroup *mesh_prims=nullptr, GA_OffsetArray *user_link_grp=nullptr, GA_OffsetArray *auto_link_grp=nullptr, GA_OffsetArray *boundary_link_grp=nullptr, GA_OffsetArray *src_chain_grp=nullptr, GA_OffsetArray *dst_chain_grp=nullptr, int num_twists=0, bool wrangle_pt_attribs=true, bool wrangle_prim_attribs=true, bool wrangle_vtx_attribs=true, GU_PolyBridge::TextureMode uv_style=GU_PolyBridge::INTERPOLATE, GU_PolyBridge::TextureScaling uv_scaling=GU_PolyBridge::FIT_UNIT_SQUARE)
void setAttachToSrc(bool attach)
#define M_PI
Definition: fmath.h:98
void setSrcCtr(UT_Vector3 ctr)
UT_Vector3T< float > UT_Vector3
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
UT_Vector3 getSrcCentroid()
void setThicknessRamp(UT_Ramp *ramp)
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1222
GLdouble s
Definition: glad.h:3009
PUGI__FN void reverse(I begin, I end)
Definition: pugixml.cpp:7458
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:795
void setAttachToDst(bool attach)
void setAxialRotation(fpreal r)
void setTangentAttrib(GA_Attribute *attrib)
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
void setGenerateSpine(bool b)
void setTwistRamp(UT_Ramp *ramp)
int getNumMeshPolyVtxs() const
UT_Vector3 getDstCentroid()
void writeGeometry(GA_Offset ptoff0, GA_Offset primoff0, int num_twists=0, const GU_Detail *tgdp=nullptr, const GA_Offset *src_rep_vtx=nullptr, const GA_Offset *dst_rep_vtx=nullptr, GA_PointWrangler *pt_wrangler=nullptr, GA_PrimitiveWrangler *prim_wrangler=nullptr, GA_VertexWrangler *vtx_wrangler=nullptr)
void setNormalAttrib(GA_Attribute *attrib)
void setThicknessScale(fpreal s)
GLdouble u1
Definition: glad.h:2676
#define GA_INVALID_OFFSET
Definition: GA_Types.h:687
GLuint GLsizei const GLuint const GLintptr * offsets
Definition: glcorearb.h:2621
void setWarningStream(UT_StringStream *w)
GA_Size GA_Offset
Definition: GA_Types.h:646
void setMiterJoints(bool b)
GLdouble n
Definition: glcorearb.h:2008
GLfloat f
Definition: glcorearb.h:1926
void setClipRange(fpreal c0, fpreal c1)
void setReverseSpine(bool r)
void setChainRefs(int src_ref, int dst_ref)
void setClipRange(fpreal s, fpreal e)
int getNumDstLoopPts() const
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
void setTwistRange(fpreal min, fpreal max)
An bi-directional stream object that owns its own string buffer storage.
int getNumMeshPolys() const
void setMeshGroup(GA_PrimitiveGroup *grp)
A handle to simplify manipulation of multiple attributes.
GLint i1
Definition: glad.h:2724
void setSrcDir(UT_Vector3 dir)
void setExternalSpine(const GEO_Face *curve)
void setExtSpineBlend(fpreal s=0.0, fpreal d=0.0)
#define GU_API
Definition: GU_API.h:14
void setSrcEdgeGroup(GA_EdgeGroup *grp)
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
GLint GLenum GLint x
Definition: glcorearb.h:409
void setScaleInvariant(bool b)
void setSrcFrameUpDir(UT_Vector3 dir)
void setBinormalAttrib(GA_Attribute *attrib)
GLdouble t
Definition: glad.h:2397
void setBlend(fpreal b0, fpreal b1)
void setDstDirectionSign(DirectionSign t)
void setExtSpineRange(fpreal s, fpreal e)
__hostdev__ uint64_t last(uint32_t i) const
Definition: NanoVDB.h:5976
GLsizeiptr size
Definition: glcorearb.h:664
SYS_API double tan(double x)
void setSpineSampleMethod(SpineSampleMethod m)
GA_AttributeOwner
Definition: GA_Types.h:35
void setSrcDirectionSign(DirectionSign t)
void setTwistAttrib(GA_Attribute *attrib)
void setDstEdgeGroup(GA_EdgeGroup *grp)
fpreal64 fpreal
Definition: SYS_Types.h:278
Utility class for containing a color ramp.
Definition: UT_Ramp.h:96
SIM_API const UT_StringHolder position
std::pair< exint, exint > IndexPair
Definition: USD_Utils.h:223
void pairByEdgeCount(bool b)
int getNumSrcLoopPts() const
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
void setPairingShift(int s)
void setSpineGroup(GA_PointGroup *grp)
GU_API UT_Vector3 guRMFSlideFrame(UT_Vector3 x0, UT_Vector3 t0, UT_Vector3 n0, UT_Vector3 x1, UT_Vector3 t1)
void setPreTwist(fpreal t)
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
void setGenerateMesh(bool b)
void setThicknessAttrib(GA_Attribute *attrib)
void setMorphMethod(MorphMethod m)
GLsizei GLenum GLenum * types
Definition: glcorearb.h:2542
GLboolean r
Definition: glcorearb.h:1222
void setDstFrameUpDir(UT_Vector3 dir)
void setDstDir(UT_Vector3 dir)
void setMagnitudes(fpreal s=1.0, fpreal d=1.0)
void setStiffness(fpreal s0, fpreal s1)
Definition: GU_PolyBridge.h:97
std::pair< int, int > IndexPair
void buildTopology(int divisions, int src_divisions=0, int dst_divisions=0, IndexPairArray *pairings=nullptr)
void setStiffnesses(fpreal s=0.0, fpreal d=0.0)