HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 the 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  GU_Spine(GEO_Face *spine_curve = NULL,
79  bool reverse = false,
80  fpreal u0 = 0.0, fpreal u1 = 1.0,
81  bool straight = false);
82 
83  ~GU_Spine();
84 
85  void sample(int size, SampleMode sample_mode,
86  UT_Vector3Array &pos,
88  UT_Vector3Array &norm,
89  UT_FprealArray &uvals,
90  bool miter, UT_Vector3Array *expands);
91 
92  void position(UT_Vector3 src_pos, UT_Vector3 src_tan,
93  UT_Vector3 src_norm, UT_Vector3 dst_pos,
94  UT_Vector3 dst_tan, Positioning = SRC_TO_DST,
95  fpreal axial_rotation = 0.0);
96 
97  void setStiffness(fpreal src_stiff, fpreal dst_stiff);
98  void setBlend(fpreal src_blend, fpreal dst_blend);
99  void setClipRange(fpreal c0, fpreal c1);
100 
101  void getClip0(UT_Vector3 &p, UT_Vector3 &t, UT_Vector3 &n);
102  void getClip1(UT_Vector3 &p, UT_Vector3 &t, UT_Vector3 &n);
103 
104  /// Evaluate the spine curve at parameter value u. The second parameter
105  /// du can only be 0 or 1 to evaluate the point position or the tangent
106  /// vector.
107 
108  UT_Vector3 evalSpine(fpreal u, int du);
109 
110  fpreal evalExternalAttribF(GA_ROHandleF ah, fpreal u,
112  UT_FloatArray &weights,
113  GA_AttributeOwner owner);
114 
115 private:
116  void setup();
117  void sampleParameter(SampleMode sample_mode,
118  UT_FprealArray &sample_u);
119 
120  UT_Vector3 evalBaseCurve(fpreal u, int du);
121  UT_Vector3 evalSrcCurve(fpreal u, int du);
122  UT_Vector3 evalDstCurve(fpreal u, int du);
123  UT_Vector3 evalPolyLineCurve(fpreal u, int du);
124  void getPolyLineWeights(fpreal u, int &i0, int &i1,
125  fpreal &w0, fpreal &w1);
126 
127 
128  void setupPolyLineSpineCurve();
129 
130  inline fpreal unitToRealDomain(fpreal u_unit);
131 
132  inline UT_Vector3 evalExternalCurve(fpreal u, int du = 0);
133 
134  UT_Vector3 positionCurvePoint(UT_Vector3 x);
135 
136  inline int getNumCVs()
137  {
138  return mySpineCurve ?
139  mySpineCurve->getFastVertexCount() :
140  myNumCVs;
141  }
142 
143  inline UT_Vector3 getCV(int i)
144  {
145  return (mySpineCurve) ?
146  positionCurvePoint(
147  mySpineCurve->getDetail().getPos3(
148  mySpineCurve->getPointOffset(i))) :
149  myCVs[i];
150  }
151 
152  fpreal myClipU0, myClipU1;
153  fpreal myU0, myU1;
154 
155  UT_Vector3 myClipP0, myClipT0, myClipN0;
156  UT_Vector3 myClipP1, myClipT1, myClipN1;
157 
158  UT_Vector3 mySrcP, mySrcT, mySrcN, myDstP, myDstT;
159 
160  fpreal mySrcStiffness, myDstStiffness;
161  fpreal mySrcBlend, myDstBlend;
162 
163  Positioning myPositioninig;
164  fpreal myAxialRotation;
165 
166  bool myIsPolyLine: 1;
167  bool myReverseSpine: 1;
168  bool myStraight: 1;
169  bool myTrivial: 1;
170  bool myInternalSpine: 1;
171 
172  GEO_Face *mySpineCurve;
173 
174  fpreal myPolyLineLength;
175  UT_FprealArray myPolyLineBreakpoints;
176 
177  int myNumCVs;
178  UT_Vector3 myCVs[6];
179 
180  fpreal myScale;
181  UT_Vector3 myOrigin;
182  UT_Vector3 myTranslate;
183  UT_Quaternion myCurveToBridgeQ;
184  UT_Quaternion myAxialRotationQ;
185 
186 
187 };
188 
189 fpreal
190 GU_Spine::unitToRealDomain(fpreal u_unit)
191 {
192  if (u_unit < 0.0f)
193  u_unit = 0.0f;
194  else if (u_unit > 1.0f)
195  u_unit = 1.0f;
196 
197  return u_unit * fpreal(myNumCVs - 3);
198 }
199 
200 /// GU_PolyBridge encapsulates most of the functionality of the polybridge sop.
201 /// It can generate a bridge between a source and a destination edge loop each
202 /// of which can be open or closed.
203 
204 
206 {
207 public:
208 
210  {
211  INTERPOLATE = -1,
214  PROPORTIONAL
215  };
216 
218  {
219  FIT_UNIT_SQUARE = 0,
221  MATCH_UV
222  };
223 
225  const GA_OffsetArray &src_chain,
226  bool src_chain_closed,
227  const GA_OffsetArray &dst_chain,
228  bool dst_chain_closed,
229  bool straight_bridge = true);
230 
231  ~GU_PolyBridge();
232 
233  typedef std::pair<int, int> IndexPair;
235 
236  inline void buildTopology(int divisions,
237  int src_divisions = 0,
238  int dst_divisions = 0,
239  IndexPairArray *pairings = nullptr)
240  {
241  computeBridge(GA_INVALID_OFFSET, GA_INVALID_OFFSET, divisions,
242  src_divisions, dst_divisions, 0, pairings);
243  }
244 
245  inline void writeGeometry(GA_Offset ptoff0,
246  GA_Offset primoff0,
247  int num_twists = 0,
248  const GU_Detail *tgdp = nullptr,
249  const GA_Offset *src_rep_vtx = nullptr,
250  const GA_Offset *dst_rep_vtx = nullptr,
251  GA_PointWrangler *pt_wrangler = nullptr,
252  GA_PrimitiveWrangler *prim_wrangler = nullptr,
253  GA_VertexWrangler *vtx_wrangler = nullptr)
254  {
255  computeBridge(ptoff0, primoff0, -1, -1, -1, num_twists, nullptr, tgdp,
256  src_rep_vtx, dst_rep_vtx, pt_wrangler, prim_wrangler,
257  vtx_wrangler);
258  }
259 
260 
261  void buildBridge(const GA_Offset *src_rep_vtx,
262  const GA_Offset *dst_rep_vtx,
263  GA_OffsetArray *user_link_grp = 0,
264  GA_OffsetArray *auto_link_grp = 0,
265  GA_OffsetArray *boundary_link_grp = 0,
266  GA_OffsetArray *src_chain_grp = 0,
267  GA_OffsetArray *dst_chain_grp = 0,
268  int num_twists = 0);
269 
270 
271  int getNumMeshPolys();
272  int getNumMeshPolyVtxs();
273 
274  GA_Offset setupBatchBuild(GA_Offset ptoff0,
275  UT_IntArray &quad_pt_nums,
276  GEO_PolyCounts &quad_size_list);
277 
278  void fillGroups(GA_Offset ptoff0,
279  GA_Offset primoff0,
280  GA_OffsetArray *user_link_grp,
281  GA_OffsetArray *auto_link_grp,
282  GA_OffsetArray *boundary_link_grp,
283  GA_OffsetArray *src_chain_grp,
284  GA_OffsetArray *dst_chain_grp);
286  {
287  DIR_SIGN_AUTO = 0,
289  DIR_SIGN_NEG
290  };
291 
293  {
294  LINEAR = 0,
296  };
297 
300 
302  { setupEnds(); return mySrcCtr; }
303 
305  { setupEnds(); return myDstCtr; }
306 
308  { myWarningStream = w; }
309 
311  { mySpineThickness = attrib; }
312 
314  { mySpineTwist = attrib; }
315 
317  { myMorphMethod = m; }
318 
319  void setMagnitudes(fpreal s = 1.0, fpreal d = 1.0)
320  { mySrcMagnitude = s; myDstMagnitude = d; }
321 
322  void setStiffnesses(fpreal s = 0.0, fpreal d = 0.0)
323  { mySrcStiffness = s; myDstStiffness = d; }
324 
326  { myAxialRotation = r; }
327 
329  { myExternalSpine = curve; }
330 
332  { myThicknessRamp = ramp; }
333 
334  void setTwistRamp(UT_Ramp *ramp)
335  { myTwistRamp = ramp; }
336 
338  { mySrcDir = dir; mySrcDirGiven = true; }
339 
341  { myDstDir = dir; myDstDirGiven = true; }
342 
344  { mySrcCtr = ctr; mySrcCtrGiven = true; }
345 
347  { myDstCtr = ctr; myDstCtrGiven = true; }
348 
349  void setAttachToSrc(bool attach)
350  { myAttachToSrc = attach; }
351 
352  void setAttachToDst(bool attach)
353  { myAttachToDst = attach; }
354 
356  { myThicknessUnit = s; }
357 
359  { myMinTwist = min; myMaxTwist = max; }
360 
361  void setReverseSpine(bool r)
362  { myReverseSpine = r; }
363 
365  { mySrcDirSign = t; }
366 
368  { myDstDirSign = t; }
369 
371  { myClipStart = s; myClipEnd = e; }
372 
373  void setGenerateSpine(bool b)
374  { myDoGenerateSpine = b; }
375 
377  { mySpinePointGroup = grp; }
378 
379  void setGenerateMesh(bool b)
380  { myDoGenerateMesh = b; }
381 
383  { myMeshPrimGroup = grp; }
384 
386  { myTangentAttrib = attrib; }
387 
389  { myNormalAttrib = attrib; }
390 
392  { myBinormalAttrib = attrib; }
393 
394  void pairByEdgeCount(bool b)
395  { myPairByEdgeCount = b; }
396 
397  void setPairingShift(int s)
398  { myPairingShift = s; }
399 
401  { mySpineStart = s; mySpineEnd = e; }
402 
403  void setExtSpineBlend(fpreal s = 0.0, fpreal d = 0.0)
404  { mySrcBlend = s; myDstBlend = d; }
405 
407  { mySpinePlacement = p; }
408 
410  { mySpineSampleMethod = m; }
411 
412  void setMiterJoints(bool b)
413  { myMiterJoints = b; }
414 
415  void setScaleInvariant(bool b)
416  { myScaleInvariant = b; }
417 
419  { myPreTwist = t; }
420 
422  { mySrcEdgeGroup = grp; }
423 
425  { myDstEdgeGroup = grp; }
426 
427  void setChainRefs(int src_ref, int dst_ref)
428  { mySrcRef = src_ref; myDstRef = dst_ref; }
429 
431  { mySrcFrameUpDir = dir;
432  mySrcFrameUpDirGiven = true; }
433 
435  { myDstFrameUpDir = dir;
436  myDstFrameUpDirGiven = true; }
437 
438  int getNumSrcLoopPts() const
439  { return mySrcLoop.entries(); }
440 
441  int getNumDstLoopPts() const
442  { return myDstLoop.entries(); }
443 
444  void setWranglePoint(bool w) { myWranglePt = w; }
445  void setWranglePrimitive(bool w) { myWranglePrim = w; }
446  void setWrangleVertex(bool w) { myWrangleVtx = w; }
447 
448 
449  void setCollectedLinks(bool user_links, bool auto_links,
450  bool boundary_links);
451 
452  void fillWrangleDetail(GA_Offset base_offset,
453  GA_Offset *src_vtx_rep,
454  GA_Offset *dst_vtx_rep,
455  const GA_Offset *supplied_src_vtx_rep,
456  const GA_Offset *supplied_dst_vtx_rep,
457  GA_PrimitiveWrangler *prim_wrangler,
458  GA_VertexWrangler *vtx_wrangler,
460  TextureMode uv_style = INTERPOLATE,
461  TextureScaling uv_scaling = FIT_UNIT_SQUARE);
462 
463 private:
464 
465  void computeBridge(GA_Offset ptoff0,
466  GA_Offset primoff0,
467  int divisions,
468  int src_divisions = 0,
469  int dst_divisions = 0,
470  int num_twists = 0,
471  IndexPairArray *pairings = nullptr,
472  const GU_Detail *tgdp = nullptr,
473  const GA_Offset *src_rep_vtx = nullptr,
474  const GA_Offset *dst_rep_vtx = nullptr,
475  GA_PointWrangler *pt_wrangler = nullptr,
476  GA_PrimitiveWrangler *prim_wrangler = nullptr,
477  GA_VertexWrangler *vtx_wrangler = nullptr);
478 
479  void generateLinks(UT_FprealArray &srcs,
480  int src_first, int src_last,
481  UT_FprealArray &dst_breakpoitns,
482  int dst_first, int dst_last,
483  IndexPairArray &links,
484  bool do_full_circle);
485 
486  fpreal unitize(UT_FprealArray &breakpoints,
487  int i, int first = 0, int last = -1) const;
488 
489  UT_Vector3 evaluateExternalSpine(fpreal t, int du = 0);
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(GA_OffsetArray &loop, bool closed);
549  UT_Vector3 calcLoopNormalAndRadius(GA_OffsetArray &loop,
550  bool closed, UT_Vector3 center,
551  fpreal &radius, fpreal &length);
552 
553  int findLoopFarthestPoint(GA_OffsetArray &loop,
554  UT_Vector3 from_pos,
555  fpreal max_dist = -1.0,
556  UT_Vector3 halfspace_normal
557  = UT_Vector3(0.0, 0.0, 0.0),
558  fpreal topple_bump_factor = 0.01);
559 
560  GA_Offset appendPt(GA_Offset &baseoff,
561  GA_Offset ptoff = GA_INVALID_OFFSET);
562 
563  void addLinksToEdgeGroup(const IndexPairArray &pairs,
564  GA_EdgeGroup *grp);
565 
566  int findTwoAxisExtremePoint(const GA_OffsetArray &pts,
567  UT_Vector3 ctr, UT_Vector3 tie_breaker,
568  UT_Vector3 x_dir, UT_Vector3 y_dir,
569  fpreal tol);
570 
571  GU_Detail *buildWrangleDetail(GA_OffsetArray &src_vtx_rep,
572  GA_OffsetArray &dst_vtx_rep,
573  const GA_Offset *supplied_src_vtx_rep = nullptr,
574  const GA_Offset *supplied_dst_vtx_rep = nullptr);
575 
576  void calcTextureRange(UT_Array<GA_ROHandleV3> &uvs,
577  TextureMode uv_style, TextureScaling uv_scaling,
578  UT_FprealArray &ranges);
579 
580 
581  void setWrangleDetailTextureCoords(GA_Offset base_offset,
582  GA_OffsetArray &loop, bool loop_closed,
583  int ref_idx, fpreal u, fpreal v_min,
584  fpreal v_max, fpreal loop_len,
585  GA_RWHandleV3 &uvh);
586 
588  fpreal spineLength() const { return mySpineArcLength.last(); }
589  enum LinkType
590  {
591  LINK_TYPE_NORMAL = 0,
592  LINK_TYPE_USER,
593  LINK_TYPE_AUTO,
594  LINK_TYPE_BOUNDARY
595  };
596 
597  void dumpChains();
598  void dumpLinks(IndexPairArray *links,
599  int src_base_idx = 0,
600  int dst_base_idx = 0,
601  UT_Array<LinkType> *types = NULL);
602 
603  class FirstThenSecond
604  {
605  public:
606  inline bool operator()(const IndexPair &a, const IndexPair &b) const
607  {
608  if (a.first == b.first)
609  return a.second < b.second;
610  else
611  return a.first < b.first;
612  }
613  };
614 
615 
616  class SecondThenFirst
617  {
618  public:
619  inline bool operator()(const IndexPair &a, const IndexPair &b) const
620  {
621  if (a.second == b.second)
622  return a.first < b.first;
623  else
624  return a.second < b.second;
625  }
626  };
627 
628  bool myEndsAreSetUp: 1;
629  bool myDirsAreSetUp: 1;
630  bool myExternalSpineIsSetUp: 1;
631  bool myInternalSpineIsSetUp: 1;
632  bool myHaveDefaultPairingRefs: 1;
633  bool myReverseSpine: 1;
634  bool myMiterJoints: 1;
635 
636  bool mySrcDirGiven: 1;
637  bool myDstDirGiven: 1;
638  bool mySrcCtrGiven: 1;
639  bool myDstCtrGiven: 1;
640 
641  bool mySrcFrameUpDirGiven: 1;
642  bool myDstFrameUpDirGiven: 1;
643 
644  bool myDoGenerateSpine: 1;
645  bool myDoGenerateMesh: 1;
646 
647  bool myPairByEdgeCount: 1;
648 
649  bool mySrcClosed: 1;
650  bool myDstClosed: 1;
651  bool myAttachToSrc: 1;
652  bool myAttachToDst: 1;
653 
654  bool myWranglePt: 1;
655  bool myWrangleVtx: 1;
656  bool myWranglePrim: 1;
657 
658  bool myCollectUserLinks: 1;
659  bool myCollectAutoLinks: 1;
660  bool myCollectBoundaryLinks: 1;
661 
662  bool mySpineIsStraight: 1;
663  bool myScaleInvariant: 1;
664 
665  int myPairingShift;
666  int mySrcRef, myDstRef;
667 
668  GU_Spine *mySpine;
669 
670  GA_PrimitiveGroup *myMeshPrimGroup;
671  GA_PointGroup *mySpinePointGroup;
672 
673  GA_RWHandleV3 myTangentAttrib;
674  GA_RWHandleV3 myNormalAttrib;
675  GA_RWHandleV3 myBinormalAttrib;
676 
677  GA_OffsetArray mySrcLoop, myDstLoop;
678 
679  fpreal mySrcRadius, myDstRadius;
680  fpreal mySrcMagnitude, myDstMagnitude;
681  fpreal mySrcStiffness, myDstStiffness;
682  fpreal myClipStart, myClipEnd;
683  fpreal mySpineStart, mySpineEnd;
684  fpreal mySrcLength = 0, myDstLength = 0;
685  UT_FprealArray mySpineArcLength;
686 
687  UT_Vector3 mySrcDir, myDstDir;
688  UT_Vector3 mySrcCtr, myDstCtr;
689  UT_Vector3 mySrcLoopNormal, myDstLoopNormal;
690  UT_Vector3 mySrcFrameUpDir, myDstFrameUpDir;
691 
692  UT_Vector3Array mySrcLocalPos, myDstLocalPos;
693 
694  UT_IntArray myLinkSrcs, myLinkDsts;
695  UT_Array<LinkType> myLinkTypes;
696 
697  MorphMethod myMorphMethod;
698 
699  UT_Ramp *myThicknessRamp;
700  fpreal myThicknessUnit;
701 
702  UT_Ramp *myTwistRamp;
703  fpreal myMaxTwist;
704  fpreal myMinTwist;
705 
706  GEO_Face *myExternalSpine;
707 
708  SpinePositioning mySpinePlacement;
709  UT_Vector3 myCurveOrigin;
710  UT_Vector3 mySpineTranslate;
711  fpreal myCurveToBridgeScale;
712  UT_Quaternion myCurveToBridgeQ;
713  fpreal myAxialRotation;
714  UT_Quaternion myAxialRotationQ;
715 
716  DirectionSign mySrcDirSign, myDstDirSign;
717 
718  UT_StringStream *myWarningStream;
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;
732  fpreal myLastExternalSpinePos;
733  fpreal mySrcBlend, myDstBlend;
734 
735  GA_EdgeGroup *mySrcEdgeGroup, *myDstEdgeGroup;
736 
737  SpineSampleMethod mySpineSampleMethod;
738 
739  int myNumQuads;
740  int myNumNewPts;
741 
742  GA_OffsetArray myLocalPtOffset;
743  UT_IntArray myQuadPtNums;
744  GEO_PolyCounts myQuadSizeList;
745 
746  GA_OffsetArray mySrcQuads, myDstQuads;
747  GA_OffsetArray mySpinePts;
748 
749  GA_OffsetArray myUserLinkEdges;
750  GA_OffsetArray myAutoLinkEdges;
751  GA_OffsetArray myBoundaryLinkEdges;
752 
753  GA_Offset myInputLastPrimOffset;
754 
755  int myDivs, mySrcDivs, myDstDivs;
756 
757 };
758 
760  GU_PolyBridge **bridges,
761  int num_bridges,
762  const GA_Offset *src_rep_vtxs = nullptr,
763  const GA_Offset *dst_rep_vtxs = nullptr,
764  GA_PrimitiveGroup *mesh_prims = nullptr,
765  GA_OffsetArray *user_link_grp = nullptr,
766  GA_OffsetArray *auto_link_grp = nullptr,
767  GA_OffsetArray *boundary_link_grp = nullptr,
768  GA_OffsetArray *src_chain_grp = nullptr,
769  GA_OffsetArray *dst_chain_grp = nullptr,
770  int num_twists = 0,
771  bool wrangle_pt_attribs = true,
772  bool wrangle_prim_attribs = true,
773  bool wrangle_vtx_attribs = true,
778 
779 /// This is a very useful tool to find the Minimum Rotation Frame for a
780 /// movement from x0 to x1 along a curve with tangent and normal t0 and n0
781 /// at x0 and tangent t1 and x1. It is based on the double-reflection method
782 /// of Wang, Juttler, Zheng, and Liu described in a paper titled
783 /// "Computation of Rotation Minimizing Frames", from ACM Transactions on
784 /// Graphics 2008.
785 
787  UT_Vector3 n0, UT_Vector3 x1, UT_Vector3 t1);
788 
789 
790 #endif
GLint first
Definition: glcorearb.h:404
void setWrangleVertex(bool w)
Definition of a geometry attribute.
Definition: GA_Attribute.h:189
void setDstCtr(UT_Vector3 ctr)
void setExternalSpine(GEO_Face *curve)
void setExtSpinePositioning(SpinePositioning p)
UT_Array< IndexPair > IndexPairArray
void setAttachToSrc(bool attach)
const hboost::disable_if_c< VecTraits< T >::IsVec, T >::type & min(const T &a, const T &b)
Definition: Composite.h:128
void setSrcCtr(UT_Vector3 ctr)
UT_Vector3T< float > UT_Vector3
GLsizei const GLchar *const * path
Definition: glcorearb.h:3340
UT_Vector3 getSrcCentroid()
void setThicknessRamp(UT_Ramp *ramp)
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1221
void setAttachToDst(bool attach)
void setAxialRotation(fpreal r)
void setTangentAttrib(GA_Attribute *attrib)
void setGenerateSpine(bool b)
void setTwistRamp(UT_Ramp *ramp)
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)
3D Vector class.
void setNormalAttrib(GA_Attribute *attrib)
void setThicknessScale(fpreal s)
png_uint_32 i
Definition: png.h:2877
GLsizeiptr size
Definition: glcorearb.h:663
void setWranglePoint(bool w)
#define GA_INVALID_OFFSET
Definition: GA_Types.h:654
GLuint GLsizei const GLuint const GLintptr * offsets
Definition: glcorearb.h:2620
const hboost::disable_if_c< VecTraits< T >::IsVec, T >::type & max(const T &a, const T &b)
Definition: Composite.h:132
void setWarningStream(UT_StringStream *w)
GA_Size GA_Offset
Definition: GA_Types.h:617
void setMiterJoints(bool b)
GLdouble n
Definition: glcorearb.h:2007
GLfloat f
Definition: glcorearb.h:1925
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.
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.
void setSrcDir(UT_Vector3 dir)
void setExtSpineBlend(fpreal s=0.0, fpreal d=0.0)
#define GU_API
Definition: GU_API.h:11
void setSrcEdgeGroup(GA_EdgeGroup *grp)
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1221
void setScaleInvariant(bool b)
void setSrcFrameUpDir(UT_Vector3 dir)
void setBinormalAttrib(GA_Attribute *attrib)
void setDstDirectionSign(DirectionSign t)
void setExtSpineRange(fpreal s, fpreal e)
void setWranglePrimitive(bool w)
SYS_API double tan(double x)
void setSpineSampleMethod(SpineSampleMethod m)
GA_AttributeOwner
Definition: GA_Types.h:33
double fpreal
Definition: SYS_Types.h:269
void setSrcDirectionSign(DirectionSign t)
void setTwistAttrib(GA_Attribute *attrib)
void setDstEdgeGroup(GA_EdgeGroup *grp)
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
void pairByEdgeCount(bool b)
GU_Spine::SampleMode SpineSampleMethod
int getNumSrcLoopPts() const
GLint GLenum GLint x
Definition: glcorearb.h:408
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:856
void setGenerateMesh(bool b)
void setThicknessAttrib(GA_Attribute *attrib)
void setMorphMethod(MorphMethod m)
GLsizei GLenum GLenum * types
Definition: glcorearb.h:2541
GLboolean r
Definition: glcorearb.h:1221
void setDstFrameUpDir(UT_Vector3 dir)
GU_Spine::Positioning SpinePositioning
void setDstDir(UT_Vector3 dir)
void setMagnitudes(fpreal s=1.0, fpreal d=1.0)
std::pair< int, int > IndexPair
GLuint GLsizei GLsizei * length
Definition: glcorearb.h:794
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)