Quiz: marching cubes

Short questions to test your understanding. Try each on paper first, then open the answer. Corner k of a cube has offsets (x, y, z) with k = x + 2y + 4z; the case index is \sum 2^k over the corners above c.


Q1. Corners 1, 2 and 4 are above c, the others below. What is the case index? How many corners are below?

Add the powers of two.

2 + 4 + 16 = 22; five corners are below.


Q2. Why does marching cubes produce a closed surface, although every cube is processed on its own?

What do neighbouring cubes share?

Neighbouring cubes share edges and faces. A crossing point on a shared edge is computed from the same two values, so it is the same point; and if both cubes cut each shared face in the same way (a consistent face rule), their triangles meet edge to edge. The surface can only end where it leaves the volume.


Q3. How do the 256 cases reduce to 15?

Two kinds of symmetry.

The 24 rotations of the cube map a case to another case with the same (rotated) surface: 23 classes. Swapping above and below (complement) gives the same surface with flipped normals: together 15 classes.


Q4. What is a crack, and how can the 15-case table produce one?

Think of an ambiguous face shared by two cubes.

A hole in the surface along a face where the two neighbouring cubes connected the crossing points differently (one separated the bright corners, the other joined them). The 15-case table uses the complement for some cases, which swaps “separate” for “join” on their ambiguous faces; when only one of the two neighbours is complemented, they disagree.


Q5. Why is marching tetrahedra never ambiguous, and what is its price?

What does the interpolant look like inside a tetrahedron?

Linear interpolation of 4 corner values is an affine function, whose level set is a plane: it cuts a tetrahedron in a single triangle or quadrilateral, and there are no diagonal corners on its (triangular) faces. The price: more triangles (typically 2–4 times), thinner triangles, and a slight dependence on how the cubes were split.


Q6. A vertex lies on the surface of a bright nucleus where \nabla I = (0, 0, -12). Which way does the outward normal point?

\mathbf n = -\nabla I/\lVert\nabla I\rVert for a bright object.

\mathbf n = (0, 0, 1): I decreases towards +z, so outside (darker) is in the +z direction.


Q7. You extract a surface from a binary mask (0/1) at c = 0.5 and shade it with gradient normals. Why does it look blocky, and what helps?

Where are the vertices, and which values can the central differences take?

Every crossed edge goes from 1 to 0, so every vertex sits at an edge midpoint (terraces), and central differences of 0/1 values point in only a few directions (combinations of -1, 0, 1): the normals are blocky too. Blurring the mask slightly before extraction gives grey values that place the vertices and normals smoothly.


Q8. (math) Why does the number of triangles grow like n^2, while the running time grows like n^3, for an n^3 volume containing one blob of size proportional to n?

Which cubes produce triangles, and which cubes are visited?

All (n-1)^3 cubes are visited (each in constant time), so the time is O(n^3). Only the cubes the surface passes through produce triangles; their number is proportional to the surface area in voxel units, \propto n^2 for a blob whose size grows like n.