Exemplo n.º 1
0
def build_block_plain(center, l, d, notify=False, parent=None, t='ground1'):
    vertices = (
        (center[0] - l / 2, center[1], center[2] - d / 2),
        (center[0] - l / 2, center[1], center[2] + d / 2),
        (center[0] + l / 2, center[1], center[2] + d / 2),
        (center[0] + l / 2, center[1], center[2] - d / 2),
    )

    if notify:
        print('plain', vertices)

    with_tail_edges, no_tail_edges = make_edges(vertices,
                                                len(DataUtil.vertices))
    with_tail_surfaces, no_tail_surfaces = make_surface(
        vertices, len(DataUtil.vertices))

    DataUtil.edges += with_tail_edges
    DataUtil.surfaces += with_tail_surfaces
    DataUtil.vertices += vertices

    valid_points(DataUtil.vertices, 3, 'plain')
    valid_edges(DataUtil.edges, DataUtil.vertices, 'plain')
    if parent is not None:
        parent.vertices += vertices
        parent.edges += no_tail_edges
        parent.surfaces = no_tail_surfaces
        return parent

    return DrawableObject(no_tail_surfaces, vertices, no_tail_edges, t)
Exemplo n.º 2
0
def build_plain(origin, end, d, parent=None):
    vertices = (
        origin,
        (origin[0], origin[1], origin[2] + d),
        (end[0], end[1], end[2] + d),
        end,
    )
    with_tail_edges, no_tail_edges = make_edges(vertices,
                                                len(DataUtil.vertices))
    with_tail_surfaces, no_tail_surfaces = make_surface(
        vertices, len(DataUtil.vertices))

    DataUtil.edges += with_tail_edges
    DataUtil.surfaces += with_tail_surfaces
    DataUtil.vertices += vertices

    valid_points(DataUtil.vertices, 3, 'plain')
    valid_edges(DataUtil.edges, DataUtil.vertices, 'plain')

    if parent is not None:
        parent.vertices += vertices
        parent.edges += no_tail_edges
        parent.surfaces = no_tail_surfaces
        return parent

    return DrawableObject(no_tail_surfaces, vertices, no_tail_edges, '')
Exemplo n.º 3
0
def build_top(x_origin, y_origin, z_origin):
    top = []
    vertices = (
        (x_origin + width / 2, y_origin + height + tower_height * 0.2,
         z_origin),
        (x_origin + width / 2, y_origin + height + tower_height * 0.2,
         z_origin + depth),
        (x_origin + width, y_origin + height, z_origin + depth),
        (x_origin + width, y_origin + height, z_origin),
    )
    with_tail_edges, no_tail_edges = make_edges(vertices,
                                                len(DataUtil.vertices))
    with_tail_surfaces, no_tail_surfaces = make_surface(
        vertices, len(DataUtil.vertices))

    DataUtil.edges += with_tail_edges
    DataUtil.surfaces += with_tail_surfaces
    DataUtil.vertices += vertices
    top.append(DrawableObject(no_tail_surfaces, vertices, no_tail_edges,
                              'top'))

    vertices = (
        (x_origin + width / 2, y_origin + height + tower_height * 0.2,
         z_origin),
        (x_origin + width / 2, y_origin + height + tower_height * 0.2,
         z_origin + depth),
        (x_origin, y_origin + height, z_origin + depth),
        (x_origin, y_origin + height, z_origin),
    )
    with_tail_edges, no_tail_edges = make_edges(vertices,
                                                len(DataUtil.vertices))
    with_tail_surfaces, no_tail_surfaces = make_surface(
        vertices, len(DataUtil.vertices))

    DataUtil.edges += with_tail_edges
    DataUtil.surfaces += with_tail_surfaces
    DataUtil.vertices += vertices

    top.append(DrawableObject(no_tail_surfaces, vertices, no_tail_edges,
                              'top'))

    valid_points(DataUtil.vertices, 3, 'top')
    valid_edges(DataUtil.edges, DataUtil.vertices, 'top')
    return top
Exemplo n.º 4
0
def build_any_plain(vertices, notify=False, parent=None, t='table'):
    if notify:
        print('plain', vertices)

    with_tail_edges, no_tail_edges = make_edges(vertices,
                                                len(DataUtil.vertices))
    with_tail_surfaces, no_tail_surfaces = make_surface(
        vertices, len(DataUtil.vertices))

    DataUtil.edges += with_tail_edges
    DataUtil.surfaces += with_tail_surfaces
    DataUtil.vertices += vertices

    valid_points(DataUtil.vertices, 3, 'plain')
    valid_edges(DataUtil.edges, DataUtil.vertices, 'plain')
    if parent is not None:
        parent.vertices += vertices
        parent.edges += no_tail_edges
        parent.surfaces = no_tail_surfaces
        return parent
    return DrawableObject(no_tail_surfaces, vertices, no_tail_edges, t)
Exemplo n.º 5
0
def build_wall(origin, end, h, notify=False, type_name="wall", parent=None):
    vertices = quad(origin, end, h)
    if notify:
        print('wall', vertices)

    with_tail_edges, no_tail_edges = make_edges(vertices,
                                                len(DataUtil.vertices))
    with_tail_surfaces, no_tail_surfaces = make_surface(
        vertices, len(DataUtil.vertices))

    DataUtil.edges += with_tail_edges
    DataUtil.surfaces += with_tail_surfaces
    DataUtil.vertices += vertices

    valid_points(DataUtil.vertices, 3, 'wall')
    valid_edges(DataUtil.edges, DataUtil.vertices, 'wall')

    if parent is not None:
        parent.vertices += vertices
        parent.edges += no_tail_edges
        parent.surfaces = no_tail_surfaces
        return parent

    return DrawableObject(no_tail_surfaces, vertices, no_tail_edges, type_name)