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 
275  void buildBridge(const GA_Offset *src_rep_vtx,
276  const GA_Offset *dst_rep_vtx,
277  GA_OffsetArray *user_link_grp = nullptr,
278  GA_OffsetArray *auto_link_grp = nullptr,
279  GA_OffsetArray *boundary_link_grp = nullptr,
280  GA_OffsetArray *src_chain_grp = nullptr,
281  GA_OffsetArray *dst_chain_grp = nullptr,
282  int num_twists = 0);
283 
284 
285  int getNumMeshPolys() const
286  { return int(myQuadSizeList.getNumPolygons()); }
287 
288  int getNumMeshPolyVtxs() const
289  { return int(myQuadPtNums.size()); }
290 
291  GA_Offset setupBatchBuild(GA_Offset ptoff0,
292  UT_IntArray &quad_pt_nums,
293  GEO_PolyCounts &quad_size_list);
294 
295  void fillGroups(GA_Offset ptoff0,
296  GA_Offset primoff0,
297  GA_OffsetArray *user_link_grp,
298  GA_OffsetArray *auto_link_grp,
299  GA_OffsetArray *boundary_link_grp,
300  GA_OffsetArray *src_chain_grp,
301  GA_OffsetArray *dst_chain_grp);
303  {
304  DIR_SIGN_AUTO = 0,
306  DIR_SIGN_NEG
307  };
308 
310  {
311  LINEAR = 0,
313  };
314 
317 
319  { setupEnds(); return mySrcCtr; }
320 
322  { setupEnds(); return myDstCtr; }
323 
325  { myWarningStream = w; }
326 
328  { mySpineThickness = attrib; }
329 
331  { mySpineTwist = attrib; }
332 
334  { myMorphMethod = m; }
335 
336  void setMagnitudes(fpreal s = 1.0, fpreal d = 1.0)
337  { mySrcMagnitude = s; myDstMagnitude = d; }
338 
339  void setStiffnesses(fpreal s = 0.0, fpreal d = 0.0)
340  { mySrcStiffness = s; myDstStiffness = d; }
341 
343  { myAxialRotation = r; }
344 
345  void setExternalSpine(const GEO_Face *curve)
346  { myExternalSpine = curve; }
347 
349  { myThicknessRamp = ramp; }
350 
351  void setTwistRamp(UT_Ramp *ramp)
352  { myTwistRamp = ramp; }
353 
355  { mySrcDir = dir; mySrcDirGiven = true; }
356 
358  { myDstDir = dir; myDstDirGiven = true; }
359 
361  { mySrcCtr = ctr; mySrcCtrGiven = true; }
362 
364  { myDstCtr = ctr; myDstCtrGiven = true; }
365 
366  void setAttachToSrc(bool attach)
367  { myAttachToSrc = attach; }
368 
369  void setAttachToDst(bool attach)
370  { myAttachToDst = attach; }
371 
373  { myThicknessUnit = s; }
374 
376  { myMinTwist = min; myMaxTwist = max; }
377 
378  void setReverseSpine(bool r)
379  { myReverseSpine = r; }
380 
382  { mySrcDirSign = t; }
383 
385  { myDstDirSign = t; }
386 
388  { myClipStart = s; myClipEnd = e; }
389 
390  void setGenerateSpine(bool b)
391  { myDoGenerateSpine = b; }
392 
394  { mySpinePointGroup = grp; }
395 
396  void setGenerateMesh(bool b)
397  { myDoGenerateMesh = b; }
398 
400  { myMeshPrimGroup = grp; }
401 
403  { myTangentAttrib = attrib; }
404 
406  { myNormalAttrib = attrib; }
407 
409  { myBinormalAttrib = attrib; }
410 
411  void pairByEdgeCount(bool b)
412  { myPairByEdgeCount = b; }
413 
414  void setPairingShift(int s)
415  { myPairingShift = s; }
416 
418  { mySpineStart = s; mySpineEnd = e; }
419 
420  void setExtSpineBlend(fpreal s = 0.0, fpreal d = 0.0)
421  { mySrcBlend = s; myDstBlend = d; }
422 
424  { mySpinePlacement = p; }
425 
427  { mySpineSampleMethod = m; }
428 
429  void setMiterJoints(bool b)
430  { myMiterJoints = b; }
431 
432  void setScaleInvariant(bool b)
433  { myScaleInvariant = b; }
434 
436  { myPreTwist = t; }
437 
439  { mySrcEdgeGroup = grp; }
440 
442  { myDstEdgeGroup = grp; }
443 
444  void setChainRefs(int src_ref, int dst_ref)
445  { mySrcRef = src_ref; myDstRef = dst_ref; }
446 
448  { mySrcFrameUpDir = dir;
449  mySrcFrameUpDirGiven = true; }
450 
452  { myDstFrameUpDir = dir;
453  myDstFrameUpDirGiven = true; }
454 
455  int getNumSrcLoopPts() const
456  { return int(mySrcLoop.entries()); }
457 
458  int getNumDstLoopPts() const
459  { return int(myDstLoop.entries()); }
460 
461  void setWranglePoint(bool w) { myWranglePt = w; }
462  void setWranglePrimitive(bool w) { myWranglePrim = w; }
463  void setWrangleVertex(bool w) { myWrangleVtx = w; }
464 
465 
466  void setCollectedLinks(bool user_links, bool auto_links,
467  bool boundary_links);
468 
469  void fillWrangleDetail(GA_Offset base_offset,
470  GA_Offset *src_vtx_rep,
471  GA_Offset *dst_vtx_rep,
472  const GA_Offset *supplied_src_vtx_rep,
473  const GA_Offset *supplied_dst_vtx_rep,
474  GA_PrimitiveWrangler *prim_wrangler,
475  GA_VertexWrangler *vtx_wrangler,
477  TextureMode uv_style = INTERPOLATE,
478  TextureScaling uv_scaling = FIT_UNIT_SQUARE);
479 
480 private:
481 
482  void computeBridge(GA_Offset ptoff0,
483  GA_Offset primoff0,
484  int divisions,
485  int src_divisions = 0,
486  int dst_divisions = 0,
487  int num_twists = 0,
488  IndexPairArray *pairings = nullptr,
489  const GU_Detail *tgdp = nullptr,
490  const GA_Offset *src_rep_vtx = nullptr,
491  const GA_Offset *dst_rep_vtx = nullptr,
492  GA_PointWrangler *pt_wrangler = nullptr,
493  GA_PrimitiveWrangler *prim_wrangler = nullptr,
494  GA_VertexWrangler *vtx_wrangler = nullptr);
495 
496  void generateLinks(UT_FprealArray &srcs,
497  int src_first, int src_last,
498  UT_FprealArray &dst_breakpoitns,
499  int dst_first, int dst_last,
500  IndexPairArray &links,
501  bool do_full_circle);
502 
503  fpreal unitize(UT_FprealArray &breakpoints,
504  int i, int first = 0, int last = -1) const;
505 
506  UT_Vector3 getLinkPointPosition(int i, fpreal t);
507 
508 
509  UT_Vector3 getLinkPointPositionLinear(int i, fpreal t);
510  GU_Spine *sampleSpine(int divisions);
511 
512  /// All of these methods return true if their results differ from the
513  /// cached previous ones.
514  bool setupEnds();
515  bool setupDirs();
516 
517  bool calcDefaultPairingRefs();
518  void calcPositionsInEndFrames();
519  void buildLinks(IndexPairArray *forced_pairs);
520 
521  /// Given a gramgement of a chain 'cycle', interpreted cyclically, with
522  /// two reference indices 'start_cycle_ref' and 'end_cycle_ref'
523  /// (respectively the indices at which the fragment starts and ends, and a
524  /// second chain 'path', interpreted linearly, with two references indices
525  /// 'path_prefix_end_ref' and 'path_suffix_begin_ref, with the former
526  /// always being less than or equal to the latter, return the index
527  /// 'idx' withing the cycle fragment which breaks it best in the sense that
528  /// the ratio between the lengths "from cycle_start_ref to idx" and
529  /// "from idx to cycle_end_ref" is as close as possible to
530  /// ratio between length of the prefix of the path that ends at index
531  /// path_prefix_end_ref and the suffix of the path that starts at
532  /// index path_suffix_begin_ref. Note that start_cycle_ref may be equal
533  /// to end_cycle_ref indicating that we want to divide the entire cycle.
534  /// It is also possible for the path_pref_end_ref and path_suffix_begin_ref
535  /// to be equal.
536 
537  int breakCycleRange(GA_OffsetArray &cycle,
538  int start_cycle_ref, int end_cycle_ref,
540  int path_prefix_end_ref,
541  int path_suffix_start_ref);
542 
543 
544  /// Given a set of pre-specified pairings between source and destination
545  /// chain points, we must *sort* them out before generating the lines
546  /// between consecutive pairs. When one or both links are closed (circular)
547  /// this sorting becomes non-trivial. We deal with this by using the first
548  /// pre-specified pair (s0, d0) of source and destination indices as a
549  /// references. If both chains are closed, then we use s0 and d0
550  /// respectively as the starting indices for the two circular lists. If
551  /// one of the chains is open, then we pick the starting index on the
552  /// closed chain so that all
553 
554  void findChainBaseIndices(IndexPairArray *forced_pairs,
555  int &src_base_idx,
556  int &dst_base_idx);
557 
558  void monotonizePairs(IndexPairArray &pairs,
559  IndexPairArray &dropped_pairs,
560  bool circular_first = false,
561  bool circular_second = false);
562 
563  UT_Vector3 calcLoopCentroid(const GA_OffsetArray &loop,
564  bool closed);
565  UT_Vector3 calcLoopNormalAndRadius(GA_OffsetArray &loop,
566  bool closed, UT_Vector3 center,
567  fpreal &radius, fpreal &length);
568 
569  int findLoopFarthestPoint(GA_OffsetArray &loop,
570  UT_Vector3 from_pos,
571  fpreal max_dist = -1.0,
572  UT_Vector3 halfspace_normal
573  = UT_Vector3(0.0, 0.0, 0.0),
574  fpreal topple_bump_factor = 0.01);
575 
576  GA_Offset appendPt(GA_Offset &baseoff,
577  GA_Offset ptoff = GA_INVALID_OFFSET);
578 
579  void addLinksToEdgeGroup(const IndexPairArray &pairs,
580  GA_EdgeGroup *grp);
581 
582  int findTwoAxisExtremePoint(const GA_OffsetArray &pts,
583  UT_Vector3 ctr, UT_Vector3 tie_breaker,
584  UT_Vector3 x_dir, UT_Vector3 y_dir,
585  fpreal tol);
586 
587  void calcTextureRange(UT_Array<GA_ROHandleV3> &uvs,
588  TextureMode uv_style, TextureScaling uv_scaling,
589  UT_FprealArray &ranges);
590 
591 
592  void setWrangleDetailTextureCoords(GA_Offset base_offset,
593  GA_OffsetArray &loop,
594  int ref_idx, fpreal u, fpreal v_min,
595  fpreal v_max, fpreal loop_len,
596  GA_RWHandleV3 &uvh);
597 
599  fpreal spineLength() const { return mySpineArcLength.last(); }
600  enum LinkType
601  {
602  LINK_TYPE_NORMAL = 0,
603  LINK_TYPE_USER,
604  LINK_TYPE_AUTO,
605  LINK_TYPE_BOUNDARY
606  };
607 
608  void dumpChains();
609  void dumpLinks(IndexPairArray *links,
610  int src_base_idx = 0,
611  int dst_base_idx = 0,
612  UT_Array<LinkType> *types = nullptr);
613 
614  class FirstThenSecond
615  {
616  public:
617  inline bool operator()(const IndexPair &a, const IndexPair &b) const
618  {
619  if (a.first == b.first)
620  return a.second < b.second;
621  else
622  return a.first < b.first;
623  }
624  };
625 
626 
627  class SecondThenFirst
628  {
629  public:
630  inline bool operator()(const IndexPair &a, const IndexPair &b) const
631  {
632  if (a.second == b.second)
633  return a.first < b.first;
634  else
635  return a.second < b.second;
636  }
637  };
638 
639  bool myEndsAreSetUp = false;
640  bool myDirsAreSetUp = false;
641  bool myHaveDefaultPairingRefs = false;
642  bool myReverseSpine = false;
643  bool myMiterJoints = true;
644 
645  bool mySrcDirGiven = false;
646  bool myDstDirGiven = false;
647  bool mySrcCtrGiven = false;
648  bool myDstCtrGiven = false;
649 
650  bool mySrcFrameUpDirGiven = false;
651  bool myDstFrameUpDirGiven = false;
652 
653  bool myDoGenerateSpine = false;
654  bool myDoGenerateMesh = true;
655 
656  bool myPairByEdgeCount = false;
657 
658  bool mySrcClosed = true;
659  bool myDstClosed = true;
660  bool myAttachToSrc = true;
661  bool myAttachToDst = true;
662 
663  bool myWranglePt = true;
664  bool myWrangleVtx = true;
665  bool myWranglePrim = true;
666 
667  bool myCollectUserLinks = false;
668  bool myCollectAutoLinks = false;
669  bool myCollectBoundaryLinks = false;
670 
671  bool mySpineIsStraight: 1;
672  bool myAllowCoincidentCentroids = false;
673  bool myScaleInvariant = true;
674 
675  int myPairingShift = 0;
676  int mySrcRef = -1;
677  int myDstRef = -1;
678 
679  GU_Spine *mySpine = nullptr;
680  GA_PrimitiveGroup *myMeshPrimGroup = nullptr;
681  GA_PointGroup *mySpinePointGroup = nullptr;
682 
683  GA_RWHandleV3 myTangentAttrib;
684  GA_RWHandleV3 myNormalAttrib;
685  GA_RWHandleV3 myBinormalAttrib;
686 
687  GA_OffsetArray mySrcLoop, myDstLoop;
688 
689  fpreal mySrcRadius = 0.0;
690  fpreal myDstRadius = 0.0;
691  fpreal mySrcMagnitude = 1.0;
692  fpreal myDstMagnitude = 1.0;
693  fpreal mySrcStiffness = 0.0;
694  fpreal myDstStiffness = 0.0;
695  fpreal myClipStart = 0.0;
696  fpreal myClipEnd = 1.0;
697  fpreal mySpineStart = 0.0;
698  fpreal mySpineEnd = 1.0;
699  fpreal mySrcLength = 0.0;
700  fpreal myDstLength = 0.0;
701  UT_FprealArray mySpineArcLength;
702 
703  UT_Vector3 mySrcDir = { 0.0, 0.0, 0.0 };
704  UT_Vector3 myDstDir = { 0.0, 0.0, 0.0 };
705  UT_Vector3 mySrcCtr = { 0.0, 0.0, 0.0 };
706  UT_Vector3 myDstCtr = { 0.0, 0.0, 0.0 };
707  UT_Vector3 mySrcLoopNormal = { 0.0, 0.0, 0.0 };
708  UT_Vector3 myDstLoopNormal = { 0.0, 0.0, 0.0 };
709  UT_Vector3 mySrcFrameUpDir = { 0.0, 0.0, 0.0 };
710  UT_Vector3 myDstFrameUpDir = { 0.0, 0.0, 0.0 };
711 
712  UT_Vector3Array mySrcLocalPos, myDstLocalPos;
713 
714  UT_IntArray myLinkSrcs, myLinkDsts;
715  UT_Array<LinkType> myLinkTypes;
716 
717  MorphMethod myMorphMethod = ROTATING_FRAME;
718 
719  UT_Ramp *myThicknessRamp = nullptr;
720  fpreal myThicknessUnit = 1.0;
721 
722  UT_Ramp *myTwistRamp = nullptr;
723  fpreal myMaxTwist = M_PI;
724  fpreal myMinTwist = -M_PI;
725 
726  const GEO_Face *myExternalSpine = nullptr;
727 
728  SpinePositioning mySpinePlacement = GU_Spine::SRC_TO_DST;
729  UT_Vector3 mySpineTranslate = { 0.0, 0.0, 0.0 };
730  UT_Quaternion myCurveToBridgeQ;
731  fpreal myAxialRotation = 0.0;
732  UT_Quaternion myAxialRotationQ;
733 
734  DirectionSign mySrcDirSign = DIR_SIGN_POS;
735  DirectionSign myDstDirSign = DIR_SIGN_POS;
736 
737  UT_StringStream *myWarningStream = nullptr;
738 
739  UT_Vector3Array mySpineP, mySpineT, mySpineN, myExpands;
740  UT_FprealArray mySpineU;
741 
742  UT_Vector3 myStartClipP, myStartClipT, myStartClipN;
743  UT_Vector3 myEndClipP, myEndClipT, myEndClipN;
744 
745  GU_Detail *myGdp;
746 
747  GA_RWHandleF mySpineThickness;
748  GA_RWHandleF mySpineTwist;
749 
750  fpreal myPreTwist = 0.0;
751  fpreal mySrcBlend = 0.0;
752  fpreal myDstBlend = 0.0;
753 
754  GA_EdgeGroup *mySrcEdgeGroup = nullptr;
755  GA_EdgeGroup *myDstEdgeGroup = nullptr;
756 
757  SpineSampleMethod mySpineSampleMethod = GU_Spine::PARAMETER_UNIFORM;
758 
759  int myNumQuads = 0;
760  int myNumNewPts = 0;
761 
762  GA_OffsetArray myLocalPtOffset;
763  GA_OffsetArray myQuadPtNums;
764  GEO_PolyCounts myQuadSizeList;
765 
766  GA_OffsetArray mySrcQuads, myDstQuads;
767  GA_OffsetArray mySpinePts;
768 
769  GA_OffsetArray myUserLinkEdges;
770  GA_OffsetArray myAutoLinkEdges;
771  GA_OffsetArray myBoundaryLinkEdges;
772 
773  GA_Offset myInputLastPrimOffset;
774 
775  int myDivs = -1;
776  int mySrcDivs = -1;
777  int myDstDivs = -1;
778 
779 };
780 
782  GU_PolyBridge **bridges,
783  int num_bridges,
784  const GA_Offset *src_rep_vtxs = nullptr,
785  const GA_Offset *dst_rep_vtxs = nullptr,
786  GA_PrimitiveGroup *mesh_prims = nullptr,
787  GA_OffsetArray *user_link_grp = nullptr,
788  GA_OffsetArray *auto_link_grp = nullptr,
789  GA_OffsetArray *boundary_link_grp = nullptr,
790  GA_OffsetArray *src_chain_grp = nullptr,
791  GA_OffsetArray *dst_chain_grp = nullptr,
792  int num_twists = 0,
793  bool wrangle_pt_attribs = true,
794  bool wrangle_prim_attribs = true,
795  bool wrangle_vtx_attribs = true,
800 
801 /// This is a very useful tool to find the Minimum Rotation Frame for a
802 /// movement from x0 to x1 along a curve with tangent and normal t0 and n0
803 /// at x0 and tangent t1 and x1. It is based on the double-reflection method
804 /// of Wang, Juttler, Zheng, and Liu described in a paper titled
805 /// "Computation of Rotation Minimizing Frames", from ACM Transactions on
806 /// Graphics 2008.
807 
809  UT_Vector3 n0, UT_Vector3 x1, UT_Vector3 t1);
810 
811 
812 #endif
GLint first
Definition: glcorearb.h:405
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
void setWrangleVertex(bool w)
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
void setAttachToSrc(bool attach)
#define M_PI
Definition: fmath.h:90
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
void reverse(I begin, I end)
Definition: pugixml.cpp:7190
GLdouble s
Definition: glad.h:3009
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
void setWranglePoint(bool w)
#define GA_INVALID_OFFSET
Definition: GA_Types.h:678
GLuint GLsizei const GLuint const GLintptr * offsets
Definition: glcorearb.h:2621
void setWarningStream(UT_StringStream *w)
GA_Size GA_Offset
Definition: GA_Types.h:641
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)
GU_API void GUbatchBuildBridges(GU_Detail *gdp, GU_PolyBridge **bridges, 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)
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)
void setWranglePrimitive(bool w)
GLsizeiptr size
Definition: glcorearb.h:664
SYS_API double tan(double x)
Definition: SYS_FPUMath.h:75
void setSpineSampleMethod(SpineSampleMethod m)
GA_AttributeOwner
Definition: GA_Types.h:34
void setSrcDirectionSign(DirectionSign t)
void setTwistAttrib(GA_Attribute *attrib)
void setDstEdgeGroup(GA_EdgeGroup *grp)
fpreal64 fpreal
Definition: SYS_Types.h:277
Utility class for containing a color ramp.
Definition: UT_Ramp.h:88
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)