예제 #1
0
def test_average_vertex_merger():
    pyramid = SierpinskyPyramid(level=4, sides=3)
    faces = pyramid.faces()
    mesh = MeshAverageVertexMerger()
    for vertices in pyramid:
        mesh.add_mesh(vertices=vertices, faces=faces)
    assert len(mesh.vertices) == 514
    assert len(mesh.faces) == 1024
예제 #2
0
def main(filename, level, sides=3, merge=False):
    print('building sierpinski pyramid {}: start'.format(sides))
    pyramids = SierpinskyPyramid(level=level, sides=sides)
    print('building sierpinski pyramid {}: done'.format(sides))
    try:
        write(filename, pyramids, merge=merge)
    except IOError as e:
        print('ERROR: can not write "{0}": {1}'.format(e.filename, e.strerror))
    else:
        print('saving "{}": done'.format(filename))
예제 #3
0
def main(filename, level, sides=3, merge=False):
    t0 = perf_counter()
    pyramids = SierpinskyPyramid(level=level, sides=sides)
    t1 = perf_counter()
    print(f'Build sierpinski pyramid {sides} in {t1 - t0:.5f}s.')
    try:
        write(filename, pyramids, merge=merge)
    except IOError as e:
        print(f'ERROR: can not write "{e.filename}": {e.strerror}')
    else:
        print(f'Saved as "{filename}"')
예제 #4
0
def test_vertex_merger():
    dwg = ezdxf.new('R2000')
    pyramid = SierpinskyPyramid(level=4, sides=3)
    pyramid.render(dwg.modelspace(), merge=True)
    meshes = dwg.modelspace().query('MESH')
    assert len(meshes) == 1
예제 #5
0
def test_mesh_builder(msp):
    pyramid = SierpinskyPyramid(level=4, sides=3)
    pyramid.render(msp, merge=False)
    meshes = msp.query("MESH")
    assert len(meshes) == 256