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


Python Path.isConnected方法代码示例

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


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

示例1: testValid

# 需要导入模块: from Path import Path [as 别名]
# 或者: from Path.Path import isConnected [as 别名]
 def testValid(self):
     validPath = Path()
     validPath.addPoint(self.p0)
     validPath.addPoint(self.p1)
     validPath.addPoint(self.p2)
     validPath.addPoint(self.p0)
     self.assertTrue(validPath.isConnected())
开发者ID:thomaschrstnsn,项目名称:fortifiedforest,代码行数:9,代码来源:test_Path.py

示例2: jarviswalk

# 需要导入模块: from Path import Path [as 别名]
# 或者: from Path.Path import isConnected [as 别名]
def jarviswalk(points):
    """Implementation of Jarvis Walk aka Gift wrapping algorithm.
    Based on the article http://en.wikipedia.org/wiki/Gift_wrapping_algorithm
    """
    hull = Path()
    xsorted = sorted(points, key=lambda point: point.x)
    hull.addPoint(xsorted[0])
    while True:
        nextP = None
        maxLinearPoint = None
        maxLinearDistance = -1.0
        possiblePoints = filter(lambda p: p not in hull.points[1:], xsorted) 
        for p in possiblePoints:
            if p is hull.points[-1]: continue
            line = Line(hull.points[-1], p)
            allright, localMaxLinear, localMaxLinearDistance = allrightAndMaxLinearPoint(line, xsorted)
            if allright:
                nextP = p
                break
            if localMaxLinear is not None and localMaxLinearDistance != -1.0 and localMaxLinearDistance > maxLinearDistance:
                maxLinearPoint, maxLinearDistance = (localMaxLinear, localMaxLinearDistance)
        assert(nextP is not None or (maxLinearPoint is not None and maxLinearDistance > 0.0))
        if nextP is not None:
            hull.addPoint(nextP)
        else:
            hull.addPoint(maxLinearPoint)
        if hull.isConnected():
            break
    return hull
开发者ID:thomaschrstnsn,项目名称:fortifiedforest,代码行数:31,代码来源:ConvexHull.py

示例3: testDisconnected

# 需要导入模块: from Path import Path [as 别名]
# 或者: from Path.Path import isConnected [as 别名]
 def testDisconnected(self):
     disconnectedPath = Path()
     disconnectedPath.addPoint(self.p0)
     disconnectedPath.addPoint(self.p1)
     disconnectedPath.addPoint(self.p2)
     self.assertFalse(disconnectedPath.isConnected())
开发者ID:thomaschrstnsn,项目名称:fortifiedforest,代码行数:8,代码来源:test_Path.py

示例4: testEmpty

# 需要导入模块: from Path import Path [as 别名]
# 或者: from Path.Path import isConnected [as 别名]
 def testEmpty(self):
     emptyPath = Path()
     self.assertFalse(emptyPath.isConnected())
     self.assertEquals(emptyPath.length(), 0)
开发者ID:thomaschrstnsn,项目名称:fortifiedforest,代码行数:6,代码来源:test_Path.py


注:本文中的Path.Path.isConnected方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。