Goal: Construct a 2-chain inside of the tetrahedralization of a unit 4D cube.

Method in 3D

We start with a simpler problem: constructing a 2-chain inside of the tetrahedralization of a unit 3D cube. The approach is based on marching tetrahedra, a variant of marching cubes.

The algorithm takes in two inputs:

  1. An isosurface that represents the target 2-chain
  2. An integer denoting the resolution for cube subdivision.

The first step is to take a unit cube centered at the origin and divide it into smaller cubes, herein called cells. The set of cells form a tiling of the larger unit cube, with each cell being a cube.

In the typical marching cubes algorithm, one would construct the 2-complex from these cells. However, we are interested in constructing a 3-complex containing the 2-complex. For that reason, we subdivide each cell into tetrahedra via Kuhn triangulation. The Kuhn triangulation of a cube constructs a tetrahedra for each permutation of axis directions.

More precisely, consider a unit cube . For each permutation , we construct the -simplex given by the vertex set

where is the -th standard basis vector for . The corresponding simplices for are given below (image source):

center

This procedure is done to each cell, resulting in a tetrahedralization of the original unit cube.

Claim: This is a valid 3-complex.

After constructing our 3-complex, we iterate over every tetrahedra with the goal of constructing our 2-complex homeomorphic to the isosurface . We take the simple 2-sphere given by

Given a tetrahedra with vertices , we sample the isofunction and construct a binary code indicating which vertices are outside of the surface, i.e., we define

The corresponding binary code is used to cut the tetrahedra and use the corresponding cut to form the 2-complex. The cuts are provided visually below (image source):

center Note that each binary code has a corresponding binary code (given by bit inversion) which has the faces oppositely oriented. The binary code (and corresponding ) indicate that the tetrahedra is entirely outside (inside) the isosurface and no cuts are necessary.

Typically, one forms the cuts by interpolating between the isovalues of adjacent vertices. However, for simplicity we simply take the midpoint and pre-cut the tetrahedra. As a consequence of this approach, we are required to perform every possible cut beforehand. The following figure designates the set of tetrahedra given after performing all possible cuts:

center

The full list of tetrahedra is as follows:

  • 4 Corners:
  • Inner Octahedron:

The idea of pre-cutting the tetrahedra, is that we simply mark the corresponding triangles for the binary code to be part of the 2-chain.

Claim: For sufficiently high resolution , the resulting 2-chain is homeomorphic to the isosurface.

Extending to 4D

The majority of the above extends to 4D relatively easily. We need the following three modifications:

  1. The initial unit cube is now a 4D cube that is split into cells
  2. We replace our 2-sphere input with a 3-sphere:
  1. The Kuhn triangulation of a cell now gives a 4-complex. Since we are looking for a 3-complex, we simply take every face (checking for duplicates) of each corresponding 4-simplex.

Current Problem

I appear to be getting duplicate tetrahedra (exactly 3,000,000 duplicates). From my code, it appears to be occurring in the code where I cut up a tetrahedra as described above. Given that is done locally, and I do not see any duplicates in the list given, there must be two tetrahedra overlapping.