# Would a "find enclosing room" algorithm question be on-topic here?

While searching for a solution, I stumbled upon this question on the main site, which seems at least related.

I have previously asked on s/w engineering meta if I could ask there and the answer is negative.

To repeat that question (hopefully this won’t be closed as a duplicate, as both are on Meta):

I have a collection of floor-plans as SVG. Bad ascii art follows

Room walls are SVG paths like this (door added separately, but a room can be defined as an enclosed path.

+--------------------+--------------------+
|                    |                    |
|      Room 1        |      Room 2        |
|                    |                    |
|   /                |  /                 |
+--/-----------------+-/------------------+


And I want to make them like this

+--------------------++--------------------+
|                    ||                    |
|      Room 1        ||      Room 2        |
|                    ||                    |
|   /                ||  /                 |
+--/-----------------++-/------------------+


with no adjoining walls. The reason being that I want to be able to detect a click within a room when the floor-plan is displayed.

Would it be on topic to ask for an algorithm which I could code to perform the conversion?

• As linked from my question Feb 26 '19 at 7:20

• Thanks for the feedback (+1). "does not appear to have a non-trivial algorithmic component". Given that each room has a label - which I failed to state - and algorithm might be something like for each room_label, find the smallest enclosing closed polygon. Then "for each such polygon, if one line coincides with a line of another polygon, nudge it over by one pixel" (shrink the room on that side; accuracy is not vital). I am definitely only trying to find an (efficient) algorithm. The programming and knowledge of SVG I can handle by myself. Can I make an on-topic question of this? Jan 24 '19 at 15:29