当前位置: 首页>>代码示例>>Python>>正文


Python GeoMath.sameEdge方法代码示例

本文整理汇总了Python中lib.GeoMath.sameEdge方法的典型用法代码示例。如果您正苦于以下问题:Python GeoMath.sameEdge方法的具体用法?Python GeoMath.sameEdge怎么用?Python GeoMath.sameEdge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lib.GeoMath的用法示例。


在下文中一共展示了GeoMath.sameEdge方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getPrimsSharingGroupOfEdges

# 需要导入模块: from lib import GeoMath [as 别名]
# 或者: from lib.GeoMath import sameEdge [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.sameEdge方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。