nglod
nglod copied to clipboard
Question about generate parents in create_trinkets.
Hi, Thanks for a great work. I want to use your spc code, and found a function can generate a point's corners and parent. But the parent index generated has NAN values.
In my understanding, the map created in line 8 should be from motron code of level i's parents to the index of node in spc.points. But here the keys are motron code of nodes in level i, which is a mismatch from index used in pd.Series.reindex(i.e., the motron code of parents). Do you know how to fix this? Or it supposed to behave like this?
if i == 0:
parents.append(torch.LongTensor([-1]).cuda())
else:
# Dividing by 2 will yield the morton code of the parent
pc = torch.floor(points / 2.0).short()
mt_pc = spc_ops.points_to_morton(pc.contiguous())
mt_pc_dest = spc_ops.points_to_morton(points)
plut = dict(zip(mt_pc_dest.cpu().numpy(), np.arange(mt_pc_dest.shape[0])))
pc_idx = pd.Series(plut).reindex(mt_pc.cpu().numpy()).values
parents.append(torch.LongTensor(pc_idx).cuda())
By the way, I tried to modify code as following, it seems working
if i == 0:
parents.append(torch.LongTensor([-1]).cuda())
else:
# Dividing by 2 will yield the morton code of the parent
pc = torch.floor(points / 2.0).short()
mt_pc = spc_ops.points_to_morton(pc.contiguous())
plut = dict(zip(mt_pc_dest.cpu().numpy(), np.arange(mt_pc_dest.shape[0])))
pc_idx = pd.Series(plut).reindex(mt_pc.cpu().numpy()).values + pyramid[1, i-1].item()
parents.append(torch.LongTensor(pc_idx).cuda())
mt_pc_dest = spc_ops.points_to_morton(points)