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


Python Polygon.add_point方法代碼示例

本文整理匯總了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)
開發者ID:kkevinchou,項目名稱:Bobcat,代碼行數:20,代碼來源:test.py

示例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)
開發者ID:kkevinchou,項目名稱:Bobcat,代碼行數:20,代碼來源:test.py

示例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
開發者ID:Krouvi,項目名稱:Pyneli,代碼行數:33,代碼來源:test2.py

示例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()
	
開發者ID:Krouvi,項目名稱:Pyneli,代碼行數:31,代碼來源:test1.py


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