简体   繁体   English

2D最近邻搜索移动点

[英]2D nearest neighbour search for moving points

I want do do some flocking simulation, as described here . 我想做一些植绒模拟,如这里所述。

For this I need to search for the nearest neighbours of each of my 2D points. 为此,我需要搜索每个2D点的最近邻居。 However, I cannot use a static data structure like a kd tree because the points are always moving... 但是,我不能使用像kd树这样的静态数据结构,因为这些点总是在移动......

What's a good (easy) datastructure/library that is able to achieve this? 什么是一个好的(简单的)数据结构/库能够实现这一目标? I'm working with C++... 我正在使用C ++ ...

People have studied this problem. 人们研究过这个问题。 The important keyword is kinetic, when looking for work in this ares. 当寻找这方面的工作时,重要的关键词是动能。

Maybe you want to try a quadtree or a spatial index? 也许你想尝试四叉树或空间索引? What's the problem with a kd tree? kd树有什么问题? Basically when have the edge the flock/points you can skip checking collision with edges far away. 基本上当边缘有绒毛/点时,你可以跳过检查远处边缘的碰撞。 A spatial index can be a quadtree, r-tree, kd-tree or hilbert r-tree. 空间索引可以是四叉树,r树,kd树或hilbert r树。 A better answer can be read here: Approximate, incremental nearest-neighbour algorithm for moving bodies 可以在这里阅读更好的答案: 移动物体的近似,增量最近邻算法

"That is, recursively partition the "world" into a graph with four subnodes each. The tree can then quickly check which objects are inside a particular square of the world and discard the rest. A very effective culling technique often used for improving performance of collision detection in games." “也就是说,递归地将”世界“划分为一个图形,每个图形有四个子节点。然后树可以快速检查哪些物体在世界的特定方格内并丢弃其余的。一种非常有效的剔除技术通常用于提高性能。游戏中的碰撞检测。“

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM