コード例 #1
0
    def test_generate_maze_full_icosphere(self):
        bm = bmesh.new()
        bmesh.ops.create_icosphere(bm, subdivisions=3, diameter=5.0)
        for face in bm.faces:
            face.select = True
        nverts = len(bm.verts)
        bm, maze_links, maze_verts = mm.generate_maze(bm, mm.MAZE_PARAMS)

        self.assertEqual(len(maze_links), 323 - nverts)
        self.assertEqual(len(maze_verts), nverts)
        self.assertEqual(sum(face.select for face in bm.faces), 323)
        bm.free()
コード例 #2
0
    def test_generate_maze_full_grid(self):
        """
        generate full maze on 10 x 10 grid
        """
        bm = bmesh.new()
        bmesh.ops.create_grid(bm, x_segments=10, y_segments=10, size=1.0)
        for face in bm.faces:
            face.select = True

        bm, maze_links, maze_verts = mm.generate_maze(bm, mm.MAZE_PARAMS)

        self.assertEqual(len(maze_links), 63)
        self.assertEqual(len(maze_verts), 64)
        # also count of selected faces should == 63+64
        self.assertEqual(sum(face.select for face in bm.faces), 127)
        bm.free()
コード例 #3
0
    def test_generate_maze_loops_grid(self):
        """
        select some edges that don't select full faces
        but could form a maze
        """
        bm = bmesh.new()
        bmesh.ops.create_grid(bm, x_segments=10, y_segments=10, size=1.0)

        bm = make_edge_selection_grid(bm)
        nverts = sum(vert.select for vert in bm.verts)

        maze_params = mm.MAZE_PARAMS.copy()
        maze_params['boundary_type'] = 1
        maze_params['offset'] = 0.0
        bm, maze_links, maze_verts = mm.generate_maze(bm, maze_params)

        self.assertEqual(len(maze_links), 63)
        self.assertEqual(len(maze_verts), nverts)
        self.assertEqual(sum(edge.select for edge in bm.edges),
                         len(maze_links))
        bm.free()