四叉树应该只在 children 中存储点吗?
Should Quadtrees store points only in the children?
虽然我们通常为每个四叉树定义一个容量,但似乎我在网上找到的所有pseudo-code算法都不太关心四叉树中的可视点数。
四叉树划分时是否需要将四叉树包含的点重新分配到其children中?
我似乎无法正确实现,维基百科的四叉树的 pseudo-code 类别对此只有评论(但没有代码):
We have to add the points/data contained into this quad array to the new quads if we want that only the last node holds the data
假设问题是关于点四叉树,让我们复习一下。
Is it necessary to redistribute the points contained by a Quadtree into its children when it's being divided?
不,没有必要。
但是,这样更好吗?
Redistribution is mostly just something you turn on when performance measurements in your specific use case show your code runs faster with it enabled.
感谢@Mike'Pomax'Kamermans 的评论。
这取决于您如何使用四叉树。
请记住,
你仍然会为每个作为划分阈值的四叉树定义一个capacity
。
不会影响整体时间复杂度.
将出现更多四叉树。
Parents 不会持有任何积分。
在插入时支付价格。
满额后需要重新分配积分
对查询有什么影响?
- 超出范围点停止更快
- Brute-forcefully 检查点可能会减少。
- 选中的四叉树可能会增加。
与其他模式相比,它执行得更快还是更慢,这真的取决于环境;容量、递归堆栈开销和点分散。
但是,由于您在插入时付出了代价,它通常会更快地执行查询。
虽然我们通常为每个四叉树定义一个容量,但似乎我在网上找到的所有pseudo-code算法都不太关心四叉树中的可视点数。
四叉树划分时是否需要将四叉树包含的点重新分配到其children中?
我似乎无法正确实现,维基百科的四叉树的 pseudo-code 类别对此只有评论(但没有代码):
We have to add the points/data contained into this quad array to the new quads if we want that only the last node holds the data
假设问题是关于点四叉树,让我们复习一下。
Is it necessary to redistribute the points contained by a Quadtree into its children when it's being divided?
不,没有必要。
但是,这样更好吗?
Redistribution is mostly just something you turn on when performance measurements in your specific use case show your code runs faster with it enabled.
感谢@Mike'Pomax'Kamermans 的评论。
这取决于您如何使用四叉树。
请记住,
你仍然会为每个作为划分阈值的四叉树定义一个
capacity
。不会影响整体时间复杂度.
将出现更多四叉树。
Parents 不会持有任何积分。
在插入时支付价格。
满额后需要重新分配积分
对查询有什么影响?
- 超出范围点停止更快
- Brute-forcefully 检查点可能会减少。
- 选中的四叉树可能会增加。
与其他模式相比,它执行得更快还是更慢,这真的取决于环境;容量、递归堆栈开销和点分散。
但是,由于您在插入时付出了代价,它通常会更快地执行查询。