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


Python Path.intersects_bbox方法代码示例

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


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

示例1: evaluate

# 需要导入模块: from matplotlib.path import Path [as 别名]
# 或者: from matplotlib.path.Path import intersects_bbox [as 别名]
def evaluate(param, old):
    #print waypoints[-1]
    #if sqrt(pow(param[0] - old[0], 2) + pow(param[1] - old[1], 2)) > max_distance:
    #    return 900
    
    verts = [(old[0], old[1]),
              (param[0], param[1]),]
    
    path = Path(verts, codes)
    
    for obstacle in obstacles:
        if sqrt(pow(param[0] - obstacle.get_xy()[0], 2) + pow(param[1] - obstacle.get_xy()[1], 2)) < 10:
            if path.intersects_bbox(obstacle.get_bbox()):
                return 900

        
    return sqrt(pow(param[0] - 10, 2) + pow(param[1] - 10, 2))
开发者ID:danieka,项目名称:pso-with-waypoints,代码行数:19,代码来源:apso.py

示例2: Rectangle

# 需要导入模块: from matplotlib.path import Path [as 别名]
# 或者: from matplotlib.path.Path import intersects_bbox [as 别名]
from pylab import *
import numpy as np
from matplotlib.transforms import Bbox
from matplotlib.path import Path
from matplotlib.patches import Rectangle

rect = Rectangle((-1, -1), 2, 2, facecolor="#aaaaaa")
gca().add_patch(rect)
bbox = Bbox.from_bounds(-1, -1, 2, 2)

for i in range(12):
    vertices = (np.random.random((4, 2)) - 0.5) * 6.0
    vertices = np.ma.masked_array(vertices, [[False, False], [True, True], [False, False], [False, False]])
    path = Path(vertices)
    if path.intersects_bbox(bbox):
        color = 'r'
    else:
        color = 'b'
    plot(vertices[:,0], vertices[:,1], color=color)

show()
开发者ID:AlexSzatmary,项目名称:matplotlib,代码行数:23,代码来源:bbox_intersect.py

示例3: print

# 需要导入模块: from matplotlib.path import Path [as 别名]
# 或者: from matplotlib.path.Path import intersects_bbox [as 别名]
        sb = points[0][0]
        eb = points[1][1]
        print (nb, wb, sb, eb)
        #Size of the tasks, into how many rows and columns should the area be divided.
        task_cols = 40
        task_rows = 30
        ns_step = (sb - nb) / task_cols
        we_step = (eb - wb) / task_rows
        task_counter = 0
        for row in range(task_rows):
            wbr = wb + row * we_step
            ebr = wb + (row + 1) * we_step
            for col in range(task_cols):
                nbc = nb + col * ns_step
                sbc = nb + (col + 1) * ns_step
                if islandPolygon.intersects_bbox(Bbox([[nbc, wbr], [sbc, ebr]])):
                    boundary = 0.01
                    task_info = dict(question=app_config['question'], n_answers=int(args.number_answers),
                                     westbound=wbr, eastbound=ebr, northbound=nbc, southbound=sbc,
                                     westmapbound=wbr - boundary, eastmapbound=ebr + boundary,
                                     northmapbound=nbc + boundary, southmapbound=sbc - boundary,
                                     location=str(row) + "_" + str(col), batch=args.batch)
                    response = pbclient.create_task(app_id, task_info)
                    check_api_error(response)
                    task_counter += 1
                    print(task_counter)

    if args.update_template:
        print "Updating app template"
        try:
            response = pbclient.find_app(short_name=app_config['short_name'])
开发者ID:teleyinex,项目名称:app-rural-geolocator,代码行数:33,代码来源:createTasks.py


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