本文整理汇总了Python中polygon.Polygon.add_point方法的典型用法代码示例。如果您正苦于以下问题:Python Polygon.add_point方法的具体用法?Python Polygon.add_point怎么用?Python Polygon.add_point使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类polygon.Polygon
的用法示例。
在下文中一共展示了Polygon.add_point方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: basic_path_test
# 需要导入模块: from polygon import Polygon [as 别名]
# 或者: from polygon.Polygon import add_point [as 别名]
def basic_path_test():
poly1 = Polygon()
poly1.add_point(0, 0)
poly1.add_point(0, 1)
poly1.add_point(-1, 1)
poly1.add_point(-1, 0)
# poly2 = Polygon()
# poly2.add_point(101, 0)
# poly2.add_point(101, 1)
# poly2.add_point(100, 1)
# poly2.add_point(100, 0)
astarplanner = AStarPlanner()
astarplanner.add_polygon(poly1)
# astarplanner.add_polygon(poly2)
print astarplanner.find_path(-1, -1, 1000, 1000)
示例2: basic_intersection_test
# 需要导入模块: from polygon import Polygon [as 别名]
# 或者: from polygon.Polygon import add_point [as 别名]
def basic_intersection_test():
poly = Polygon()
poly.add_point(0, 0)
poly.add_point(0, 1)
poly.add_point(-1, 1)
poly.add_point(-1, 0)
line = [numpy.array([0, 0]), numpy.array([0, 1])]
assert(intersect_single(line, poly) == True)
line = [numpy.array([0, 1]), numpy.array([-1, 1])]
assert(intersect_single(line, poly) == True)
line = [numpy.array([-1, 1]), numpy.array([-1, 0])]
assert(intersect_single(line, poly) == True)
line = [numpy.array([-1, 0]), numpy.array([0, 0])]
assert(intersect_single(line, poly) == True)
示例3: Polygon
# 需要导入模块: from polygon import Polygon [as 别名]
# 或者: from polygon.Polygon import add_point [as 别名]
min_speed = 0.2 #tippuu tasta nollaan
increase_value = 1.1 #kiihdytys/hidastuskertoimia
lower_value = 0.98
break_value = 0.8
while True:
screen.blit(background, (0,0))
for event in pygame.event.get():
#EXIT EVENT
if event.type == QUIT:
pygame.quit()
sys.exit()
if event.type == MOUSEBUTTONDOWN:
shape.add_point(point=pygame.mouse.get_pos())
if event.type == KEYDOWN:
if event.key == K_SPACE:
shapes.append(shape)
shape = Polygon()
shape.color = (r(0, 255), r(0, 255), r(0, 255))
if event.key == K_RETURN:
pos = pygame.mouse.get_pos()
print "PIP: %r" % point_inside_polygon(pos[0], pos[1], shape)
#PASKAT KONTROLLIT
if event.key == K_RIGHT:
if x_speed==0:x_speed = start_speed
right_flag = True
示例4: Polygon
# 需要导入模块: from polygon import Polygon [as 别名]
# 或者: from polygon.Polygon import add_point [as 别名]
clock = pygame.time.Clock()
# blablabla
# blo bo blooo
mouse = pygame.image.load(mouse_image_file).convert()
bg = pygame.image.load(bg_image_file).convert()
x = 0
y = 0
movex, movey = 0, 0
points = [(10, 10), (10, 200), (100, 50)]
colour = (254, 0, 0)
shape = Polygon()
shape.add_point((30, 30))
shape.add_point((50, 50))
shape.add_point((20, 60))
shape.add_point((10, 230))
shape.add_point((3, 330))
while True:
for event in pygame.event.get():
#EXIT EVENT
if event.type == QUIT:
pygame.quit()
sys.exit()