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


Python LinkedList.toList方法代碼示例

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


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

示例1: extendWithIntersectionPoints

# 需要導入模塊: from LinkedList import LinkedList [as 別名]
# 或者: from LinkedList.LinkedList import toList [as 別名]
    def extendWithIntersectionPoints(self, other):
        """
        Update current points list,
        extended with intersection points
        """
        debugResult = []
        first = True
        result = []

        linkedPoints = LinkedList()
        linkedPoints.load(self.points)
        linkedOtherPoints = LinkedList()
        linkedOtherPoints.load((other.points))

        node = linkedPoints[0]
        while node.hasNext():
            candidates = []
            if first:
                candidates.append(node.data)
                first = False
            nextNode = node.next
            seg = (node.data, nextNode.data)

            otherNode = linkedOtherPoints[0]
            while otherNode.hasNext():
                nextOtherNode = otherNode.next
                otherSeg = (otherNode.data, nextOtherNode.data)

                intersection, info = segmentIntersection(seg, otherSeg)
                kind = None
                if intersection:
                    kind = Kind.incoming if info['sign'] < 0 else Kind.outgoing
                    tpl = (intersection, kind)
                    #print("seg, otherseg, tpl: ",seg, otherSeg, tpl)

                    #node.insertAfter((intersection, kind))
                    #otherNode.insertAfter((intersection, kind))
                    candidates.append(tpl)
                    #print("{} : {}  x  {}".format(info['sign'], seg, otherSeg))
                #this is for debugging
                debugResult.append((intersection, seg, otherSeg, kind))
                #print("{0} :: {1} :: {2}".format(intersection, seg, otherSeg))
                otherNode = otherNode.next  # !!!!
            node = node.next  # !!!

            sorted = lolsort(candidates, node.data)
            result += sorted

            result.append(node.data)

        GlobalQueue.queue.insert(debugResult)

        return filterDuplicates(result)

        return result
        return linkedPoints.toList(), linkedOtherPoints.toList()
開發者ID:Rast1234,項目名稱:graphics,代碼行數:58,代碼來源:Clipping.py


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