why not use k as size_t here? it should be the same type as n_ply_pnt_ids. i mean it for consistency...