Closed denghilbert closed 1 year ago
Hi @denghilbert,
There is a typo in your code 😅. You are defining two different arrays, field
and init
, but then you use only field
when calling marching_cubes
. The fixed code works as expected:
field = np.ones([2, 2, 2]) + 99
field[0][0][0] = 0
vertices1, triangles1 = mcubes.marching_cubes(field, 50)
# Change `init` to `field`
field = np.ones([2, 2, 2]) + 99
field[0][0][0] = 40
vertices2, triangles2 = mcubes.marching_cubes(field, 50)
Output:
In [11]: vertices1
Out[11]:
array([[0.5, 0. , 0. ],
[0. , 0.5, 0. ],
[0. , 0. , 0.5]])
In [12]: vertices2
Out[12]:
array([[0.16666667, 0. , 0. ],
[0. , 0.16666667, 0. ],
[0. , 0. , 0.16666667]])
Hope that helps.
Best!
I noticed this lib implemented the interpolation for vertex like this:
But when I run:
The result is like:
It seems that it does not interpolate based on the value of the corner. If there is any bug or I just misunderstood this. :sob: