13 #ifndef __GU_PathFinder__
14 #define __GU_PathFinder__
83 template <
class T = gu_ShortestPathCost>
97 mySHedge(sh), myPrev(prev) { myPathCost.zero(); }
100 mySHedge(sh), myPrev(prev), myPathCost(cost) { }
103 {
return (p1.myPathCost > p2.myPathCost); }
141 void setStartHedge(
const GU_PathHedge& sh,
bool and_equiv =
true);
142 void setEndHedge(
const GU_PathHedge& eh,
bool and_equiv =
true);
151 bool and_reverse =
false);
153 bool and_reverse =
false);
175 void clearStartSHedges();
177 bool and_reverse =
false);
179 void clearEndSHedges();
180 void addEndSHedge(
const GU_PathSHedge& sh,
bool and_reverse =
false);
196 { myAvoidPoints = grp; }
200 { myAvoidEdges = grp; }
204 { myAvoidPrimitives = grp; }
208 { myAvoidVertices = grp; }
219 if (edgegrp && edgegrp->
entries())
222 if (vtxgrp && vtxgrp->
entries())
223 avoidVertices(vtxgrp);
225 if (primgrp && primgrp->
entries())
226 avoidPrimitives(primgrp);
231 avoidPoints(
nullptr);
233 avoidPrimitives(
nullptr);
234 avoidVertices(
nullptr);
239 myCollisionPoints =
nullptr;
240 myCollisionPrimitives =
nullptr;
241 myCollisionVertices =
nullptr;
242 myCollisionEdges =
nullptr;
243 myCollisionGroup =
group;
244 myExcludeCollisionGroup = exclude;
245 myCollisionStrong = strong;
271 void reset(
bool heap_only =
false);
275 {
return myStartSHedges; }
288 bool trim_crossing =
true);
293 bool trim_crossing =
true,
294 bool is_for_prim_loo =
false);
312 void initializeEdgeHeap();
323 {
return myDhip->isValidHedge(getPrev(sh).hedge()); }
365 {
return pt == myDhip->srcPoint(h) ? 1 : -1; }
370 {
return GA_Edge(myDhip->srcPoint(h),
371 myDhip->dstPoint(h)); }
404 bool myLastStartSHedgeFlag =
false;
407 bool myLastStartHedgeFlag =
false;
409 bool myStartOnBoundary =
false;
410 bool myEndOnBoundary =
false;
428 const GA_Group * myCollisionGroup =
nullptr;
432 bool myExcludeCollisionGroup =
true;
436 bool myCollisionStrong =
false;
438 SuccessorMask mySuccessorTypeMask;
455 void zero() { myLength = 0.0; }
461 bool isSet() {
return myLength > -0.5; }
465 {
return myLength > c.myLength; }
474 myLength += c.myLength;
502 myPathLength(dhip->
length(sh.hedge())) { }
505 myPathLength(len), myPenalty(bends) { }
508 myPathLength(c.myPathLength),
509 myPenalty(c.myPenalty) { }
519 void unset() { myPathLength = -1.0; }
522 bool isSet() {
return myPathLength > -0.5; }
527 if (myPenalty != c.myPenalty)
528 return myPenalty > c.myPenalty;
530 return myPathLength > c.myPathLength;
539 myPenalty += c.myPenalty;
540 myPathLength += c.myPathLength;
558 if (!sided_quad_succ.
isValid())
565 bool to_sided_quad_succ = (sided_quad_succ.
isValid() &&
568 bool to_opposite = opposite.
isValid() &&
571 if (to_sided_quad_succ)
584 fpreal myPathLength = -1.0;
597 myPathLength(dhip->
length(sh.hedge())) { }
600 myPathLength(len), myPenalty(bends) { }
613 void unset() { myPathLength = -1.0; }
616 bool isSet() {
return myPathLength > -0.5; }
621 if (myPenalty != c.myPenalty)
622 return myPenalty > c.myPenalty;
624 return myPathLength > c.myPathLength;
633 myPenalty += c.myPenalty;
634 myPathLength += c.myPathLength;
648 bool to_bd_succ = bd_succ.
isValid() &&
655 if (!sided_quad_succ.
isValid())
662 bool to_sided_quad_succ = (sided_quad_succ.
isValid() &&
665 bool to_opposite = opposite.
isValid() &&
668 if (to_sided_quad_succ)
681 fpreal myPathLength = -1.0;
693 if (myDhip->isHedgeValidPolygon(sh.
hedge()))
696 myPolyPosMarked.setBitFast(sh.
hedge().
v0(),
true);
698 myPolyNegMarked.setBitFast(sh.
hedge().
v0(),
true);
703 myPosMarked.insert(sh.
hedge());
705 myNegMarked.insert(sh.
hedge());
713 if (myDhip->isHedgeValidPolygon(sh.
hedge()))
716 return myPolyPosMarked.getBitFast(sh.
hedge().
v0());
718 return myPolyNegMarked.getBitFast(sh.
hedge().
v0());
723 return myPosMarked.contains(sh.
hedge());
725 return myNegMarked.contains(sh.
hedge());
735 if (myDhip->isHedgeValidPolygon(sh.
hedge()))
739 myPolyPosCost[sh.
hedge().
v0()] = cost;
740 myPolyPosPrev[sh.
hedge().
v0()] = prev_sh;
744 myPolyNegCost[sh.
hedge().
v0()] = cost;
745 myPolyNegPrev[sh.
hedge().
v0()] = prev_sh;
752 myPosCost[sh.
hedge()] = cost;
753 myPosPrev[sh.
hedge()] = prev_sh;
757 myNegCost[sh.
hedge()] = cost;
758 myNegPrev[sh.
hedge()] = prev_sh;
767 if (myDhip->isHedgeValidPolygon(sh.
hedge()))
770 return myPolyPosCost[sh.
hedge().
v0()];
772 return myPolyNegCost[sh.
hedge().
v0()];
777 return myPosCost[sh.
hedge()];
779 return myNegCost[sh.
hedge()];
788 if (myDhip->isHedgeValidPolygon(sh.
hedge()))
791 return myPolyPosPrev[sh.
hedge().
v0()];
793 return myPolyNegPrev[sh.
hedge().
v0()];
798 return myPosPrev[sh.
hedge()];
800 return myNegPrev[sh.
hedge()];
831 bool backward =
false,
832 bool no_self_intersection =
false,
833 bool include_ends =
false,
838 const GA_Group * collision_group =
nullptr,
839 bool exclude_collision =
true,
840 bool strong_rule =
true);
846 bool backward =
false,
847 bool no_self_intersection =
false,
848 bool include_ends =
false,
853 const GA_Group * collision_group =
nullptr,
854 bool exclude_collision =
true,
855 bool strong_rule =
true);
GU_WalkEndReason GU_API guDualEdgeWalk(GU_PathHedge::Interface *dhip, const GA_ROHandleV2 &uvh, GU_SHedgeArray &path, GU_SHedgeArray &walk, bool backward=false, bool no_self_intersection=false, bool include_ends=false, const GA_PrimitiveGroup *avoid_prims=nullptr, const GA_PointGroup *avoid_points=nullptr, const GA_VertexGroup *avoid_vtx=nullptr, const GA_EdgeGroup *avoid_edges=nullptr, const GA_Group *collision_group=nullptr, bool exclude_collision=true, bool strong_rule=true)
GA_Size entries() const override
Returns the number of edges in this group.
SYS_FORCE_INLINE void unset()
SYS_FORCE_INLINE GA_Offset srcPoint(const GA_Detail *gdp, GEO_Hedge h)
SYS_FORCE_INLINE bool isPositive() const
void avoidGroups(GA_PointGroup *ptgrp, GA_EdgeGroup *edgegrp, GA_VertexGroup *vtxgrp, GA_PrimitiveGroup *primgrp)
Definition of a geometry attribute.
const GU_SHedgeArray & getStartSHedges() const
SYS_FORCE_INLINE gu_ShortestPathCost & operator=(const gu_ShortestPathCost &c)=default
void avoidPoints(GA_PointGroup *grp)
GU_WalkEndReason GU_API guEdgeWalk(GU_PathHedge::Interface *dhip, const GA_ROHandleV2 &uvh, GU_SHedgeArray &path, GU_SHedgeArray &walk, bool backward=false, bool no_self_intersection=false, bool include_ends=false, const GA_PrimitiveGroup *avoid_prims=nullptr, const GA_PointGroup *avoid_points=nullptr, const GA_VertexGroup *avoid_vtx=nullptr, const GA_EdgeGroup *avoid_edges=nullptr, const GA_Group *collision_group=nullptr, bool exclude_collision=true, bool strong_rule=true)
SYS_FORCE_INLINE fpreal length(const GU_PathHedge &h) const
GU_PathSHedge operator()(int i) const
GA_Size entries() const overridefinal
Will return the number of primary elements.
SYS_FORCE_INLINE const gu_EdgeLoopCost & operator+=(const gu_EdgeLoopCost &c)
SYS_FORCE_INLINE void unset()
GLsizei const GLchar *const * path
SYS_FORCE_INLINE fpreal getLength()
gu_EdgeLoopCost & operator=(const gu_EdgeLoopCost &c)=default
SYS_FORCE_INLINE fpreal getLength()
SYS_FORCE_INLINE bool isNegative() const
PathEdge(GU_PathSHedge sh, GU_PathSHedge prev=GU_PathSHedge())
SYS_FORCE_INLINE bool areEquivalent(const GU_PathHedge &h1, const GU_PathHedge &h2)
SYS_FORCE_INLINE const GU_PathHedge & hedge() const
GA_EdgeT< GA_Offset, false > GA_Edge
gu_EdgeRingCost(const GU_PathSHedge &sh, GU_PathHedge::Interface *dhip)
SYS_FORCE_INLINE void zero()
PathEdge(GU_PathSHedge sh, GU_PathSHedge prev, const T &cost)
#define GA_INVALID_OFFSET
SYS_FORCE_INLINE T & getBestCost(const GU_PathSHedge &sh)
SYS_FORCE_INLINE bool isSet()
GU_PathSHedge getSHedge()
SYS_FORCE_INLINE bool isValid() const
gu_ShortestPathCost(const GU_PathSHedge &sh, GU_PathHedge::Interface *dhip)
GU_PathFinder< gu_EdgeRingCost > GU_EdgeRingFinder
gu_EdgeLoopCost(const gu_EdgeLoopCost &c)
GU_PathFinder< gu_EdgeLoopCost > GU_EdgeLoopFinder
gu_ShortestPathCost(fpreal l)
SYS_FORCE_INLINE fpreal getLength()
SYS_FORCE_INLINE bool isSet()
SYS_FORCE_INLINE const gu_ShortestPathCost & operator+=(const gu_ShortestPathCost &c)
void avoidPrimitives(GA_PrimitiveGroup *grp)
gu_EdgeRingCost & operator=(const gu_EdgeRingCost &c)=default
GA_GroupType classType() const
SYS_FORCE_INLINE bool operator>(const gu_EdgeLoopCost &c) const
void avoidVertices(GA_VertexGroup *grp)
gu_EdgeLoopCost()=default
static SYS_FORCE_INLINE gu_ShortestPathCost turnCost(GU_PathHedge::Interface *dhip, const GU_PathSHedge &from_sh, const GU_PathSHedge &to_sh, const GU_EdgeSuccessor &exits)
SYS_FORCE_INLINE void unset()
GLuint GLsizei GLsizei * length
bool operator()(PathEdge &p1, PathEdge &p2) const
GLfloat GLfloat GLfloat GLfloat h
SYS_FORCE_INLINE bool operator>(const gu_EdgeRingCost &c) const
SYS_FORCE_INLINE bool isSet()
gu_EdgeLoopCost(fpreal len, int bends)
SYS_FORCE_INLINE bool operator>(const gu_ShortestPathCost &c) const
static SYS_FORCE_INLINE gu_EdgeRingCost turnCost(GU_PathHedge::Interface *dhip, const GU_PathSHedge &from_sh, const GU_PathSHedge &to_sh, const GU_EdgeSuccessor &successors)
gu_EdgeRingCost()=default
SYS_FORCE_INLINE void zero()
gu_EdgeRingCost(fpreal len, int bends)
Container class for all geometry.
gu_ShortestPathCost()=default
void avoidEdges(GA_EdgeGroup *grp)
const GEO_DetachedHedgeInterface HedgeInterface
void setCollisionGroup(const GA_Group *group, bool exclude, bool strong)
SYS_FORCE_INLINE void zero()
SYS_FORCE_INLINE GA_Offset v0() const
SYS_FORCE_INLINE const gu_EdgeRingCost & operator+=(const gu_EdgeRingCost &c)
gu_EdgeLoopCost(const GU_PathSHedge &sh, GU_PathHedge::Interface *dhip)
static Mask typeMask(Type t)
static SYS_FORCE_INLINE gu_EdgeLoopCost turnCost(GU_PathHedge::Interface *dhip, const GU_PathSHedge &from_sh, const GU_PathSHedge &to_sh, const GU_EdgeSuccessor &successors)
SYS_FORCE_INLINE GA_Offset dstPoint(T &iface, GEO_Hedge h)
GU_PathSHedge & operator()(int i)