Tutorials.pythonRotate#

Rotating 3D voxel animation#

from https://gist.github.com/mtesseracted/62ba9204d5fd3bb952c830c923c1b321

Demonstrates using ax.voxels with uneven coordinates

create_face(voxels, side, facestr)#

Change voxels to True for cubes corresponding to ‘#’ symbols in facestr on the side specified

Parameters:
  • voxels (3D array of bools)

  • side (string representing the constant face)

  • facestr (string with '#' representing true and) – rows seperated by newlines

explode(data)#

Make a new grid where the original grid is every other point in the new grid, starting at the third point. Also add an extra padding row/col when a dimension is even to prevent gaps in the middle when viewing that dimension face on.

Parameters:

data (3D np.array of coordinates)

voxel_face(corns, dm, nf, offst=0.0)#

Grab the corner coordinates of one voxel face

Parameters:
  • corns (np.indices array of corners for one voxel)

  • dm ((dimension), values can be 0(x), 1(y), 2(z))

  • nf ((near/far face), values can be 0(near), 1(far))

  • offst (how much to offset the face size, also offsets at) – 1/10th that amount in the perpendicular direction