HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GU_PolyBevel.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_PolyBevel.h (GU Library, C++)
7  *
8  * COMMENTS:
9  *
10  */
11 
12 
13 #ifndef __GU_PolyBevel_h__
14 #define __GU_PolyBevel_h__
15 
16 #include "GU_API.h"
17 #include "GU_Detail.h"
18 #include <GEO/GEO_Hedge.h>
19 #include <GA/GA_Handle.h>
20 #include <GA/GA_Types.h>
21 #include <UT/UT_Array.h>
22 #include <UT/UT_BitArray.h>
23 #include <UT/UT_Vector3.h>
24 #include <UT/UT_VectorTypes.h>
25 #include <UT/UT_StringStream.h>
26 #include <SYS/SYS_Inline.h>
27 
28 #include <math.h>
29 
30 class Profile;
31 class GU_Decompose;
32 class GU_Insetter;
33 class GU_PolyBevelParms;
34 
36 class GEO_Face;
37 class GEO_PolyCounts;
38 class GEO_PrimPoly;
39 
40 class GA_Attribute;
41 class GA_EdgeGroup;
42 class GA_PointGroup;
43 class GA_PointWrangler;
44 class GA_PrimitiveGroup;
46 class GA_VertexWrangler;
47 
48 #define EXPLICIT_ELEMENT_INDEX 1
49 
50 
52 {
53 public:
55  {
56  NONE = 0,
61  PROFILE
62  };
63 
65  {
66  FIXED_DISTANCE = 0,
68  RELATIVE_DISTANCE
69  };
70 
72  {
73  UNIFORM = 0,
75  CONTROL_POINTS
76  };
77 
79  const GU_Detail *rest_gdp = nullptr,
80  const GEO_DetachedHedgeInterface *h = nullptr);
81 
82  ~GU_PolyBevel();
83 
84  void bevelEdges(fpreal offset,
85  const GA_EdgeGroup *edges,
86  OffsetMode mode,
87  FilletShape shape,
88  int divs,
89  const GU_PolyBevelParms *parms);
90 
91  void bevelPoints(fpreal offset,
92  const GA_PointGroup *points,
93  FilletShape shape,
94  int divs,
95  const GU_PolyBevelParms *parms);
96 
97  void saveMeshBoundaryEdgesToDetailArray(const char *name);
98  void saveBevelPointsToDetailArray(const char *name);
99  void saveMeshInteriorEdgesToDetailArray(const char *name);
100  void saveLimitPtCoordsToDetailArray(const char *attrib_name);
101 
102  const
103  UT_Fpreal32Array &getLimitPtCoords() { return myLimitPtCoords; }
104 
106  { return myWarnings.str().toStdString(); }
107 
108  struct PatchSet;
109  struct UVPatchSet;
110  class Positioner;
111 
112 #if EXPLICIT_ELEMENT_INDEX
114  {
115  explicit ElementIndex() {}
116  explicit ElementIndex(int index) : myIndex(index) {}
117 
118  explicit
119  operator int() const { return myIndex; }
120 
121  bool operator==(const ElementIndex &other) const
122  { return myIndex == other.myIndex; }
123 
124  bool operator!=(const ElementIndex &other) const
125  { return myIndex != other.myIndex; }
126 
127  private:
128  int myIndex;
129  };
130 
131  struct Patch : public ElementIndex
132  {
133  using ElementIndex::ElementIndex;
134  };
135 
136  struct Mesh: public ElementIndex
137  {
138  using ElementIndex::ElementIndex;
139  };
140 
141 #else
142 
143  typedef int ElementIndex;
144  typedef ElementIndex Patch;
145  typedef ElementIndex Mesh;
146 #endif
147 
148 private:
149 
150  struct SplitRecord;
151  struct SplitDraft;
152  struct FanEdge;
153  struct VertexFan;
154  struct VertexFanHandle;
155  struct VertexFanChain;
156  struct SliceInfo;
157  struct EdgeOffset;
158 
159  void bevel(fpreal offset, FilletShape shape, int divs);
160 
161  void buildRimTopology(FilletShape shape);
162 
163  void buildFilletTopology(FilletShape shape,
164  int divisions,
165  GA_PrimitiveGroup *edge_prims,
166  GA_PrimitiveGroup *corner_prims);
167 
168  void registerRimHedge(GA_Offset vtx, UT_Vector3 vel,
169  uint flags);
170 
171  UT_Vector3 offsetVector(const EdgeOffset &o0,
172  const EdgeOffset &o1);
173 
174  UT_Vector3 divergentOffsetVector(const EdgeOffset &o0,
175  const EdgeOffset &o1);
176 
177  bool canOffsetAlongFold(const EdgeOffset &e0,
178  const EdgeOffset &e1,
179  const VertexFanHandle &fan,
180  UT_Vector3 &v);
181 
182  fpreal offsetRatio(const EdgeOffset &e0,
183  const EdgeOffset &e1,
184  const VertexFanHandle &fan,
185  UT_Vector3 &v);
186 
187  void draftPointBevelRimVertexSplits(SplitDraft &draft,
188  FilletShape shape);
189 
190  void draftEdgeBevelRimVertexSplits(SplitDraft &draft,
191  GU_Decompose &euler_paths);
192 
193  void splitPointBevelRimVertices(const SplitDraft &draft);
194  void splitEdgeBevelRimVertices(const SplitDraft &draft,
195  GU_Decompose &euler_paths);
196 
197 
198 
199  void deleteRedundantHubs();
200 
201 #if 0
202  void assignRimHedgeMates();
203 #endif
204 
205  void offsetFilletBoundary(fpreal inset_amount);
206 
207  void rebuildHedgeInterface(GA_PrimitiveGroup *prims = 0);
208 
209 
210  enum EdgeError
211  {
212  EDGE_ERROR_NONE = 0,
213  EDGE_ERROR_DEGENERATE,
214  EDGE_ERROR_BOUNDARY,
215  EDGE_ERROR_NONMANIFOLD,
216  EDGE_ERROR_BADMANIFOLD,
217  EDGE_ERROR_TOO_SHORT,
218  EDGE_ERROR_TOO_SHARP,
219  EDGE_ERROR_NONMANIFOLD_ENDPOINT
220  };
221 
223  void addHedgeToBevelHedges(GEO_Hedge h,
224  bool ignore_flat = false,
225  fpreal flat_cos = 0.9999,
226  bool doing_all = false);
227 
229  EdgeError verifyHedgeForBevelling(GEO_Hedge h,
230  bool ignore_flat = false,
231  fpreal flat_cos = 0.9999);
232 
234  void addPointToBevelPoints(GA_Offset pt);
235 
236 
237 #if 0
238  // We'll be making a mesh of patches, arcs, and peaks.
239  GEO_Hedge mate(GEO_Hedge h);
240 #endif
241 
242  SYS_FORCE_INLINE int numRimComponents() const
243  {
244  return myRimCompStarts.entries() - 1;
245  }
246 
247  SYS_FORCE_INLINE int rimCompSize(int k) const
248  {
249  return myRimCompStarts(k + 1) - myRimCompStarts(k);
250  }
251 
252  // Index of the i-th edge in the k-th rim component
253  SYS_FORCE_INLINE int rimCompHedgeIndex(int k, int i) const
254  {
255  return myRimCompStarts(k) + i;
256  }
257 
258  SYS_FORCE_INLINE int mateIndex(int i) const
259  {
260  return myRimHedgeMate(i);
261  }
262 
263  SYS_FORCE_INLINE int rimCompHedgeMateIndex(int k, int i) const
264  {
265  return mateIndex(rimCompHedgeIndex(k, i));
266  }
267 
268  // The i-th edge in the k-th rim component
270  GEO_Hedge rimCompHedge(int k, int i) const
271  {
272  return myRimHedges(rimCompHedgeIndex(k, i));
273  }
274 
275  // The i-th edge in the k-th rim component
277  GEO_Hedge rimCompHedgeMate(int k, int i) const
278  {
279  return myRimHedges(rimCompHedgeMateIndex(k, i));
280  }
281 
282  SYS_FORCE_INLINE int numRimHedges() const
283  {
284  return myRimHedges.entries();
285  }
286 
288  GEO_Hedge rimHedge(int i) const
289  {
290  return myRimHedges(i);
291  }
292 
294  UT_Vector3 rimHedgeSrcVel(int i) const
295  {
296  return myRimHedgeSrcVel(i);
297  }
298 
300  uint32 rimHedgeFlags(int i, uint32 mask = ~(uint32(0))) const
301  {
302  return (mask & myRimHedgeFlags(i));
303  }
304 
306  Patch rimHedgePatch(int i) const
307  {
308  return myRimHedgePatch(i);
309  }
310 
312  Patch rimCompHedgePatch(int k, int j) const
313  {
314  return myRimHedgePatch(rimCompHedgeIndex(k, j));
315  }
316 
318  Patch rimCompHedgeMatePatch(int k, int j) const
319  {
320  return myRimHedgePatch(rimCompHedgeMateIndex(k, j));
321  }
322 
323  UT_Vector3 rotateHedge(GEO_Hedge h_ref, fpreal angle,
324  fpreal base_angle, fpreal weight = 1.0) const;
325 
326 
327 
328  void dumpHedge(GEO_Hedge h) const;
329  void dumpRimComponents();
330  void dumpPatches();
331 
332  bool hasTargetedTangent(int side, Patch pach);
333  bool needsMesh(int side, FilletShape shape, Patch ptch);
334 
335  int calcSlices(VertexFanHandle fan,
336  int span_start, int span_end,
337  int num_slices,
338  fpreal start_angle, fpreal slice_angle,
339  fpreal wt,
340  SliceInfo *sinfo);
341 
342  int calcSplitLocations(VertexFanHandle fan,
343  int span_start, int span_end,
344  int num_slices,
345  fpreal start_angle, fpreal slice_angle,
346  fpreal wt,
347  SliceInfo *sinfo);
348 
349  bool isBisectable(VertexFanHandle fan) const;
350 
351  bool sliceFlatFanSpan(VertexFanHandle fan,
352  SplitDraft &draft,
353  int span_start, int span_end,
354  fpreal outer_slice_angle,
355  fpreal inner_slice_angle,
356  fpreal wt);
357 
358  void sliceClosedFanSpan(VertexFanHandle fan,
359  SplitDraft &draft,
360  int span_start, int span_end,
361  fpreal outer_slice_angle,
362  fpreal inner_slice_angle,
363  fpreal wt);
364 
365  void closedFanSplit(VertexFanHandle fan,
366  SplitDraft &draft,
367  bool on_open_poly);
368 
369  void fullCircleSplit(VertexFanHandle fan,
370  SplitDraft &draft);
371 
372  void unisplit(const EdgeOffset &e0, const EdgeOffset &e1,
373  VertexFanHandle fan, SplitDraft &draft,
374  UT_Vector3 vel, fpreal os0, fpreal os1);
375 
376  bool isFanBisector(const EdgeOffset &e0,
377  const EdgeOffset &e1, const UT_Vector3 &vf,
378  fpreal &a0, fpreal &a1);
379 
380  int mirrorFoldVector(const EdgeOffset &e0,
381  const EdgeOffset &e1,
382  const UT_Vector3 &vf, UT_Vector3 &vm);
383 
384  void bisplitFold(const EdgeOffset &e0, const EdgeOffset &e1,
385  VertexFanHandle fan, SplitDraft &draft,
386  fpreal os0, fpreal os1);
387 
388  void bisplitFlat(const EdgeOffset &e0, const EdgeOffset &e1,
389  VertexFanHandle fan, SplitDraft &draft,
390  fpreal os0, fpreal os1);
391 
392 
393  void multisplit(const EdgeOffset &e0, const EdgeOffset &e1,
394  VertexFanHandle fan, SplitDraft &draft,
395  fpreal os0, fpreal os1);
396 
397 
398  int findNextFold(VertexFanHandle fan, int idx0,
399  fpreal *angle_sum = nullptr);
400 
401  int rewireToNextFold(VertexFanHandle fan,
402  SplitDraft &draft,
403  GEO_Hedge base_hedge, int idx0,
404  bool rewire_first, bool rewire_last,
405  fpreal bisect_angle = 0.0,
406  UT_Vector3 bisector
407  = UT_Vector3(0.0f, 0.0f, 0.0f),
408  uint32 flags = 0, fpreal span_angle_sum = -1.0);
409 
410  int rewireFanSpanToNextFold(VertexFanHandle fan,
411  SplitDraft &draft,
412  GEO_Hedge base_hedge, int idx0,
413  bool rewire_first, bool rewire_last);
414 
416  bool isUVSeam(GEO_Hedge h);
417 
418  int scanVertexFan(GEO_Hedge h0, GEO_Hedge h1,
419  VertexFanChain &fan_chain,
420  bool choose_ends = false);
421 
422  void dumpVertexFan(VertexFanHandle fan);
423 
424  void draftVertexFanSplit(const VertexFan &fan,
425  SplitDraft &draft);
426 
427  void draftSplitPointFan(VertexFanHandle fan,
428  SplitDraft &draft);
429  void draftSplitVertexFan(const EdgeOffset &e0,
430  const EdgeOffset &e1,
431  VertexFanHandle fan,
432  SplitDraft &draft, bool force_split,
433  UT_Vector3 offset_vector,
434  fpreal os0, fpreal os1);
435 
436  inline int numHubs() const
437  { return myHubs.entries(); }
438 
439  inline int hubIndex(GA_Offset pt) const
440  { return myHubIndex.get(pt); }
441 
442  inline GA_Offset hub(GA_Offset pt) const
443  { return myHubs(hubIndex(pt)); }
444 
445  inline int hubDegree(GA_Offset pt) const
446  { return myHubDegrees(hubIndex(pt)); }
447 
448  inline GA_Offset restPointOffset(GA_Offset pt) const
449  { return GA_Offset(myRestPtOff.get(pt)); }
450 
451  inline UT_Vector3 hubPos(GA_Offset pt) const
452  { return myRestGdp->getPos3(restPointOffset(pt)); }
453 
454  void setupPatchAxes(FilletShape shape,
455  int divisions,
456  GA_Offset &baseoffset);
457 
458  // void dumpPatch(Patch ptch);
459  void dumpPatchAxes(int divs);
460 
461  void meshPatchInterior(Patch ptch, FilletShape shape,
462  GA_Offset &base_pt, GA_Offset &base_prim,
463  GEO_PolyCounts &poly_size_list,
464  UT_IntArray &poly_pt_nums,
465  GA_OffsetArray *edge_prim_offs,
466  GA_OffsetArray *corner_prim_offs);
467 
468  void meshPatchJoint(Patch lbp, Patch rbp,
469  GA_Offset &base_pt, GA_Offset &base_prim,
470  GEO_PolyCounts &poly_size_list,
471  UT_IntArray &poly_pt_nums,
472  GA_OffsetArray *edge_prim_offs,
473  GA_OffsetArray *corner_prim_offs);
474 
475  void meshPatchEndTriangle(Patch ptch, int side,
476  GA_Offset &base_pt, GA_Offset &base_prim,
477  GEO_PolyCounts &poly_size_list,
478  UT_IntArray &poly_pt_nums,
479  GA_OffsetArray *edge_prim_offs,
480  GA_OffsetArray *corner_prim_offs);
481 
482  void setMeshCornerPositions(int divs);
483 
484  void setupEdgePatchAxes(Patch bp,
485  bool even_divs, bool mesh_left,
486  bool mesh_right, GA_Offset &base_pt);
487 
488  void setupVertexPatchAxes(Patch bp, bool even_divs,
489  bool mesh_left, bool mesh_right,
490  GA_Offset &base_pt);
491 
492  GA_Offset axisEndOnLeftBoundary(Patch bp);
493  GA_Offset axisEndOnRightBoundary(Patch bp);
494 
495  void meshEdgePatchMidDiv(Patch ptch, GA_Offset &base_prim,
496  GEO_PolyCounts &poly_size_list,
497  UT_IntArray &poly_pt_nums,
498  GA_OffsetArray *edge_prim_offs,
499  GA_OffsetArray *corner_prim_offs);
500 
501  void generateHubCapPrim(GA_Offset hub, FilletShape shape,
502  Patch ptch, GA_Offset &base_prim,
503  GEO_PolyCounts &poly_size_list,
504  UT_IntArray &poly_pt_nums,
505  GA_OffsetArray *edge_prim_offs,
506  GA_OffsetArray *corner_prim_offs);
507 
508  void meshMiddleDivisions(FilletShape shape,
509  GA_Offset &base_prim,
510  GEO_PolyCounts &poly_size_list,
511  UT_IntArray &poly_pt_nums,
512  GA_OffsetArray *edge_prim_offs,
513  GA_OffsetArray *corner_prim_offs);
514 
515  void assignEdgePatchMates();
516  void generatePatches(int divs, FilletShape shape);
517 
518  void generateMeshes(FilletShape shape,
519  int divs,
520  GA_Offset &base_pt,
521  GA_Offset &base_prim,
522  GEO_PolyCounts &poly_size_list,
523  UT_IntArray &poly_pt_nums,
524  GA_OffsetArray *edge_prim_offs,
525  GA_OffsetArray *corner_prim_offs);
526 
527  void stitchFilletGapsToRim(int divisions);
528 
529 
530  UT_Vector3 tangentTowardsMate(int side, Patch ptch);
531  UT_Vector3 insetDirection(int side, Patch ptch);
532 
533  UT_Vector3 vectorOverFold(UT_Vector3 v0, UT_Vector3 n0,
534  UT_Vector3 n1);
535 
536  void updateAffectedNormals(const GA_PrimitiveGroup *,
537  const GA_PrimitiveGroup *);
538 
539  void applyPointScale();
540 
541  fpreal locateUVTriangle(const UT_Vector3 &x, int prim_idx,
542  GA_Offset &va, GA_Offset &vb, GA_Offset &vc,
543  fpreal &ga, fpreal &gb, fpreal &gc);
544 
545  UT_Vector3 calcRimVertexUV(GA_Offset vtx);
546  UT_Vector3 barycentricVertexUV(GA_Offset vtx, GA_Offset vta,
547  GA_Offset vtb, GA_Offset vtc);
548 
549  void findRimTriangleVtxs(GA_Offset vtx,
550  GA_Offset &vtx_prev, GA_Offset &vtx_next,
551  UT_Vector3 &rest_pos, UT_Vector3 &rest_pos_prev,
552  UT_Vector3 &rest_pos_next);
553 
554  UT_Vector3 radialRimVertexUV(GA_Offset vtx);
555 
556  UVPatchSet *constructUVPatchSet();
557 
558  void calcEdgePatchInternalUVs(Patch ptch,
559  UVPatchSet *uvpatches);
560 
561  void calcVertexPatchInternalUVs(Patch ptch,
562  UVPatchSet *uvpatches);
563 
564  void calcVertexPatchMidDivUVs(Patch ptch,
565  UVPatchSet *uvpatches);
566 
567  GA_Offset hubPrimPoint(GA_Offset hub, Patch ptch, int side);
568 
569  GA_Offset hubPrimAdjacentVertex(GA_Offset hub, Patch ptch,
570  int side);
571 
572 
573 
574  void calcHubCapPrimUVs(int i);
575 
576  GA_Offset edgePatchDivVertex(int side, Patch ptch, int i,
577  UVPatchSet *uvpatches = nullptr);
578 
579  void vertexPatchDivMeshVtxs(int side, Patch ptch, int div,
580  GA_Offset &lv, GA_Offset &uv);
581 
582  void calcMeshUVs(Mesh mesh,
583  UVPatchSet *uvpatches);
584 
585  void calcEdgePatchMidDivUVs(Patch ptch,
586  UVPatchSet *uvpatches);
587 
588  void calcPatchAxisEndUVs(Patch ptch,
589  UVPatchSet *uvpatches);
590 
591  void offsetRimVertexUVs(UVPatchSet *uvpatches);
592  void updateAffectedUVs(UVPatchSet *uvpatches,
593  FilletShape shape);
594 
595  void wrangleAttributes(FilletShape shape);
596 
597  void copyPointAttributes(GA_Offset pt, Patch start_ptch,
598  GA_PointWrangler *ptw);
599 
600  void copyMeshPointAttributes(Mesh m, GA_Offset pt,
601  GA_PointWrangler *ptw);
602 
603  void copyPatchAxisPointAttributes(int side, Patch ptch,
604  GA_Offset pt, GA_PointWrangler *ptw);
605 
606  void lerpAttribsOnEdgePatch(Patch ptch,
608  GA_VertexWrangler *vw,
610  GA_VertexWrangler *vwx,
611  UT_IntArray &contribs,
613  GA_VertexWrangler *vws);
614 
615  void lerpAttribsOnVertexPatch(Patch ptch,
617  GA_VertexWrangler *vw,
619  GA_VertexWrangler *vwi,
621  GA_VertexWrangler *vws);
622 
623  void lerpAttribsOnMidDivs(Patch ptch,
625  GA_VertexWrangler *vw,
627  GA_VertexWrangler *vws );
628 
629  void copyHubCapPrimAttributes(int i,
631  GA_VertexWrangler *vw,
633  GA_VertexWrangler *vws);
634 
635  void lerpAttribsOnMesh(Mesh mesh,
637  GA_VertexWrangler *vw,
639  GA_VertexWrangler *vwi,
641  GA_VertexWrangler *vws);
642 
643  template <typename T>
644  void applyPositioner(T& positioner);
645 
646  void positionFilletPoints(FilletShape shape,
647  const Profile *profile);
648 
649  void addVisBoundaryEdge(GA_Offset p0, GA_Offset p1);
650  void addVisInteriorEdge(GA_Offset p0, GA_Offset p1);
651 
653  bool haveWeightedEdges() const;
654 
656  fpreal hedgeWeight(GEO_Hedge h) const;
657 
659  UT_Vector3 hedgeVector(GEO_Hedge h) const;
660 
662  UT_Vector3 hedgeNormal(GEO_Hedge h) const;
663 
665  int rimPrimID(GA_Offset primoff) const;
666 
668  int hedgePrimID(GEO_Hedge h) const;
669 
671  bool isHedgeOnBoundaryCap(GEO_Hedge h) const;
672 
674  GA_Offset primFirstTriangle(int prim_idx) const
675  { return myRimPolyFirstTri(prim_idx); }
676 
678  GA_Offset triangleToNextTriangle(GA_Offset tri) const
679  { return myRimPolyNextTri(tri); }
680 
682  GEO_PrimPoly *getPoly(GA_Offset primoff)
683  { return (GEO_PrimPoly *)
684  myGdp->getPrimitive(primoff); }
685 
686 
687  void prepareHubs();
688  void constructRimPolyTriLists(int num_primitives);
689 
690  GA_PrimitiveGroup *capBoundaryBevelPoints();
691 
692  void processRimPrims();
693  void prepareRimPrims(const GA_EdgeGroup *edges);
694  void prepareRimPrims(GA_PointGroup *points,
695  bool bevel_open_poly_pts);
696 
697  void prepareBevelEdges(const GA_EdgeGroup *edges,
698  bool ignore_flat, fpreal flat_normal_diff);
699 
700  void prepareBevelPoints(const GA_PointGroup *points);
701  void recordEdgesToDissolve();
702  void consolidateIncidentPrims();
703  void restoreOriginalPrimitiveIndices();
704 
705  void markDegeneratePatches(FilletShape shape);
706  void trivialBevelEdges();
707  void reopenInputOpenPolys();
708  void cleanup();
709 
710  typedef UT_Array<Patch> PatchArray;
711 
712  struct OpenPoly
713  {
714  GA_Index myPoly;
715  GA_Index myFirstPt;
716  };
717 
718  UT_Array<OpenPoly> myOpenPolys;
719 
720  const GU_Detail *myRestGdp;
721  GU_Detail *myGdp;
722 
723  PatchSet *myPatches;
724 
725  GA_RWHandleV3 myPrimNormal;
726 
727  UT_BitArray myRedundantHubs;
728  GA_OffsetArray myHubs;
729  GA_OffsetArray myHubCapPrims;
730  GA_RWHandleI myHubIndex;
731  GA_RWHandleI myRestPtOff;
732  UT_IntArray myHubDegrees;
733  UT_Array<Patch> myHubFirstPatch;
734 
735  GA_RWHandleF myHedgeWeight;
736 
737  GA_PointGroup *myBevelPoints;
738  GA_VertexGroup *myBevelHedges; // accepted input half-edges
739  GA_PrimitiveGroup *myRimPrims;
740  GA_PointGroup *myBoundaryPts;
741 
742  GA_VertexGroup *myBridgeHedges;
743 
744  GA_PrimitiveGroup *myBoundaryCapPrims;
745 
746  UT_IntArray myRimCompStarts;
747 
748  // parallel arrays for rim hedges
749  UT_Array<GEO_Hedge> myRimHedges; // rim hedges by index
750  UT_Vector3Array myRimHedgeSrcVel; // velocity of ith rim hedge
751  PatchArray myRimHedgePatch; // patch of ith rim hedge
752  UT_IntArray myRimHedgeMate; // mate of ith rim hedge
753  UT_Int32Array myRimHedgeFlags; // flags of ith rim hedge
754 
755 
756  OffsetMode myOffsetMode;
757  bool myOwnHedgeInterface;
758 
759  GA_OffsetArray myVisBevelPoints;
760  GA_OffsetArray myVisBoundaryEdges;
761  GA_OffsetArray myVisInteriorEdges;
762  GA_OffsetArray myVisRejectedEdges;
763 
764  UT_Fpreal32Array myLimitPtCoords;
765 
766  fpreal myRadialInc;
767 
768  GA_RWHandleV3 myUV;
769  GA_ROHandleF myOffsetScale;
770 
771  GA_RWHandleI myRimPrimID;
772 
773  UT_IntArray myRimPolyClass;
774  GA_OffsetArray myRimPolyFirstTri;
775  GA_OffsetArray myRimPolyNextTri;
776 
777  GA_Offset myCapPoint;
778 
779  UT_StringStream myWarnings;
780 
781  const GU_PolyBevelParms *myParms;
782  const GEO_DetachedHedgeInterface *myHip;
783 };
784 
785 
787 {
788 public:
792 
793  GU_PolyBevelParms(bool ignore_flat = false,
794  fpreal flat_angle = 0.03490658503989, // 2 degrees
795  bool allow_splits = true,
796  bool split_single_folds = false,
797  bool split_flat_edges = false,
798  fpreal radial_inc = M_PI_2,
799  GA_Attribute *offscale = nullptr,
800  GA_Attribute *pscale = nullptr,
801  GA_PrimitiveGroup *edge_prims = nullptr,
802  GA_PrimitiveGroup *corner_prims = nullptr,
803  bool crease_edges = false,
804  fpreal round_convexity = 1.0,
805  const UT_Ramp *profile_ramp = nullptr,
806  const GEO_Face *profile_curve = nullptr,
807  bool symmetrize_profile = false,
808  fpreal profile_scale = 1.0,
809  ProfileSampling profile_sampling = GU_PolyBevel::UNIFORM) :
810  myIgnoreFlat(ignore_flat),
811  myAllowSplits(allow_splits),
812  mySplitSingleFolds(split_single_folds),
813  mySplitFlatEdges(split_flat_edges),
814  myFlatAngle(flat_angle),
815  myRadialInc(radial_inc),
816  myOffsetScale(offscale),
817  myPointScale(pscale),
818  myEdgePrims(edge_prims),
819  myCornerPrims(corner_prims),
820  myRoundness(round_convexity),
821  myProfileRamp(profile_ramp),
822  myProfileCurve(profile_curve),
823  myProfileScale(profile_scale),
824  myProfileSampling(profile_sampling),
825  mySymmetrizeProfile(symmetrize_profile),
826  myReverseProfile(symmetrize_profile)
827  { }
828 
829  inline bool ignoreFlat() const { return myIgnoreFlat; }
830  void ignoreFlat(bool b) { myIgnoreFlat = b; }
831 
832  inline bool commonLimit() const { return myCommonLimit; }
833  void commonLimit(bool b) { myCommonLimit = b; }
834 
835  inline bool allowSplits() const { return myAllowSplits; }
836  void allowSplits(bool b) { myAllowSplits = b; }
837 
838  inline bool splitSingleFolds() const { return mySplitSingleFolds; }
839  void splitSingleFolds(bool b) { mySplitSingleFolds = b; }
840 
841  inline bool splitFlatEdges() const { return mySplitFlatEdges; }
842  void splitFlatEdges(bool b) { mySplitFlatEdges = b; }
843 
844  inline bool symmetrizeProfile() const
845  { return mySymmetrizeProfile; }
846  void symmetrizeProfile(bool b)
847  { mySymmetrizeProfile = b; }
848 
849  inline bool reverseProfile() const { return myReverseProfile; }
850  void reverseProfile(bool b) { myReverseProfile = b; }
851 
852  inline fpreal flatAngle() const { return myFlatAngle; }
853  void flatAngle(fpreal f) { myFlatAngle = f; }
854 
855  inline fpreal radialInc() const { return myRadialInc; }
856  void radialInc(fpreal f) { myRadialInc = f; }
857 
858  GA_Attribute *offsetScale() const { return myOffsetScale; }
859  void offsetScale(GA_Attribute *a) { myOffsetScale = a; }
860 
861  GA_Attribute *pointScale() const { return myPointScale; }
862  void pointScale(GA_Attribute *a) { myPointScale = a; }
863 
864  GA_PrimitiveGroup *edgePrims() const { return myEdgePrims; }
865  void edgePrims(GA_PrimitiveGroup *g) { myEdgePrims = g; }
866 
867  GA_PrimitiveGroup *cornerPrims() const { return myCornerPrims; }
869  { myCornerPrims = grp; }
870 
871  fpreal roundness() const { return myRoundness; }
872  void roundness(fpreal f) { myRoundness = f; }
873 
874  const UT_Ramp *profileRamp() const { return myProfileRamp; }
875  void profileRamp(const UT_Ramp *r) { myProfileRamp = r; }
876 
877  const GEO_Face *profileCurve() const { return myProfileCurve; }
878  void profileCurve(const GEO_Face *c) { myProfileCurve = c; }
879 
880 
881  fpreal profileScale() const { return myProfileScale; }
882  void profileScale(fpreal f) { myProfileScale = f; }
883 
884  ProfileSampling profileSampling() const { return myProfileSampling; }
886  { myProfileSampling = s; }
887 
888 private:
889  bool myIgnoreFlat;
890  bool myAllowSplits;
891  bool mySplitSingleFolds;
892  bool mySplitFlatEdges;
893  bool mySymmetrizeProfile;
894  bool myReverseProfile;
895  bool myCommonLimit;
896  fpreal myFlatAngle;
897  fpreal myRadialInc;
898  GA_Attribute *myOffsetScale;
899  GA_Attribute *myPointScale;
900  GA_PrimitiveGroup *myEdgePrims;
901  GA_PrimitiveGroup *myCornerPrims;
902  fpreal myRoundness;
903  const UT_Ramp *myProfileRamp;
904  const GEO_Face *myProfileCurve;
905  fpreal myProfileScale;
906  ProfileSampling myProfileSampling;
907 
908 };
909 
910 #endif
png_infop png_charpp int png_charpp profile
Definition: png.h:2467
void allowSplits(bool b)
Definition: GU_PolyBevel.h:836
Definition of a geometry attribute.
Definition: GA_Attribute.h:189
GA_API const UT_StringHolder div
const UT_Ramp * profileRamp() const
Definition: GU_PolyBevel.h:874
void profileScale(fpreal f)
Definition: GU_PolyBevel.h:882
void roundness(fpreal f)
Definition: GU_PolyBevel.h:872
void profileRamp(const UT_Ramp *r)
Definition: GU_PolyBevel.h:875
void edgePrims(GA_PrimitiveGroup *g)
Definition: GU_PolyBevel.h:865
GA_API const UT_StringHolder uv
const GLdouble * v
Definition: glcorearb.h:836
GLsizei const GLchar *const * string
Definition: glcorearb.h:813
GA_PrimitiveGroup * cornerPrims() const
Definition: GU_PolyBevel.h:867
void splitSingleFolds(bool b)
Definition: GU_PolyBevel.h:839
UT_Vector3T< float > UT_Vector3
ProfileSampling profileSampling() const
Definition: GU_PolyBevel.h:884
GLboolean GLboolean g
Definition: glcorearb.h:1221
fpreal flatAngle() const
Definition: GU_PolyBevel.h:852
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1221
GLint GLuint mask
Definition: glcorearb.h:123
GLbitfield flags
Definition: glcorearb.h:1595
void ignoreFlat(bool b)
Definition: GU_PolyBevel.h:830
bool ignoreFlat() const
Definition: GU_PolyBevel.h:829
bool commonLimit() const
Definition: GU_PolyBevel.h:832
png_uint_32 i
Definition: png.h:2877
bool operator!=(const ElementIndex &other) const
Definition: GU_PolyBevel.h:124
int divs(int x, int y)
Definition: ImathFun.h:180
fpreal radialInc() const
Definition: GU_PolyBevel.h:855
GA_Size GA_Offset
Definition: GA_Types.h:617
bool symmetrizeProfile() const
Definition: GU_PolyBevel.h:844
void profileCurve(const GEO_Face *c)
Definition: GU_PolyBevel.h:878
GA_Attribute * offsetScale() const
Definition: GU_PolyBevel.h:858
GLfloat f
Definition: glcorearb.h:1925
bool splitFlatEdges() const
Definition: GU_PolyBevel.h:841
GA_Attribute * pointScale() const
Definition: GU_PolyBevel.h:861
GU_PolyBevel::FilletShape FilletShape
Definition: GU_PolyBevel.h:791
GEO_Hedge encapsulates a half-edge (hedge) which is the restriction of.
Definition: GEO_Hedge.h:47
bool operator==(const ElementIndex &other) const
Definition: GU_PolyBevel.h:121
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
GLintptr offset
Definition: glcorearb.h:664
void symmetrizeProfile(bool b)
Definition: GU_PolyBevel.h:846
An bi-directional stream object that owns its own string buffer storage.
GU_PolyBevel::ProfileSampling ProfileSampling
Definition: GU_PolyBevel.h:789
T angle(const Vec2< T > &v1, const Vec2< T > &v2)
Definition: Vec2.h:480
bool reverseProfile() const
Definition: GU_PolyBevel.h:849
#define GU_API
Definition: GU_API.h:11
GLuint const GLchar * name
Definition: glcorearb.h:785
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1221
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
Definition: GA_Types.h:611
void profileSampling(ProfileSampling s)
Definition: GU_PolyBevel.h:885
unsigned int uint
Definition: SYS_Types.h:33
const UT_Fpreal32Array & getLimitPtCoords()
Definition: GU_PolyBevel.h:103
void radialInc(fpreal f)
Definition: GU_PolyBevel.h:856
GLenum mode
Definition: glcorearb.h:98
GLfloat v0
Definition: glcorearb.h:815
void splitFlatEdges(bool b)
Definition: GU_PolyBevel.h:842
const GEO_Face * profileCurve() const
Definition: GU_PolyBevel.h:877
GU_API exint fan(GU_Detail *gdp, UT_Array< GA_OffsetArray > &rings, UT_Array< GA_OffsetArray > &ringOrigs, GA_PrimitiveGroup *patchgroup=nullptr, GA_PrimitiveGroup *loopgroup=nullptr, exint degree=3, bool deformpatch=false, fpreal ctrTranslation=0.0, bool edgeloop=false, fpreal edgelooppercentage=0.5)
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2001
void cornerPrims(GA_PrimitiveGroup *grp)
Definition: GU_PolyBevel.h:868
double fpreal
Definition: SYS_Types.h:263
void reverseProfile(bool b)
Definition: GU_PolyBevel.h:850
typedef int
Definition: png.h:1175
void flatAngle(fpreal f)
Definition: GU_PolyBevel.h:853
GU_PolyBevelParms(bool ignore_flat=false, fpreal flat_angle=0.03490658503989, bool allow_splits=true, bool split_single_folds=false, bool split_flat_edges=false, fpreal radial_inc=M_PI_2, GA_Attribute *offscale=nullptr, GA_Attribute *pscale=nullptr, GA_PrimitiveGroup *edge_prims=nullptr, GA_PrimitiveGroup *corner_prims=nullptr, bool crease_edges=false, fpreal round_convexity=1.0, const UT_Ramp *profile_ramp=nullptr, const GEO_Face *profile_curve=nullptr, bool symmetrize_profile=false, fpreal profile_scale=1.0, ProfileSampling profile_sampling=GU_PolyBevel::UNIFORM)
Definition: GU_PolyBevel.h:793
Utility class for containing a color ramp.
Definition: UT_Ramp.h:84
void commonLimit(bool b)
Definition: GU_PolyBevel.h:833
GLuint index
Definition: glcorearb.h:785
void pointScale(GA_Attribute *a)
Definition: GU_PolyBevel.h:862
GLint GLenum GLint x
Definition: glcorearb.h:408
GA_API const UT_StringHolder pscale
fpreal profileScale() const
Definition: GU_PolyBevel.h:881
const std::string getWarningMessage()
Definition: GU_PolyBevel.h:105
fpreal roundness() const
Definition: GU_PolyBevel.h:871
GLboolean r
Definition: glcorearb.h:1221
bool splitSingleFolds() const
Definition: GU_PolyBevel.h:838
void offsetScale(GA_Attribute *a)
Definition: GU_PolyBevel.h:859
#define M_PI_2
Definition: ImathPlatform.h:55
GU_PolyBevel::OffsetMode OffsetMode
Definition: GU_PolyBevel.h:790
GA_PrimitiveGroup * edgePrims() const
Definition: GU_PolyBevel.h:864
unsigned int uint32
Definition: SYS_Types.h:29
bool allowSplits() const
Definition: GU_PolyBevel.h:835