Пример #1
0
    def test_build_quadtree(self):

        a = [3, 7]
        b = [5, 7]
        c = [5, 5]
        d = [7, 7]
        e = [15, 15]
        f = [15, 30]
        g = [30, 10]
        h = [30, 30]

        points = [a, b, c, d, e, f, g, h]
        
        #bac, bce, ecf, dbe, daf, dae
        vertices = [[1,0,2], [1,3,4], [1,2,3], [5,4,7], [4,6,7]]

        mesh = Mesh(points, vertices)
    
        Q = MeshQuadtree(mesh)
        #Q.show()
        #print Q.count()
        self.assertEqual(Q.count(), len(vertices))

        # test a point that falls within a triangle
        result = Q.search([10, 10])
        assert isinstance(result, (list, tuple)), 'should be a list'