Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

enter image description here

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
  • room B: 2, 3, 10, 9, 2
  • room C: 11, 12, 14, 13, 11
  • room 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):

x y

47 196

47 85

258 85

it is in pixel coord.

like image 263
Mac Avatar asked Dec 30 '25 06:12

Mac


1 Answers

Graph Theory did not really help me because I have disconnected loops that share information. For example [1 2 9 10 3 4 5 8 1] AND [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.

like image 177
Mac Avatar answered Jan 02 '26 09:01

Mac



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!