本文整理汇总了Python中lib.GeoMath.trackEdges方法的典型用法代码示例。如果您正苦于以下问题:Python GeoMath.trackEdges方法的具体用法?Python GeoMath.trackEdges怎么用?Python GeoMath.trackEdges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.GeoMath
的用法示例。
在下文中一共展示了GeoMath.trackEdges方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getPrimsSharingGroupOfEdges
# 需要导入模块: from lib import GeoMath [as 别名]
# 或者: from lib.GeoMath import trackEdges [as 别名]
def getPrimsSharingGroupOfEdges(self, prim, setNotDestroyed, setPartiallyDestroyed, setTotDestroyed):
validPrim1 = None
validPrim2 = None
if(self.isThisPrimMaybeValid(prim)):
primsSharedInPathSet = GeoMath.getConnectedPrims(prim, self.path)
primsSharedInGeneral = GeoMath.getConnectedPrims(prim, setPartiallyDestroyed)
primsSharedInGeneral.extend(GeoMath.getConnectedPrims(prim, setNotDestroyed))
primsSharedInGeneral.extend(GeoMath.getConnectedPrims(prim, setTotDestroyed))
setOfEdgesToTrack = []
for primSharedInGeneral in primsSharedInGeneral:
setOfEdgesToTrack.extend(GeoMath.getEdgesBetweenPrims(prim, primSharedInGeneral))
excluded = []
for primSharedPath in primsSharedInPathSet:
edgesSharedWithPrim = GeoMath.getEdgesBetweenPrims(primSharedPath, prim)
excluded.extend(edgesSharedWithPrim)
# We need some first edge and last edge for track edges between this edges, excluding edges
# (included in group "excluded") in other prims that share some edge with central prim
indexPrim = self.path.index(prim)
if(indexPrim == 0):
prevIndexPrim = len(self.path) - 1
else:
prevIndexPrim = indexPrim - 1
edgesSharedWithPrim1 = GeoMath.getEdgesBetweenPrims(self.path[(indexPrim + 1) % len(self.path)], prim)
edgesSharedWithPrim2 = GeoMath.getEdgesBetweenPrims(self.path[prevIndexPrim], prim)
logging.debug("edges shared curPrim1: %s with prim: %s, edges: %s", str(self.path[(indexPrim + 1) % len(self.path)].number()), str(prim.number()), str(edgesSharedWithPrim1))
logging.debug("edges shared curPrim2: %s with prim: %s, edges: %s", str(self.path[prevIndexPrim].number()), str(prim.number()), str(edgesSharedWithPrim2))
groupEdges1, groupEdges2 = GeoMath.trackEdges(edgesSharedWithPrim1[0], setOfEdgesToTrack, edgesSharedWithPrim2[0], excluded)
# Find two good prims containing one of the group of edges
index = 0
while(index < len(primsSharedInGeneral) and not (validPrim1 and validPrim2)):
curPrim = primsSharedInGeneral[index]
conEdges = GeoMath.getEdgesBetweenPrims(curPrim, prim)
if(not validPrim1):
for edge in groupEdges1:
if(GeoMath.sameEdge(conEdges[0], edge)):
validPrim1 = curPrim
break
if (not validPrim2):
for edge in groupEdges2:
if(GeoMath.sameEdge(conEdges[0], edge)):
validPrim2 = curPrim
break
index += 1
return validPrim1, validPrim2