當前位置: 首頁>>代碼示例>>Python>>正文


Python GeoMath.trackEdges方法代碼示例

本文整理匯總了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
開發者ID:csoriano89,項目名稱:BuildingDestruction,代碼行數:48,代碼來源:ValidatePath.py


注:本文中的lib.GeoMath.trackEdges方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。