alexhunsley/numpy-vox-io

Missing a test of loading known state .vox file

Opened this issue · 0 comments

roundtrip.py does a roundtrip check - i.e. that parse(voxFile) == parse(write(parse(voxFile))) - but this doesn’t find any ‘symetrical’ errors in both vox file parsing + writing (see #2 - which I regard as such a symmetrical pair of errors).

Add a test of loading a known .vox file and check the colours and positions of voxels are as expected.

Suggested layout of test vox file:
(All axes have x, y, z order)

We want to be able to diagnose either colour mapping issues or axes issues from the one file.
Therefore, we should use unique values for red versus green versus blue components. Let’s adopt 253, 254, 255 respectively.

Dimension:
(3, 5, 9)

Voxels:
Black [0, 0, 0] at (1, 4, 8) (colour index = 1)

White [253, 254, 255] at (0, 0, 0). (colour has index 255 in the palette)
Red [253, 0, 0] at (2, 0, 0). (colour index = 2)
Green [0, 254, 0] at (0, 4, 0) (colour index = 3)
Blue [0, 0, 255] at (0, 0, 8) (colour index = 4)

Yellow [253, 254, 0] at (2, 4, 0) (colour index = 5)
Magenta [253, 0, 255] at (2, 0, 8) (colour index = 6)
Cyan [0, 254, 255] at (0, 4, 8) (colour index = 7)

Note that in this test file design, the red, green and blue voxels have same relative direction from the white origin voxel as the coloured axes arrows in MagicaVoxel.