예제 #1
0
파일: test.py 프로젝트: 1203427455/Lanturn
    def test_basic_polygon_intersect(self):
        poly = Polygon()
        poly.add_point(0, 0)
        poly.add_point(0, 1)
        poly.add_point(1, 1)
        poly.add_point(1, 0)

        line = [Vec2d(-0.5, -0.5), Vec2d(0.5, 0.5)]
        self.assertTrue(intersect_polygon(line, poly))

        line = [Vec2d(1, -1), Vec2d(1, 0)]
        self.assertFalse(intersect_polygon(line, poly))
예제 #2
0
파일: test.py 프로젝트: 1203427455/Lanturn
    def test_border_non_intersect(self):
        polygon = Polygon()
        polygon.add_point(0, 0)
        polygon.add_point(0, 1)
        polygon.add_point(1, 1)
        polygon.add_point(1, 0)

        line1 = [Vec2d(0, 0), Vec2d(1, 0)]

        self.assertFalse(intersect_polygon(line1, polygon))