(voxel_grid)
return new_vg
Converts a voxel grid defined by min and max coordinates to a voxel grid defined by faces.

    :param voxel_grid: voxel grid defined by the bounding box of all voxels
    :return: voxel grid with face data
Converts a voxel grid defined by min and max coordinates to a voxel grid defined by faces.
Converts a voxel grid defined by min and max coordinates to a voxel grid defined by faces .
def convert_bb_to_faces(voxel_grid):
    """ Converts a voxel grid defined by min and max coordinates to a voxel grid defined by faces.

    :param voxel_grid: voxel grid defined by the bounding box of all voxels
    :return: voxel grid with face data
    """
    new_vg = []
    for v in voxel_grid:
        # Vertices
        p1 = v[0]
        p2 = [v[1][0], v[0][1], v[0][2]]
        p3 = [v[1][0], v[1][1], v[0][2]]
        p4 = [v[0][0], v[1][1], v[0][2]]
        p5 = [v[0][0], v[0][1], v[1][2]]
        p6 = [v[1][0], v[0][1], v[1][2]]
        p7 = v[1]
        p8 = [v[0][0], v[1][1], v[1][2]]
        # Faces
        fb = [p1, p2, p3, p4]  # bottom face
        ft = [p5, p6, p7, p8]  # top face
        fs1 = [p1, p2, p6, p5]  # side face 1
        fs2 = [p2, p3, p7, p6]  # side face 2
        fs3 = [p3, p4, p8, p7]  # side face 3
        fs4 = [p1, p4, p8, p5]  # side face 4
        # Append to return list
        new_vg.append([fb, fs1, fs2, fs3, fs4, ft])
    return new_vg
def convert_bb_to_faces ( voxel_grid ) : new_vg = [ ] for v in voxel_grid : # Vertices p1 = v [ 0 ] p2 = [ v [ 1 ] [ 0 ] , v [ 0 ] [ 1 ] , v [ 0 ] [ 2 ] ] p3 = [ v [ 1 ] [ 0 ] , v [ 1 ] [ 1 ] , v [ 0 ] [ 2 ] ] p4 = [ v [ 0 ] [ 0 ] , v [ 1 ] [ 1 ] , v [ 0 ] [ 2 ] ] p5 = [ v [ 0 ] [ 0 ] , v [ 0 ] [ 1 ] , v [ 1 ] [ 2 ] ] p6 = [ v [ 1 ] [ 0 ] , v [ 0 ] [ 1 ] , v [ 1 ] [ 2 ] ] p7 = v [ 1 ] p8 = [ v [ 0 ] [ 0 ] , v [ 1 ] [ 1 ] , v [ 1 ] [ 2 ] ] # Faces fb = [ p1 , p2 , p3 , p4 ] # bottom face ft = [ p5 , p6 , p7 , p8 ] # top face fs1 = [ p1 , p2 , p6 , p5 ] # side face 1 fs2 = [ p2 , p3 , p7 , p6 ] # side face 2 fs3 = [ p3 , p4 , p8 , p7 ] # side face 3 fs4 = [ p1 , p4 , p8 , p5 ] # side face 4 # Append to return list new_vg . append ( [ fb , fs1 , fs2 , fs3 , fs4 , ft ] ) return new_vg