Context
Raised in review on #653: #653 (review)
marching_cubes (both Grid.marching_cubes / marching_cubes_single and GridBatch.marching_cubes / marching_cubes_batch) returns a third tensor documented as vertex_edge_keys, shape (N, 3) for a single grid or (B, -1, 3) for a batch. Each row is [batch_idx, voxel_a, voxel_b], identifying the grid edge a vertex was interpolated on (voxel_a/voxel_b are flat voxel indices of the edge's two endpoint voxels, voxel_a >= voxel_b).
The issue
batch_idx is redundant:
- In
marching_cubes_batch, the batch structure is already encoded by the returned JaggedTensor itself.
- In
marching_cubes_single, there's no batch, so batch_idx is always 0 and carries no information.
Proposed change
Drop the batch_idx column so the output shape becomes (N, 2) / (B, -1, 2), with each row just [voxel_a, voxel_b]. Update the vertex_edge_keys docstrings in fvdb/grid.py, fvdb/grid_batch.py, and fvdb/functional/_meshing.py accordingly, and update the C++ implementation in MarchingCubes.cu plus any tests/call sites that consume the third return value.
This was deliberately scoped out of #653 (which only fixes the docstring/naming) to keep that PR small; #653 lands the vertex_edge_keys rename and explains the current (*, 3) encoding as an interim step.
Context
Raised in review on #653: #653 (review)
marching_cubes(bothGrid.marching_cubes/marching_cubes_singleandGridBatch.marching_cubes/marching_cubes_batch) returns a third tensor documented asvertex_edge_keys, shape(N, 3)for a single grid or(B, -1, 3)for a batch. Each row is[batch_idx, voxel_a, voxel_b], identifying the grid edge a vertex was interpolated on (voxel_a/voxel_bare flat voxel indices of the edge's two endpoint voxels,voxel_a >= voxel_b).The issue
batch_idxis redundant:marching_cubes_batch, the batch structure is already encoded by the returnedJaggedTensoritself.marching_cubes_single, there's no batch, sobatch_idxis always0and carries no information.Proposed change
Drop the
batch_idxcolumn so the output shape becomes(N, 2)/(B, -1, 2), with each row just[voxel_a, voxel_b]. Update thevertex_edge_keysdocstrings infvdb/grid.py,fvdb/grid_batch.py, andfvdb/functional/_meshing.pyaccordingly, and update the C++ implementation inMarchingCubes.cuplus any tests/call sites that consume the third return value.This was deliberately scoped out of #653 (which only fixes the docstring/naming) to keep that PR small; #653 lands the
vertex_edge_keysrename and explains the current(*, 3)encoding as an interim step.