コード例 #1
0
ファイル: tests.py プロジェクト: pfertyk/simple_pathfinder
    def test_through_the_middle_reversed(self):
        obstacle = Obstacle(1, 3, 1, 3)
        p1 = Point(4, 4)
        p2 = Point(0, 0)

        result = line_crosses_obstacle(p1, p2, obstacle)
        self.assertTrue(result)
コード例 #2
0
ファイル: tests.py プロジェクト: pfertyk/simple_pathfinder
    def test_large_obstacle(self):
        obstacle = Obstacle(265, 335, 265, 8000)
        p1 = Point(284, 221)
        p2 = Point(265, 265)

        result = line_crosses_obstacle(p1, p2, obstacle)
        self.assertFalse(result)
コード例 #3
0
ファイル: tests.py プロジェクト: pfertyk/simple_pathfinder
    def test_through_the_middle_y_aligned(self):
        obstacle = Obstacle(1, 3, 1, 3)
        p1 = Point(2, 0)
        p2 = Point(2, 4)

        result = line_crosses_obstacle(p1, p2, obstacle)
        self.assertTrue(result)
コード例 #4
0
ファイル: tests.py プロジェクト: pfertyk/simple_pathfinder
    def test_pointing_away(self):
        obstacle = Obstacle(1, 3, 1, 3)
        p1 = Point(4, 2)
        p2 = Point(5, 2.5)

        result = line_crosses_obstacle(p1, p2, obstacle)
        self.assertFalse(result)
コード例 #5
0
ファイル: tests.py プロジェクト: pfertyk/simple_pathfinder
    def test_one_point_inside(self):
        obstacle = Obstacle(1, 3, 1, 3)
        p1 = Point(0, 0)
        p2 = Point(2, 2)

        result = line_crosses_obstacle(p1, p2, obstacle)
        self.assertTrue(result)
コード例 #6
0
ファイル: tests.py プロジェクト: pfertyk/simple_pathfinder
    def test_touching_side_perpendicular(self):
        obstacle = Obstacle(1, 3, 1, 3)
        p1 = Point(0, 2)
        p2 = Point(1, 2)

        result = line_crosses_obstacle(p1, p2, obstacle)
        self.assertFalse(result)
コード例 #7
0
ファイル: tests.py プロジェクト: pfertyk/simple_pathfinder
    def test_not_crossing_but_pointing(self):
        obstacle = Obstacle(1, 3, 1, 3)
        p1 = Point(-1, 2.5)
        p2 = Point(0, 2)

        result = line_crosses_obstacle(p1, p2, obstacle)
        self.assertFalse(result)
コード例 #8
0
ファイル: tests.py プロジェクト: pfertyk/simple_pathfinder
    def test_starting_in_tip_perpendicular(self):
        obstacle = Obstacle(1, 3, 1, 3)
        p1 = Point(1, 1)
        p2 = Point(0, 1)

        result = line_crosses_obstacle(p1, p2, obstacle)
        self.assertFalse(result)
コード例 #9
0
ファイル: tests.py プロジェクト: pfertyk/simple_pathfinder
    def test_tip(self):
        obstacle = Obstacle(1, 3, 1, 3)
        p1 = Point(0, 2)
        p2 = Point(2, 4)

        result = line_crosses_obstacle(p1, p2, obstacle)
        self.assertFalse(result)
コード例 #10
0
ファイル: tests.py プロジェクト: pfertyk/simple_pathfinder
    def test_parallel_edge_y(self):
        obstacle = Obstacle(1, 3, 1, 3)
        p1 = Point(1, 0)
        p2 = Point(1, 4)

        result = line_crosses_obstacle(p1, p2, obstacle)
        self.assertFalse(result)
コード例 #11
0
ファイル: tests.py プロジェクト: pfertyk/simple_pathfinder
    def test_no_collision(self):
        obstacle = Obstacle(1, 3, 1, 3)
        p1 = Point(0, 0)
        p2 = Point(4, 0)

        result = line_crosses_obstacle(p1, p2, obstacle)
        self.assertFalse(result)
コード例 #12
0
ファイル: tests.py プロジェクト: pfertyk/simple_pathfinder
    def test_through_the_middle_different_angle(self):
        obstacle = Obstacle(1, 3, 1, 3)
        p1 = Point(0, 2.5)
        p2 = Point(3, 3.99)

        result = line_crosses_obstacle(p1, p2, obstacle)
        self.assertTrue(result)