Skip to content

Commit

Permalink
test: check that setting min_error to 0 gives closer to reduction factor
Browse files Browse the repository at this point in the history
  • Loading branch information
william-silversmith committed May 2, 2024
1 parent 4756346 commit b952389
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions automated_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,3 +274,26 @@ def test_simplified_meshes_remain_the_same(connectomics_labels, order):
assert np.all(np.sort(old_mesh.vertices[old_mesh.faces], axis=0) == np.sort(new_mesh.vertices[new_mesh.faces], axis=0))
print(lbl, "ok")


@pytest.mark.parametrize("reduction_factor", [2,5,10])
def test_min_error_skip(reduction_factor):
for order in ['C','F']:
labels = np.zeros((11, 17, 19), dtype=np.uint8, order=order)
labels[1:-1, 1:-1, 1:-1] = 1

mesher = zmesh.Mesher((4, 4, 40))
mesher.mesh(labels)

original_mesh = mesher.get_mesh(1, normals=False)
mesh = mesher.simplify(
original_mesh,
reduction_factor=reduction_factor,
max_error=40,
min_error=0,
compute_normals=True
)
factor = len(original_mesh.faces) / len(mesh.faces)
assert abs(factor - reduction_factor) < 1



0 comments on commit b952389

Please sign in to comment.