Skip to content

Traversing the AABB tree uses a fixed-length array of length 32 to simulate a stack. How does it ensure that the stack will not overflow? #3350

Answered by Fedr
BlackantHermit asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks for the question. Currently we can have up to 2^31 faces in a mesh. And since all our trees are balanced, their depth is always at most 32.

Projection can be split on two stages:

  1. initial depth-first search of some point on mesh, where such stack size is enough because it is more than the depth of any leaf in tree.
  2. search of possible closer points in not yet visited subtrees, where active pruning discards nodes located further than known point on mesh. On practice we have not seen stack overflow here, but some theoretical proof would be nice to have at least for not fully degenerate meshes.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by BlackantHermit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants