简体   繁体   English

从边缘查找内部几何体

[英]Find inner geometry from edges

First I am not sure which keywords to use for this and I think I am probably using the wrong ones to google about it, so if someone could give me any hint it would be much appreciated. 首先,我不确定使用哪个关键字,我认为我可能正在使用错误的关于它的谷歌,所以如果有人可以给我任何提示,将非常感激。

My problem is the following: I need to find the "rooms" inside a house plan. 我的问题如下:我需要在房屋计划中找到“房间”。 For example take this geometry: 例如,取这个几何:

在此输入图像描述

The desired algorithm would tell me which vertexes bound each of the rooms. 所需的算法会告诉我哪些顶点绑定了每个房间。 So for this example it would be: 所以对于这个例子,它将是:

  • room A: 1, 2, 9, 10, 3, 4, 5, 8 ,1 房间A:1,2,9,10,3,4,5,8,1
  • room B: 2, 3, 10, 9, 2 房间B:2,3,10,9,2
  • room C: 11, 12, 14, 13, 11 C:11,12,14,13,11
  • room D: 5, 6, 7, 8, 5 房间D:5,6,7,8,5

I have the vertexes and the edges as input data. 我有顶点和边作为输入数据。 Edit: The edge data is as follows (edge 8, 1 ,2): 编辑:边缘数据如下(边缘8,1,2):

xy XY

47 196 47 196

47 85 47 85

258 85 258 85

it is in pixel coord. 它是在像素协调中。

Graph Theory did not really help me because I have disconnected loops that share information. Graph Theory并没有真正帮助我,因为我已经断开了共享信息的循环。 For example [1 2 9 10 3 4 5 8 1] AND [11 12 14 13 11]. 例如[1 2 9 10 3 4 5 8 1]和[11 12 14 13 11]。 So in the end I ended up doing a image fill, when expanding the boarders of the fill 1 pixel and doing a boolen operation to figure out which vertex are inside the filled image. 所以最后我最终做了一个图像填充,当扩展填充1像素的边界并做一个boolen操作来找出填充图像中的哪些顶点。

One of possible solutions is to triangulate this area so that every input edge is an edge of some triangle. 一种可能的解决方案是对该区域进行三角测量,以使每个输入边缘都是某个​​三角形的边缘。 Then split triangles into connected sets and find their border. 然后将三角形拆分为连接集并找到它们的边界。

There are several algorithms for triangulation: ear-clipping, Delaunay, ... 三角测量有几种算法:耳剪,Delaunay,......

This is planar graph . 这是平面图 It has V vertices, E edges and F = E - V + 2 faces (including outer face). 它有V个顶点,E个边和F = E - V + 2个面(包括外面)。 We have to determine the edge list for all the faces. 我们必须确定所有面的边缘列表。 Every edge will be used twice in these lists (in forward and backward direction). 每个边缘将在这些列表中使用两次(向前和向后)。

Create main arc list, add all the arcs (ie for 1-2 undirected edge add both 1-2 and 2-1 directed arcs) 创建主弧列表,添加所有弧(即1-2个无向边添加1-2和2-1定向弧)

Find the lowest vertex point. 找到最低的顶点。 If there are some such points, choose the leftmost one (7th here). 如果有一些这样的点,请选择最左边的点(这里是第7个)。 Travel the outer face (contour) in CCW direction (choose the rightmost outgoing arc at every vertex): 7-6-5-4-3-2-1-7. 沿CCW方向移动外表面(轮廓)(在每个顶点选择最右边的出弧):7-6-5-4-3-2-1-7。 Remove visited arcs from the main list. 从主列表中删除访问的弧。

Get any arc from the main list, travel the first inner face, follow the right-hand rule (ie 7-8-5-6-7), remove visited arcs. 从主列表中获取任何圆弧,沿着第一个内部面部行进,遵循右侧规则(即7-8-5-6-7),移除访问过的弧线。

Repeat until the main list is empty. 重复,直到主列表为空。

Repeat all the procedure for disconnected components (11-12-13-14) 对断开连接的组件重复所有过程(11-12-13-14)

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

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