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

Improve selectRandomBrick #693

Open
Steditor opened this issue Jul 1, 2015 · 0 comments
Open

Improve selectRandomBrick #693

Steditor opened this issue Jul 1, 2015 · 0 comments

Comments

@Steditor
Copy link
Contributor

Steditor commented Jul 1, 2015

  • Have an array of all bricks after voxelization, each brick knows its position in the array
  • Select randomly a brick of the array, process it
  • For each brick of the merge process take the last brick of the array, put it at the position of the removed brick, update the position cache. (To avoid overhead of removing elements and shifting all following elements)

Benefits:

  • Selects from bricks, not from voxels.
  • Does not select bricks that are already max. merged.
  • Selects in O(1).
  • Does not select from coordinate space, therefore always selects a brick.
  • Performance of select random improves over time, currently: decreases over time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants