Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about generate parents in create_trinkets. #26

Open
Burningdust21 opened this issue Nov 19, 2021 · 0 comments
Open

Question about generate parents in create_trinkets. #26

Burningdust21 opened this issue Nov 19, 2021 · 0 comments

Comments

@Burningdust21
Copy link

Burningdust21 commented Nov 19, 2021

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant