mathewa6 / MagicaMenger

A Python/numpy implementation of the Menger Sponge/Cube designed to work with MagicaVoxel.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MagicaMenger

A Python/numpy implementation of the Menger Sponge/Cube designed to work with MagicaVoxel.

Modules

Functionality

  • Set object.lut = [] to indicate which voxels in a 3x3x3 cube to delete. (0 ... 26)
  • Call output(depth, filename) to return a numpy array of the traditional Menger sponge as well as write it to filename.vox.
  • Use inverseOutput(depth, filename) to output the model of all deleted cubes in the regular sponge.

Usage

# Create an object 
menger = MengerMagica()

# Call either output() or inverseOutput()
invop = menger.inverseOutput(3, "output.vox")

Notes

  • Calling inverseOutput results in an internal call to output()
  • Calculations for a call to output() for a certain depth occur once. Changing the depth results in recomputation.

Based on

The method of using a look up table for voxel deletion was borrowed from Malcolm Kesson.

About

A Python/numpy implementation of the Menger Sponge/Cube designed to work with MagicaVoxel.


Languages

Language:Python 100.0%