I have array of vertices from an stl file which i converted to a 2D numpy array. Here's some of it as an example:
print(vertices.shape)
(67748, 3)
I need to turn these into a 3D binary array where each element = 1 where the index is given by the vertices array.
Minimal reproducible example (expected output) using a 5 x 3 vertices array instead of 67748 x 3:
verts = np.array([[ 77, 239, 83],
[100, 237, 88],
[100, 149, 94],
[100, 220, 128],
[100, 145, 86]])
voxels = np.zeros((256,256,256)).astype(int)
voxels[77,239,83] = 1
voxels[100,149,94] = 1
voxels[100,237,88] = 1
voxels[100,220,128] = 1
voxels[100,145, 86] = 1