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