refactor and modularize MarchingCubes into a class