本文整理汇总了Python中matplotlib.path.Path.contains_path方法的典型用法代码示例。如果您正苦于以下问题:Python Path.contains_path方法的具体用法?Python Path.contains_path怎么用?Python Path.contains_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.path.Path
的用法示例。
在下文中一共展示了Path.contains_path方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _filter_block
# 需要导入模块: from matplotlib.path import Path [as 别名]
# 或者: from matplotlib.path.Path import contains_path [as 别名]
def _filter_block(vertices, block_origin, block_shape):
"""
Keyword arguments:
vertices --
block_origin_list --
block_shape --
Return values
-- True/False vertices contain block
"""
# check arguments
# create path object
path = Path(vertices, closed=True)
# create path for the block
x0 = block_origin[0]
y0 = block_origin[1]
w = block_shape[0]
h = block_shape[1]
box_vertices = np.asarray([[x0, y0], [x0 + w, y0], [x0 + w, y0 + h], [x0, y0 + h]])
box = Path(box_vertices, closed=True)
# determine if points inside the specified path
# Note: there appears to be an error in contains_points(). For
# example, reversing the direction of the vertices requires raidus=-0.01
# to be specified. See the e-mails in the link below
# http://matplotlib.1069221.n5.nabble.com/How-to-properly-use-path-Path-contains-point-tc40718.html#none
return path.contains_path(box)
示例2: check_paths
# 需要导入模块: from matplotlib.path import Path [as 别名]
# 或者: from matplotlib.path.Path import contains_path [as 别名]
def check_paths(path):
for other_path in a:
res = 'no cross'
chck = Path(other_path)
if chck.contains_path(path) == 1:
res = 'cross'
break
return res