擅长:python、mysql、java
<p>你可以用几种不同的方法。在</p>
<p>如果您可以访问Voronoi图,您可以在单元之间查找共享的边段。如果发现两个单元共享Voronoi边段,则表示它们相邻。建立整个数据集的邻接信息的一种有效方法是通过扫描Voronoi单元列表来建立边缘哈希表。在</p>
<pre><code>for (all cells in voronoi diagram)
for (all edges in current cell)
if (matching edge found in hash table)
// the current cell is adjacent to the cell that added
// the matching edge segment to the hash table
else
// push current edge segment onto hash table and mark with
// current cell index
endif
endfor
endfor
</code></pre>
<p>有许多很好的现有软件包可用于计算点集的Voronoi图/Delaunay三角剖分。由于这是一个计算开销大且对数字敏感的操作,我建议使用现有的库。<a href="http://www.cs.cmu.edu/~quake/triangle.html" rel="nofollow">Triangle</a>和{a2}包被广泛使用。在</p>
<p>希望这有帮助。在</p>