Example #1
0
def rectangle(x_length, z_length):
    geometry = []
    byte_color = [38.0, 38.0, 217.0, 255.0]
    z_s = [0.0, (z_length - 1.0)]
    x_s = [0.0, (x_length - 1.0)]
    for i in range(2):
        z = z_s[int(i)]
        x = x_s[int(i)]
        vertices = column_geometry((x_length - 4.0), 1.0, [2.0, 0.0, z])
        geometry.extend(vertices)
        vertices = column_geometry(1.0, (z_length - 4.0), [x, 0.0, 2.0])
        geometry.extend(vertices)
    cubes = [
        [1.0, 0.0, 1.0],
        [1.0, 0.0, (z_length - 2.0)],
        [(x_length - 2.0), 0.0, 1.0],
        [(x_length - 2.0), 0.0, (z_length - 2.0)],
    ]
    for cube in cubes:
        vertices = vertices_cube(cube, 1.0, byte_color, 0.05)
        geometry.extend(vertices)
    name = "".join(["blue", str(int(x_length)), "by", str(int(z_length))])
    filename = "/".join(["../geometries", name])
    with open(filename, "w") as f:
        f.write(json.dumps(geometry, cls=SyrupEncoder))
    return
Example #2
0
def c_shape(up_length, side_length, down_length):
    byte_color = [38.0, 38.0, 217.0, 255.0]
    geometry = []
    column = column_geometry(down_length, 1.0, [2.0, 0.0, 0.0])
    geometry.extend(column)
    column = column_geometry(1.0, side_length, [0.0, 0.0, 2.0])
    geometry.extend(column)
    column = column_geometry(up_length, 1.0, [2.0, 0.0, (3.0 + side_length)])
    geometry.extend(column)
    vertices = vertices_cube([1.0, 0.0, 1.0], 1.0, byte_color, 0.05)
    geometry.extend(vertices)
    vertices = vertices_cube([1.0, 0.0, (2.0 + side_length)], 1.0, byte_color, 0.05)
    geometry.extend(vertices)
    filename = "/".join(["../geometries", "blue_c_se"])
    with open(filename, "w") as f:
        f.write(json.dumps(geometry, cls=SyrupEncoder))
    return
Example #3
0
def c_shape(up_length, side_length, down_length):
    byte_color = [38.0, 38.0, 217.0, 255.0]
    geometry = []
    column = column_geometry(down_length, 1.0, [2.0, 0.0, 0.0])
    geometry.extend(column)
    column = column_geometry(1.0, side_length, [0.0, 0.0, 2.0])
    geometry.extend(column)
    column = column_geometry(up_length, 1.0, [2.0, 0.0, (3.0 + side_length)])
    geometry.extend(column)
    vertices = vertices_cube([1.0, 0.0, 1.0], 1.0, byte_color, 0.05)
    geometry.extend(vertices)
    vertices = vertices_cube([1.0, 0.0, (2.0 + side_length)], 1.0, byte_color,
                             0.05)
    geometry.extend(vertices)
    filename = "/".join(["../geometries", "blue_c_se"])
    with open(filename, "w") as f:
        f.write(json.dumps(geometry, cls=SyrupEncoder))
    return
Example #4
0
def column_geometry_color(x_length, z_length, offset, byte_color):
    geometry = {}
    geometry = []
    for i in range(int(x_length)):
        for j in range(int(z_length)):
            position = [(i + offset[0]), offset[1], (j + offset[2])]
            vertices = vertices_cube(position, 1.0, byte_color, 0.05)
            geometry.extend(vertices)
    return geometry
Example #5
0
def column_geometry_color(x_length, z_length, offset, byte_color):
    geometry = {}
    geometry = []
    for i in range(int(x_length)):
        for j in range(int(z_length)):
            position = [(i + offset[0]), offset[1], (j + offset[2])]
            vertices = vertices_cube(position, 1.0, byte_color, 0.05)
            geometry.extend(vertices)
    return geometry
Example #6
0
def cubes():
    byte_color = [38.0, 38.0, 217.0, 255.0]
    geometry = []
    positions = [[10.0, 0.0, 0.0]]
    for position in positions:
        vertices = vertices_cube(position, 1.0, byte_color, 0.05)
        geometry.extend(vertices)
    filename = "/".join(["../geometries", "stage_cubes"])
    with open(filename, "w") as f:
        f.write(json.dumps(geometry, cls=SyrupEncoder))
    return
Example #7
0
def cubes():
    byte_color = [38.0, 38.0, 217.0, 255.0]
    geometry = []
    positions = [[10.0, 0.0, 0.0]]
    for position in positions:
        vertices = vertices_cube(position, 1.0, byte_color, 0.05)
        geometry.extend(vertices)
    filename = "/".join(["../geometries", "stage_cubes"])
    with open(filename, "w") as f:
        f.write(json.dumps(geometry, cls=SyrupEncoder))
    return
Example #8
0
def rectangle(x_length, z_length):
    geometry = []
    byte_color = [38.0, 38.0, 217.0, 255.0]
    z_s = [0.0, (z_length - 1.0)]
    x_s = [0.0, (x_length - 1.0)]
    for i in range(2):
        z = z_s[int(i)]
        x = x_s[int(i)]
        vertices = column_geometry((x_length - 4.0), 1.0, [2.0, 0.0, z])
        geometry.extend(vertices)
        vertices = column_geometry(1.0, (z_length - 4.0), [x, 0.0, 2.0])
        geometry.extend(vertices)
    cubes = [[1.0, 0.0, 1.0], [1.0, 0.0, (z_length - 2.0)],
             [(x_length - 2.0), 0.0, 1.0],
             [(x_length - 2.0), 0.0, (z_length - 2.0)]]
    for cube in cubes:
        vertices = vertices_cube(cube, 1.0, byte_color, 0.05)
        geometry.extend(vertices)
    name = "".join(["blue", str(int(x_length)), "by", str(int(z_length))])
    filename = "/".join(["../geometries", name])
    with open(filename, "w") as f:
        f.write(json.dumps(geometry, cls=SyrupEncoder))
    return