Beispiel #1
0
    def test_same_start_point_is_node(self):
        polygon = Polygon()
        polygon.add_point(0, 1)
        polygon.add_point(0, 2)
        polygon.add_point(1, 2)
        polygon.add_point(1, 1)

        planner = AStarPlanner()
        planner.add_polygon(polygon)
        planner.init()

        planner.find_path(0, 0, 1, 2)
Beispiel #2
0
def set_up_systems():
    system_manager = SystemManager.get_instance()

    movement_system = MovementSystem(AStarPlanner())
    render_system = RenderSystem(800, 600)

    system_manager.init([
        movement_system,
        render_system,
    ])

    return system_manager
Beispiel #3
0
    def test_line_intersect_epsilon(self):
        polygon = Polygon([
            Vec2d(540, 591),
            Vec2d(600, 571),
            Vec2d(590, 440),
            Vec2d(542, 471),
            Vec2d(533, 576)
        ])

        planner = AStarPlanner()
        planner.add_polygon(polygon)
        planner.init()

        path = planner.find_path(596, 526, 462, 516)
        self.assertEquals(path,
                          [Vec2d(600, 571),
                           Vec2d(540, 591),
                           Vec2d(462, 516)])