Skip to content

marching_cubes: drop redundant batch_idx column from vertex_edge_keys output #678

Description

@swahtz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageNeeds team review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions