Merge nearby vertices and index them