From 9d5d536e7a443fbc3740747ae3a497d3d0670e30 Mon Sep 17 00:00:00 2001 From: k-dominik Date: Wed, 30 Sep 2020 16:01:59 +0200 Subject: [PATCH] Added (currently) failing test for correctness --- test/test_marching_correctness.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/test_marching_correctness.py diff --git a/test/test_marching_correctness.py b/test/test_marching_correctness.py new file mode 100644 index 0000000..87f8993 --- /dev/null +++ b/test/test_marching_correctness.py @@ -0,0 +1,19 @@ +import marching_cubes +import numpy +import pytest + + +@pytest.fixture +def data(): + """Test volume with non-zero voxels parallel to axes""" + data = numpy.zeros((17, 19, 23)).astype("uint32") + data[1:7, 1:2, 1:2] = 1 # z-axis + data[1:2, 1:9, 1:2] = 1 # y-axis + data[1:2, 1:2, 1:11] = 1 # x-axis + return data + + +def test_marching_orientation(data): + v, _, _ = marching_cubes.march(data, 0) + max_v = v.max(axis=0) + numpy.testing.assert_array_almost_equal(max_v, [10.5, 8.5, 6.5])