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


Python LinkedList.setEndless方法代碼示例

本文整理匯總了Python中LinkedList.LinkedList.setEndless方法的典型用法代碼示例。如果您正苦於以下問題:Python LinkedList.setEndless方法的具體用法?Python LinkedList.setEndless怎麽用?Python LinkedList.setEndless使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在LinkedList.LinkedList的用法示例。


在下文中一共展示了LinkedList.setEndless方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __sub__

# 需要導入模塊: from LinkedList import LinkedList [as 別名]
# 或者: from LinkedList.LinkedList import setEndless [as 別名]
    def __sub__(self, other):
        """
        Subtraction of polygons
        """
        sequence = []

        # get raw points lists without duplication first-last
        points = [dict([["point",p], ["kind",k], ["visited", False]]) for p, k in self.points[:-1]]
        otherPoints = [dict([["point",p], ["kind",k], ["visited", False]]) for p, k in other.points[:-1]]


        tmp = [BravePoint(p,k) for p, k in self.points[:-1]]
        tmp2 = [BravePoint(p,k) for p, k in other.points[:-1]]
        tmp2.reverse()  # useful
        points = LinkedList()
        points.load(tmp)
        points.setEndless(True)

        otherPoints = LinkedList()
        otherPoints.load(tmp2)
        otherPoints.setEndless(True)

        #pprint(tmp)
        #pprint(tmp2)
        p = points.first
        firstStep = True
        while p is not points.first or firstStep:
            firstStep = False
            d = p.data
            if d.kind != Kind.outgoing or d.visited:
                p = p.next
                continue
            # brave new polygon!
            newbies = getPointsUntilExit(points, otherPoints, p.data)
            #print("newbies= ", newbies)
            sequence.append(newbies)
        #print "sequence= ", sequence

        points.setEndless(False)
        otherPoints.setEndless(False)
        #pprint({'points': points.toList(), 'otherPoints': otherPoints.toList()})

        result = []
        for lol in sequence:
            tmp = [bp.point for bp in lol]
            kinds = [Kind.neutral]*len(tmp)
            poly = Poly(points=zip(tmp, kinds))
            result.append(poly)
        return result
開發者ID:Rast1234,項目名稱:graphics,代碼行數:51,代碼來源:Clipping.py


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