如何在MATLAB中获取voronoi图的边缘及其相关位置? [英] How to get a voronoi diagram's edges and their associate sites in MATLAB?

查看:270
本文介绍了如何在MATLAB中获取voronoi图的边缘及其相关位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个voronoi图.现在,我要做的是存储每个边缘及其两个关联的站点.例如,我得到如下图:

说我要存储边(v4, v5)及其关联边X3X8.

我用过

[VX,VY] = voronoi(X(:,1),X(:,2));

创建此voronoi图.因此,我可以使用VXVY来获取所有边缘.但是,我真的不知道如何获得边缘的伙伴.换句话说,我可以得到边缘(v4, v5),但是我不知道要实现其关联站点X3X8,并使边缘(v4, v5)指向X3X8.

有人可以给我一些想法吗?

非常感谢!

解决方案

您可以使用来自以下位置的Voronoi单元格的C数组(请参见此处 http://www. mathworks.nl/help/matlab/math/voronoi-diagrams.html )

dt = delaunayTriangulation(X);
[V,R] = voronoiDiagram(dt)

I created a voronoi diagram. Now what I want to do is to store every edge and its two associated sites. For example, I got the diagram as the following:

Say I want to store the edge (v4, v5) and its associate sides, X3 and X8.

I used

[VX,VY] = voronoi(X(:,1),X(:,2));

to create this voronoi diagram. Thus I could use VX and VY to get all the edges. However, I do not really know how to get the edge's associate sides. In other words, I can get the edge (v4, v5), but I have no idea to achieve its associate sites,X3 and X8, and make edge (v4, v5) pointed to X3 and X8.

Could someone give me some ideas please?

Thanks very much!

解决方案

You can use C array of Voronoi cells from (see here http://www.mathworks.nl/help/matlab/ref/voronoin.html)

[V,C] = voronoin(X)

You can also use (see exmple here http://www.mathworks.nl/help/matlab/math/voronoi-diagrams.html)

dt = delaunayTriangulation(X);
[V,R] = voronoiDiagram(dt)

这篇关于如何在MATLAB中获取voronoi图的边缘及其相关位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆