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
def test_average_vertex_merger_index_of(): merger = MeshAverageVertexMerger() merger.add_vertices([(1, 2, 3), (4, 5, 6)]) assert merger.index((1, 2, 3)) == 0 assert merger.index((4, 5, 6)) == 1 with pytest.raises(IndexError): merger.index((7, 8, 9))
def test_average_vertex_merger_vertices(): merger = MeshAverageVertexMerger() merger.add_vertices([(1, 2, 3), (4, 5, 6)]) merger.add_vertices([(1, 2, 3), (4, 5, 6)]) assert merger.vertices == [(1, 2, 3), (4, 5, 6)]
def test_average_vertex_merger_indices(): merger = MeshAverageVertexMerger() indices = merger.add_vertices([(1, 2, 3), (4, 5, 6)]) indices2 = merger.add_vertices([(1, 2, 3), (4, 5, 6)]) assert indices == indices2