37 #ifndef __GEO_PolyIface__
38 #define __GEO_PolyIface__
48 #include <UT/UT_Triangulate.h>
52 #define USE_32BIT_LINKS 1
53 #define VERIFY_WITH_HARD_POLYS 0
57 #define FLAG_MASK 0x40000000
60 #else // Use 64bit links
62 #define FLAG_MASK 0x4000000000000000
88 template <
typename FILTER,
typename ITERTYPE>
92 myFilter(f), myRange(r) { }
96 Iterator(
const FILTER &
f) : myFilter(f), myIter() { }
98 myFilter(f), myIter(r)
101 ITERTYPE
operator*()
const {
return ITERTYPE(*myIter); }
103 {
return !myIter.
atEnd(); }
108 while (!myIter.
atEnd() && !myFilter(*myIter))
124 template <
typename CIRCULATOR,
typename ITERTYPE>
128 myCirculator(f), myBase(base) { }
137 {
return GAisValid(myIter) && myIter != myBase; }
142 myIter = myCirculator(myIter);
148 CIRCULATOR myCirculator;
152 {
return Iterator(myCirculator, myBase); }
155 {
return Iterator(myCirculator, myBase); }
157 CIRCULATOR myCirculator;
193 bool copy_excluded =
false);
200 void wranglePointAttribute(
204 void wrangleVertexAttribute(
208 void wranglePrimitiveAttribute(
214 { deleteAttribRefMap(myPointAttrRefMap); }
217 { deleteAttribRefMap(myVertexAttrRefMap); }
220 { deleteAttribRefMap(myPrimitiveAttrRefMap); }
226 { myPointWranglingEnabled = enable;}
229 { myVertexWranglingEnabled = enable;}
232 { myPrimitiveWranglingEnabled = enable;}
241 {
return vertexPrimitive(
srcVertex(h)); }
257 {
return isValidHedgeSrcVertex(
srcVertex(h)); }
261 {
return isValidHedge(h); }
359 {
return nextEquivalentHedge(h); }
369 {
return primaryEquivalentHedge(h); }
510 bool accept_bd =
false)
const;
629 bool check_contractible =
true,
630 bool internal =
true);
642 bool and_equivalent =
true,
655 bool and_equivalent =
true,
676 template <
typename T = fpreal32>
684 UT_Triangulate::WorkBuffer *wb =
nullptr,
687 template <
typename S,
typename T = fpreal32>
688 exint triangulate(
const S &&polys,
704 void deletePointStar(
GA_Offset pt,
bool cap_hole =
true,
706 bool destroy_pt =
true);
716 bool rewire_hedges =
true);
728 void destroyPoly(
GA_Offset poly,
bool and_pts =
false);
731 bool relink_hedges =
true);
735 bool relink_hedges =
true);
739 bool relink_hedges =
true);
741 int deleteVertex(
GA_Offset vtx,
bool relink_hedges =
true);
747 bool softValidate()
const;
748 bool validate()
const;
777 {
return GA_Offset(myNextPolyHedge->getLink(v)); }
783 {
return GA_Offset(myPrevPolyHedge->getLink(v)); }
791 {
return myPI.isValidPoly(off); }
804 {
return myPI.isValidHedge(
GEO_Hedge(off)); }
817 {
return myPI.isValidHedge(
GEO_Hedge(off))
825 bool complement =
false)
const;
835 {
return myPI.polyNext(off); }
866 {
return myPrevSymHedge->getLink(v); }
886 {
return !isSecondary(v); }
906 { myPrevPolyHedge->setLink(v, w); }
910 { myNextPolyHedge->setLink(v, w); }
916 void getAdjacentBoundaryVertices(
GA_Offset vtx,
922 {
return !isSoft(v); }
934 {
return myGdp->vertexPoint(vtx); }
938 { myTopology.wireVertexPoint(vtx, pt); }
942 {
return myGdp->vertexToNextVertex(vtx); }
946 {
return myGdp->pointVertex(vtx); }
950 {
return myGdp->vertexPrimitive(vtx); }
954 { myTopology.wireVertexPrimitive(vtx, p); }
970 myNextSymHedge->setLink(src_vtx,
980 void wireVertexPointAndRelinkHedges(
GA_Offset vtx,
991 typedef std::pair<GA_Offset, GA_Offset> OffsetPair;
996 void linkPointIncidentHedges(
GA_Offset pt,
997 OffsetPairArray &pairs_local,
1005 bool release_from_poly =
true);
1029 bool local_split_edge_link,
1032 fpreal lerp_ratio = 0.5);
1035 bool local_split_edge_link,
1038 fpreal lerp_ratio = 0.5);
1042 {
delete r; r =
nullptr; }
1069 bool myPointWranglingEnabled;
1070 bool myVertexWranglingEnabled;
1071 bool myPrimitiveWranglingEnabled;
1080 myPrevSymHedge->
setLink(v, w);
1089 bool secondary = isSecondary(v);
1097 GEO_PolyInterface::symNext(
GA_Offset v)
const
1115 bool soft = isSoft(poly);
1135 GEO_PolyInterface::isSecondary(
GA_Offset v)
const
1141 GEO_PolyInterface::makeSecondary(
GA_Offset v)
1148 GEO_PolyInterface::makePrimary(
GA_Offset v)
1155 GEO_PolyInterface::isSoft(
GA_Offset poly)
const
1161 GEO_PolyInterface::makeSoft(
GA_Offset poly)
1168 GEO_PolyInterface::makeHard(
GA_Offset poly)
1175 GEO_PolyInterface::symLoop(
GA_Offset src_vtx)
1177 myNextSymHedge->
setLink(src_vtx, src_vtx);
1178 myPrevSymHedge->
setLink(src_vtx, src_vtx);
1188 GEO_PolyInterface::polyLoop(
GA_Offset src_vtx)
1270 GEO_PolyInterface::hedgePrimPoly(
GEO_Hedge h)
const
1279 if (myVertexAttrRefMap && myVertexWranglingEnabled)
1288 if (myVertexAttrRefMap && myVertexWranglingEnabled)
1296 if (myPointAttrRefMap && myPointWranglingEnabled)
1305 if (myPointAttrRefMap && myPointWranglingEnabled)
1313 if (myPrimitiveAttrRefMap && myPrimitiveWranglingEnabled)
1322 if (myPrimitiveAttrRefMap && myPrimitiveWranglingEnabled)
1334 if (index_cache(v0) < 0 || index_cache(v1) < 0)
1345 index_cache(v) = i++;
1347 }
while (v != v_first);
1350 UT_ASSERT_P(index_cache(v0) >= 0 && index_cache(v1) >= 0);
1351 return index_cache(v0) < index_cache(v1);
SYS_FORCE_INLINE GEO_Hedge lnext(GEO_Hedge h) const
Quad-Edge/GQ alias for nextPrimitiveHedge().
GEO_Hedge firstOutgoingHedge(T &iface, GA_Offset point)
SYS_FORCE_INLINE GEO_Hedge nextPrimitiveHedge(T &iface, GEO_Hedge e)
SYS_FORCE_INLINE GA_Offset dstVertex(GEO_Hedge h) const
Returns the destination vertex of the hedge.
SYS_FORCE_INLINE GA_Offset preSrcPoint(GEO_Hedge h) const
Definition of a geometry attribute.
SYS_FORCE_INLINE GEO_Hedge firstManifoldIncomingHedge(GEO_Hedge h) const
Manifold Scan Methods:
SYS_FORCE_INLINE GEO_Hedge prevPrimitiveHedge(GEO_Hedge h) const
GEO_Hedge firstManifoldIncomingHedge(T &iface, GEO_Hedge e)
SYS_FORCE_INLINE bool areOpposite(T &iface, GEO_Hedge e1, GEO_Hedge e2)
SYS_FORCE_INLINE GEO_Hedge onext(GEO_Hedge h) const
Alias for nextManifoldOutgoingHedge, equivalent to sym(lprev()).
SYS_FORCE_INLINE bool isManifoldHedge(T &iface, GEO_Hedge e, bool accept_bd)
SYS_FORCE_INLINE GA_Primitive * getPrimitive(GA_Offset prim_off)
SYS_FORCE_INLINE GEO_Hedge dfirst(GEO_Hedge h) const
Quad-Edge/GQ alias:
FilteredRange< PrimaryHedgeFilter, GEO_Hedge > PrimaryHedgeRange
PolyFilter(const GEO_PolyInterface &pi)
SYS_FORCE_INLINE GEO_Hedge primaryEquivalentHedge(GEO_Hedge h) const
Returns the primary hedge equivalent to the argument hedge.
SYS_FORCE_INLINE GEO_Hedge prevManifoldOutgoingHedge(GEO_Hedge h) const
Returns the previous hedge with the same src as h in a counterclockwise.
SYS_FORCE_INLINE GA_Offset preSrcPoint(T &iface, GEO_Hedge e)
void resetPointWrangling()
Clear the list of wrangled point/vertex/primitive attributes.
Iteration over a range of elements.
SYS_FORCE_INLINE GEO_Hedge nextEquivalentHedge(GEO_Hedge h) const
GEO_Hedge firstManifoldOutgoingHedge(T &iface, GEO_Hedge e)
SYS_FORCE_INLINE GA_Offset getLink(GA_Offset ai) const
SYS_FORCE_INLINE bool isPrimary(GEO_Hedge h) const
Cycle< PolyCirculator, GEO_Hedge > PolyCycle
SYS_FORCE_INLINE bool isValidHedgeSrcVertex(GA_Offset vtx) const
SYS_FORCE_INLINE GEO_Hedge dprev(GEO_Hedge h) const
Quad-Edge/GQ alias:
SYS_FORCE_INLINE GEO_Hedge dnext(GEO_Hedge h) const
Quad-Edge/GQ alias:
bool GAisValid(GA_Size v)
GA_Size numIncidentHedges(T &iface, GA_Offset point)
bool operator()(GA_Offset off) const
void dumpHedge(GEO_Hedge h)
SYS_FORCE_INLINE GA_Offset srcVertex(GEO_Hedge h) const
Returns the source vertex of the hedge.
SYS_FORCE_INLINE GA_Offset polyNext(GA_Offset v) const
GEO_Hedge nextIncomingHedge(T &iface, GEO_Hedge e)
SYS_FORCE_INLINE bool isBoundaryHedge(T &iface, GEO_Hedge e)
GA_Offset srcVertex(GEO_Hedge)
GA_Offset operator()(GA_Offset off) const
void lerpValue(GA_AttributeOwner downer, GA_Offset dest, GA_AttributeOwner owner, GA_Offset s0, GA_Offset s1, fpreal t) const
SYS_FORCE_INLINE GA_Offset srcPoint(const GA_Detail *gdp, GEO_Hedge e)
SYS_FORCE_INLINE GA_Offset dstPoint(GEO_Hedge h) const
Returns the point to which the destination vertex is wired.
SYS_FORCE_INLINE GEO_Hedge firstIncidentEdge(GA_Offset p) const
GEO_Hedge nextManifoldOutgoingHedge(T &iface, GEO_Hedge e)
#define GEO_INVALID_HEDGE
An invalid hedge is sometimes returned if an operation is unsuccessful.
GEO_Hedge nextIncidentEdge(T &iface, GEO_Hedge e, GA_Offset point)
Iterator(const FILTER &f)
bool operator()(GA_Offset off) const
exint GA_Size
Defines the bit width for index and offset types in GA.
FilteredRange< PolyFilter, GA_Offset > PolyRange
void enablePointWrangling(bool enable)
GEO_Hedge nextManifoldIncomingHedge(T &iface, GEO_Hedge e)
#define GA_INVALID_OFFSET
SYS_FORCE_INLINE GEO_Hedge nextOutgoingHedge(GEO_Hedge h) const
A range of elements in an index-map.
PolyCirculator(const GEO_PolyInterface &pi)
SYS_FORCE_INLINE GA_Offset dstVertex(T &iface, GEO_Hedge e)
SYS_FORCE_INLINE GA_Offset prevPrimVertex(GA_Offset v) const
SYS_FORCE_INLINE GA_Offset nextPrimVertex(GA_Offset v) const
SYS_FORCE_INLINE GEO_Hedge nextIncomingHedge(GEO_Hedge h) const
SYS_FORCE_INLINE GA_Primitive * hedgePrimitive(GEO_Hedge h) const
Return the polygon to which the hedge belongs.
SYS_FORCE_INLINE GEO_Hedge oprev(GEO_Hedge h) const
Alias for prevManifoldOutgoingHedge, equivalent to lnext(sym()).
GEO_Hedge firstIncomingHedge(T &iface, GA_Offset point)
GEO_Hedge firstIncidentEdge(T &iface, GA_Offset point)
SYS_FORCE_INLINE GA_Offset postDstVertex(T &iface, GEO_Hedge e)
SYS_FORCE_INLINE bool isBoundaryHedge(GEO_Hedge h) const
unsigned long long uint64
SYS_FORCE_INLINE GEO_Hedge findHedgeWithEndpoints(GA_Offset p0, GA_Offset p1) const
Find a hedge with the given endpoints or return GEO_INVLAID_HEDGE.
SYS_FORCE_INLINE GA_Offset postDstPoint(T &iface, GEO_Hedge e)
SYS_FORCE_INLINE GEO_Hedge ofirst(GEO_Hedge h) const
Quad-Edge/GQ alias:
SYS_FORCE_INLINE bool areEquivalent(GEO_Hedge h1, GEO_Hedge h2) const
Returns true if h1 and h2 are equivalent hedges.
GEO_Hedge encapsulates a half-edge (hedge) which is the restriction of.
SYS_FORCE_INLINE GEO_Hedge lprev(GEO_Hedge h) const
Quad-Edge/GQ alias for prevPrimitiveHedge().
SYS_FORCE_INLINE bool isValidPoly(GA_Offset poly) const
SYS_FORCE_INLINE bool isValid(GEO_Hedge h) const
SYS_FORCE_INLINE GEO_Hedge primary(GEO_Hedge h) const
Alias for primaryEquivalentHedge().
SYS_FORCE_INLINE RawLinkType clearLinkFlag(RawLinkType i)
SYS_FORCE_INLINE bool isManifoldHedge(GEO_Hedge h, bool accept_bd=false) const
SYS_FORCE_INLINE GA_Offset srcPoint(GEO_Hedge h) const
Returns the point to which the source vertex is wired.
SYS_FORCE_INLINE GA_Offset preSrcVertex(T &iface, GEO_Hedge e)
SYS_FORCE_INLINE bool areOpposite(GEO_Hedge h1, GEO_Hedge h2) const
A handle to simplify manipulation of multiple attributes.
SYS_FORCE_INLINE void getAdjacentPrimVertices(GA_Offset v, GA_Offset &vprev, GA_Offset &vnext) const
SYS_FORCE_INLINE GEO_Hedge firstManifoldOutgoingHedge(GEO_Hedge h) const
GA_Detail * getDetail() const
void resetVertexWrangling()
GEO_Hedge prevManifoldOutgoingHedge(T &iface, GEO_Hedge e)
SYS_FORCE_INLINE GA_Offset postDstVertex(GEO_Hedge h) const
Returns the vertex succeeding the destination of the hedge.
SYS_FORCE_INLINE bool getLinkFlag(RawLinkType i)
GLboolean GLboolean GLboolean b
GEO_Hedge prevManifoldIncomingHedge(T &iface, GEO_Hedge e)
bool operator!=(const Iterator &other)
void enablePrimitiveWrangling(bool enable)
bool operator()(GA_Offset off) const
SYS_FORCE_INLINE GA_Size numEquivalentHedges(GEO_Hedge h) const
Returns the number of hedges in the equivalence class of h.
SYS_FORCE_INLINE GA_Offset dstPoint(T &iface, GEO_Hedge e)
SYS_FORCE_INLINE const GA_Primitive * hedgePrimitive(const GA_Detail *gdp, GEO_Hedge e)
SYS_FORCE_INLINE RawLinkType setLinkFlag(RawLinkType i)
SYS_FORCE_INLINE GEO_Hedge firstOutgoingHedge(GA_Offset p) const
SYS_FORCE_INLINE bool isValidHedge(GEO_Hedge h) const
ITERTYPE operator*() const
SYS_FORCE_INLINE GA_Offset preSrcVertex(GEO_Hedge h) const
Returns the vertex preceding the source of the hedge in its polygon.
Cycle(const CIRCULATOR &f, GA_Offset base)
void resetPrimitiveWrangling()
GLfloat GLfloat GLfloat GLfloat h
SYS_FORCE_INLINE GA_Offset vertexPrimitive(GA_Offset vertex) const
bool operator!=(const Iterator &other)
GEO_Hedge nextOutgoingHedge(T &iface, GEO_Hedge e)
SYS_FORCE_INLINE GEO_Hedge firstIncomingHedge(GA_Offset p) const
GEO_Hedge findHedgeWithEndpoints(T &iface, GA_Offset p0, GA_Offset p1)
SYS_FORCE_INLINE GEO_Hedge otherPrimitiveHedgeAtPoint(GEO_Hedge h, GA_Offset pt) const
Returns the hedge other than the parameter hedge in its polygon that.
Iterator(const CIRCULATOR &f, GA_Offset iter)
SYS_FORCE_INLINE bool areEquivalent(T &iface, GEO_Hedge e1, GEO_Hedge e2)
Iterator(const FILTER &f, const GA_Range &r)
SYS_FORCE_INLINE GA_Size numIncidentHedges(GA_Offset pt) const
Returns the number of distinct hedges incident to pt.
SYS_FORCE_INLINE GEO_Hedge prevManifoldIncomingHedge(GEO_Hedge h) const
FilteredRange< HedgeFilter, GEO_Hedge > HedgeRange
HedgeFilter(const GEO_PolyInterface &pi)
SYS_FORCE_INLINE GA_Offset polyFirst(GA_Offset poly) const
PolyCycle polyHedges(GA_Offset poly) const
Returns the hedges around a polygon as a PolyCycle.
SYS_FORCE_INLINE GEO_Hedge otherPrimitiveHedgeAtPoint(T &iface, GEO_Hedge e, GA_Offset point)
GA_Offset hedgePoly(GEO_Hedge h) const
SYS_FORCE_INLINE GEO_Hedge nextIncidentEdge(GEO_Hedge h, GA_Offset p) const
GEO_Hedge nextIncidentHedge(T &iface, GEO_Hedge e, GA_Offset pt)
Container class for all geometry.
GLubyte GLubyte GLubyte GLubyte w
GEO_Hedge firstIncidentHedge(T &iface, GA_Offset pt)
SYS_FORCE_INLINE GEO_Hedge nextManifoldIncomingHedge(GEO_Hedge h) const
SYS_FORCE_INLINE GEO_Hedge prevPrimitiveHedge(T &iface, GEO_Hedge e)
SYS_FORCE_INLINE bool isBridgeHedge(GEO_Hedge h) const
SYS_FORCE_INLINE GEO_Hedge nextIncidentHedge(GEO_Hedge h, GA_Offset p) const
SYS_FORCE_INLINE GEO_Hedge nextManifoldOutgoingHedge(GEO_Hedge h) const
GEO_Hedge polyHedge(GA_Offset poly) const
GA_Size numIncidentEdges(T &iface, GA_Offset point)
SYS_FORCE_INLINE GA_Size numEquivalentHedges(T &iface, GEO_Hedge e)
SYS_FORCE_INLINE GEO_Hedge sym(GEO_Hedge h) const
Quad-Edge/GQ alias for nextEquivalentHedge().
SYS_FORCE_INLINE GEO_Hedge firstIncidentHedge(GA_Offset p) const
void copyValue(GA_AttributeOwner downer, GA_Offset doffset, GA_AttributeOwner sowner, GA_Offset soffset) const
Automatically expand attribute data pages for threading.
bool isBridgeHedge(T &iface, GEO_Hedge e)
ITERTYPE operator*() const
void enableVertexWrangling(bool enable)
PrimaryHedgeFilter(const GEO_PolyInterface &pi)
FilteredRange(const FILTER &f, const GA_Range &r)
SYS_FORCE_INLINE GA_Offset polyPrev(GA_Offset v) const
SYS_FORCE_INLINE GA_Size numIncidentEdges(GA_Offset pt) const
SYS_FORCE_INLINE GA_Offset postDstPoint(GEO_Hedge h) const
SYS_FORCE_INLINE GEO_Hedge nextPrimitiveHedge(GEO_Hedge h) const
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
SYS_FORCE_INLINE void setLink(GA_Offset ai, GA_Offset v)