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

2-level neighbors #7

Open
NeXTs opened this issue May 15, 2018 · 1 comment
Open

2-level neighbors #7

NeXTs opened this issue May 15, 2018 · 1 comment

Comments

@NeXTs
Copy link

NeXTs commented May 15, 2018

Hello

What's the most efficient way to find n-level neighbors?

I need to find find neighbors up to 4 levels.
image
There's a center, there are 4 level of neighbors, the further the neighbors the more their transparency.

1 level neighbors implemented by default.
What's the best way to find 2-4 level neighbors?

@arscan
Copy link
Owner

arscan commented May 16, 2018

I'm not sure what is 'best', as it depends on your situation. Perhaps a breadth first traversal that follows neighbors and tracks of how far each node is away from the origin and stops after a distance of n, taking care to not retraverse nodes that have already been visited. If you are changing the origin node frequently, the distance is big, and are rendering using GPU, then you could determine transparency using a simple distance function to the origin node in the vertex shader, but that would redo the (cheap) calculation on every render.

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

2 participants