13 #ifndef __GU_PolyBevel_h__
14 #define __GU_PolyBevel_h__
50 #define EXPLICIT_ELEMENT_INDEX 1
99 void saveMeshBoundaryEdgesToDetailArray(
const char *
name);
100 void saveBevelPointsToDetailArray(
const char *
name);
101 void saveMeshInteriorEdgesToDetailArray(
const char *
name);
102 void saveLimitPtCoordsToDetailArray(
const char *attrib_name);
108 {
return myWarnings.str().toStdString(); }
114 #if EXPLICIT_ELEMENT_INDEX
121 operator int()
const {
return myIndex; }
124 {
return myIndex == other.myIndex; }
127 {
return myIndex != other.myIndex; }
135 using ElementIndex::ElementIndex;
140 using ElementIndex::ElementIndex;
154 struct VertexFanHandle;
155 struct VertexFanChain;
174 const EdgeOffset &o1);
176 UT_Vector3 divergentOffsetVector(
const EdgeOffset &o0,
177 const EdgeOffset &o1);
179 bool canOffsetAlongFold(
const EdgeOffset &e0,
180 const EdgeOffset &e1,
181 const VertexFanHandle &
fan,
184 fpreal offsetRatio(
const EdgeOffset &e0,
185 const EdgeOffset &e1,
186 const VertexFanHandle &
fan,
189 void draftPointBevelRimVertexSplits(SplitDraft &draft,
193 void draftEdgeBevelRimVertexSplits(SplitDraft &draft,
194 GU_Decompose &euler_paths);
196 void draftEdgeBevelRimVertexSplits(SplitDraft &draft,
199 void splitPointBevelRimVertices(
const SplitDraft &draft);
202 void splitEdgeBevelRimVertices(
const SplitDraft &draft,
203 GU_Decompose &euler_paths);
205 void splitEdgeBevelRimVertices(
const SplitDraft &draft,
210 void deleteRedundantHubs();
212 void offsetFilletBoundary(
fpreal inset_amount);
221 EDGE_ERROR_DEGENERATE,
223 EDGE_ERROR_NONMANIFOLD,
224 EDGE_ERROR_BADMANIFOLD,
225 EDGE_ERROR_TOO_SHORT,
226 EDGE_ERROR_TOO_SHARP,
227 EDGE_ERROR_NONMANIFOLD_ENDPOINT
232 bool ignore_flat =
false,
234 bool doing_all =
false);
237 EdgeError verifyHedgeForBevelling(
GEO_Hedge h,
238 bool ignore_flat =
false,
239 fpreal flat_cos = 0.9999);
242 void addPointToBevelPoints(
GA_Offset pt);
246 int numRimComponents()
const
247 {
return int(myRimCompStarts.entries()) - 1; }
250 int rimCompSize(
int k)
const
251 {
return int(myRimCompStarts(k + 1)
252 - myRimCompStarts(k)); }
256 int rimCompHedgeIndex(
int k,
int i)
const
257 {
return myRimCompStarts(k) + i; }
260 int mateIndex(
int i)
const
261 {
return myRimHedgeMate(i); }
264 int rimCompHedgeMateIndex(
int k,
int i)
const
265 {
return mateIndex(rimCompHedgeIndex(k, i)); }
269 GEO_Hedge rimCompHedge(
int k,
int i)
const
270 {
return myRimHedges(rimCompHedgeIndex(k, i)); }
274 GEO_Hedge rimCompHedgeMate(
int k,
int i)
const
276 return myRimHedges(rimCompHedgeMateIndex(k, i));
280 int numRimHedges()
const
281 {
return int(myRimHedges.size()); }
285 {
return myRimHedges(i); }
289 {
return myRimHedgeSrcVel(i); }
293 {
return (
mask & myRimHedgeFlags(i)); }
296 Patch rimHedgePatch(
int i)
const
297 {
return myRimHedgePatch(i); }
300 Patch rimCompHedgePatch(
int k,
int j)
const
301 {
return myRimHedgePatch(rimCompHedgeIndex(k, j)); }
304 Patch rimCompHedgeMatePatch(
int k,
int j)
const
305 {
return myRimHedgePatch(rimCompHedgeMateIndex(k, j)); }
311 void dumpRimComponents();
314 bool hasTargetedTangent(
int side, Patch pach);
315 bool needsMesh(
int side,
FilletShape shape, Patch ptch);
317 int calcSlices(VertexFanHandle
fan,
318 int span_start,
int span_end,
324 int calcSplitLocations(VertexFanHandle
fan,
325 int span_start,
int span_end,
331 bool sliceFlatFanSpan(VertexFanHandle
fan,
333 int span_start,
int span_end,
338 void sliceClosedFanSpan(VertexFanHandle
fan,
340 int span_start,
int span_end,
345 void closedFanSplit(VertexFanHandle
fan,
349 void fullCircleSplit(VertexFanHandle
fan,
352 void unisplit(
const EdgeOffset &e0,
const EdgeOffset &e1,
353 VertexFanHandle
fan, SplitDraft &draft,
356 bool isFanBisector(
const EdgeOffset &e0,
360 int mirrorFoldVector(
const EdgeOffset &e0,
361 const EdgeOffset &e1,
364 void bisplitFold(
const EdgeOffset &e0,
const EdgeOffset &e1,
365 VertexFanHandle
fan, SplitDraft &draft,
368 void bisplitFlat(
const EdgeOffset &e0,
const EdgeOffset &e1,
369 VertexFanHandle
fan, SplitDraft &draft,
373 void multisplit(
const EdgeOffset &e0,
const EdgeOffset &e1,
374 VertexFanHandle
fan, SplitDraft &draft,
378 int findNextFold(VertexFanHandle
fan,
int idx0,
379 fpreal *angle_sum =
nullptr);
381 int rewireToNextFold(VertexFanHandle
fan,
384 bool rewire_first,
bool rewire_last,
385 fpreal bisect_angle = 0.0,
390 int rewireFanSpanToNextFold(VertexFanHandle fan,
393 bool rewire_first,
bool rewire_last);
399 VertexFanChain &fan_chain,
400 bool choose_ends =
false);
402 void dumpVertexFan(VertexFanHandle fan);
404 void draftSplitVertexFan(
const EdgeOffset &e0,
405 const EdgeOffset &e1,
407 SplitDraft &draft,
bool force_split,
411 inline int numHubs()
const
412 {
return int(myHubs.size()); }
415 {
return myHubIndex.get(pt); }
418 {
return myHubs(hubIndex(pt)); }
421 {
return myHubDegrees(hubIndex(pt)); }
424 {
return GA_Offset(myRestPtOff.get(pt)); }
427 {
return myRestGdp->getPos3(restPointOffset(pt)); }
434 void dumpPatchAxes(
int divs);
436 void meshPatchInterior(Patch ptch,
FilletShape shape,
443 void meshPatchJoint(Patch lbp, Patch rbp,
450 void setupEdgePatchAxes(Patch bp,
451 bool even_divs,
bool mesh_left,
454 void setupVertexPatchAxes(Patch bp,
bool even_divs,
455 bool mesh_left,
bool mesh_right,
458 GA_Offset axisEndOnLeftBoundary(Patch bp);
459 GA_Offset axisEndOnRightBoundary(Patch bp);
461 void meshEdgePatchMidDiv(Patch ptch,
GA_Offset &base_prim,
481 void assignEdgePatchMates();
493 void stitchFilletGapsToRim(
int divisions);
496 UT_Vector3 tangentTowardsMate(
int side, Patch ptch);
504 void applyPointScale();
521 UVPatchSet *constructUVPatchSet();
523 void calcEdgePatchInternalUVs(Patch ptch,
524 UVPatchSet *uvpatches);
526 void calcVertexPatchInternalUVs(Patch ptch,
527 UVPatchSet *uvpatches);
529 void calcVertexPatchMidDivUVs(Patch ptch,
530 UVPatchSet *uvpatches);
539 void calcHubCapPrimUVs(
int i);
541 GA_Offset edgePatchDivVertex(
int side, Patch ptch,
int i,
542 UVPatchSet *uvpatches =
nullptr);
544 void vertexPatchDivMeshVtxs(
int side, Patch ptch,
int div,
547 void calcMeshUVs(
Mesh mesh,
548 UVPatchSet *uvpatches);
550 void calcEdgePatchMidDivUVs(Patch ptch,
551 UVPatchSet *uvpatches);
553 void calcPatchAxisEndUVs(Patch ptch,
554 UVPatchSet *uvpatches);
556 void offsetRimVertexUVs(UVPatchSet *uvpatches);
557 void updateAffectedUVs(UVPatchSet *uvpatches,
562 void copyPointAttributes(
GA_Offset pt, Patch start_ptch,
568 void copyPatchAxisPointAttributes(
int side, Patch ptch,
571 void lerpAttribsOnEdgePatch(Patch ptch,
580 void lerpAttribsOnVertexPatch(Patch ptch,
588 void lerpAttribsOnMidDivs(Patch ptch,
594 void copyHubCapPrimAttributes(
int i,
600 void lerpAttribsOnMesh(
Mesh mesh,
608 template <
typename T>
609 void applyPositioner(
T& positioner);
612 const Profile *profile);
618 bool haveWeightedEdges()
const;
639 GA_Offset primFirstTriangle(
int prim_idx)
const
640 {
return myRimPolyFirstTri(prim_idx); }
644 {
return myRimPolyNextTri(tri); }
649 myGdp->getPrimitive(primoff); }
653 void constructRimPolyTriLists(
int num_primitives);
657 void processRimPrims();
660 bool bevel_open_poly_pts);
663 bool ignore_flat,
fpreal flat_normal_diff);
666 void consolidateIncidentPrims();
667 void restoreOriginalPrimitiveIndices();
670 void trivialBevelEdges();
671 void reopenInputOpenPolys();
715 PatchArray myRimHedgePatch;
720 OffsetMode myOffsetMode;
721 bool myOwnHedgeInterface;
775 {
return mySymmetrizeProfile; }
777 { mySymmetrizeProfile =
b; }
799 { myCornerPrims = grp; }
815 { myProfileSampling =
s; }
818 bool myIgnoreFlat =
false;
819 bool myAllowSplits =
true;
820 bool mySplitSingleFolds =
false;
821 bool mySplitFlatEdges =
false;
822 bool mySymmetrizeProfile =
false;
823 bool myReverseProfile =
false;
824 bool myCommonLimit =
false;
825 fpreal myFlatAngle = 0.03490658503989;
832 const UT_Ramp *myProfileRamp =
nullptr;
833 const GEO_Face *myProfileCurve =
nullptr;
834 fpreal myProfileScale = 1.0;
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
Definition of a geometry attribute.
GA_API const UT_StringHolder div
const UT_Ramp * profileRamp() const
GLdouble GLdouble GLint GLint const GLdouble * points
void profileScale(fpreal f)
void profileRamp(const UT_Ramp *r)
SIM_API const UT_StringHolder angle
void edgePrims(GA_PrimitiveGroup *g)
GA_API const UT_StringHolder uv
GLsizei const GLchar *const * string
GA_PrimitiveGroup * cornerPrims() const
void splitSingleFolds(bool b)
UT_Vector3T< float > UT_Vector3
ProfileSampling profileSampling() const
GLboolean GLboolean GLboolean GLboolean a
bool operator!=(const ElementIndex &other) const
bool symmetrizeProfile() const
void profileCurve(const GEO_Face *c)
GA_Attribute * offsetScale() const
bool splitFlatEdges() const
GA_Attribute * pointScale() const
GU_PolyBevel::FilletShape FilletShape
GEO_Hedge encapsulates a half-edge (hedge) which is the restriction of.
bool operator==(const ElementIndex &other) const
void symmetrizeProfile(bool b)
An bi-directional stream object that owns its own string buffer storage.
GU_PolyBevel::ProfileSampling ProfileSampling
bool reverseProfile() const
GLuint const GLchar * name
GLboolean GLboolean GLboolean b
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
void profileSampling(ProfileSampling s)
const UT_Fpreal32Array & getLimitPtCoords()
IMATH_HOSTDEVICE constexpr int divs(int x, int y) IMATH_NOEXCEPT
void splitFlatEdges(bool b)
const GEO_Face * profileCurve() const
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
void cornerPrims(GA_PrimitiveGroup *grp)
void reverseProfile(bool b)
Utility class for containing a color ramp.
void pointScale(GA_Attribute *a)
fpreal profileScale() const
const std::string getWarningMessage()
bool splitSingleFolds() const
void offsetScale(GA_Attribute *a)
GU_PolyBevel::OffsetMode OffsetMode
GA_PrimitiveGroup * edgePrims() const