如何搜索影响空间中的点的对象对象、空间

2023-09-11 07:06:35 作者:__豪情万纵

假设你有一个大的网格。您有关于点集的操作对象。 presumably合理的方式来实现这有合理的性能在运行时(即说合理规模的网格游戏),presuming的可用内存是:

Lets say you have a large grid. You have objects that operate on sets of points. Presumably the reasonable way to implement this to have reasonable performance at runtime (namely say reasonably sized grids for games), presuming memory is available is that:

您必须指向,经营上的每一个点的特定点的每个对象。

You have pointers to every object that operates on a particular point for every point.

让我们presume这不过是网格的precision望而却步,你不希望存储指针的每一个点,presumably你会实现这样的:

Let us presume that however that the precision of the grid is prohibitive and you don't want to store pointers for every point, presumably you would implement something like:

拆分电网分层

接下来的问题是,什么是找到包含的一个点集的空间子集的最佳方式所述子集?

The next question is, what is the best way to find subsets of a space containing a point in a set of said subsets?

也许

一个可以做一个天真的选择搜索(​​N)通过整组或者一个可以索引产地/逆POS轴,然后做匹配范围的交集。

One can either do a naive selection search (N) through the entire set or one can index origin/inverse pos axes and then do an intersection of matched ranges.

使用关于存储在存储器中数据结构的对象,可以presumably最佳实施属性的索引:

With regards to indexing of properties of objects stored in memory datastructures, one can presumably optimally implement:

维护B树索引对象属性 搜索索引和不相交/用于查询联合

Maintain B-Tree index on object properties Search indexes and do intersect/union for queries

所以基本上这是一个问题,即是否:

So essentially this is a question as to whether:

在我错过了一些关于请求这类信息从一个网格? 怎么一一般无二有关实现内存索引(当然他们可能只用一大组小范围时很有用,考虑到路口将是巨大的成本是多少?)

Sorted字符串表(的SSTable)或B +树的数据库索引?

有该线程。我不明白它们是如何存储在这似乎是这样的一个数组的索引。他们如何插入周围的N个成本获取/移动到(动态/磁盘)阵列的中间?

There is that thread. I don't understand how they are storing an index in what appears to be something like an array. How do they get around the N cost of insertion/shifting into the middle of an (dynamic/on disk) array?

推荐答案

如果我正确理解你的问题,你有在一系列点的网格上运行的对象,那么你可以重新present这一点的, 2维区间树。

If I understand your question correctly in that you have objects that operate on a range of points on a grid, then you can represent this with a 2-dimensional interval tree.