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.

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

2 Answers 2



We have a custom close reason for similar problems:

Questions asking us to find or recommend tools, libraries, programming languages, resources (including books, blogs, tutorials, and examples), or projects to undertake are off-topic here as they attract opinionated answers that won't have lasting value to others. You may be able to get help in The Whiteboard, our chat room.

Although it's not explicitly mentioned (close reasons are only so long), the answers that such a question would attract are the same. If you could specify the problem in enough detail such that the answer wouldn't be opinionated, then you would be delegating the work of a search engine to our human users.

  • Thanks for the feedback. Glad I asked here.
    – Mawg
    Jan 22, 2019 at 21:15

Thomas Owens is surely right that just asking for an algorithm would not be on topic. But if you made a serious attempt to develop an algorithm on your own, describe what you found out and where you got stuck, then asking about help could be on-topic here.

Said that, I think if you want to go that route, you need to be more precise on how the input looks like, and what you expect as output. Currently, I think your problem description is very vague. FWIW, try to google for "polygonizer algorithm", maybe that is what you are looking for.

In case you are really looking for a polygonizer: I implemented one some years ago by myself (before I ever heard the term), and from that experience, I can tell you it is actually hard to give a concise description that would fit here in a not-too-long-winded answer. There are lots of partial problems to solve for a complete solution, and which one exactly depends a lot on the details of the particular case. So I recommend trying to find a scientific paper, or some algorithm description which is detailed enough to implement what you have in mind. Google is your friend.

  • Thanks. That's helpful. It might help that I am not just looking at matrix of black/white pixels and trying to identify polygons. I am half way there in that I already have SVG paths. Perhaps if I label the rooms, then I can find each label and search outwards for an enclosing polygon. Or something along those lines.
    – Mawg
    Jan 24, 2019 at 7:28
  • Can I also on-topic ask for a review of the algorithm? It is beginning got look like just finding the smallest polygon, whether by edge length or area which encloses each label. BUT, I am no mathematician.
    – Mawg
    Jan 24, 2019 at 13:45
  • Algorithm review question are definitely on-topic, but I cannot guarantee for all of our community to share that point of view, see this question: softwareengineering.meta.stackexchange.com/questions/7967/… However, the top answer to that question seem to agree to me.
    – Doc Brown
    Jan 24, 2019 at 14:36
  • 2
    @Mawg: ... Note, however, for mathematical algorithms Computer Science may be the better place to ask. For your case, GIS SE may also well suited. But beware, do not ask the same question in two SE sites, crossposts get downvoted and deleted by the communities.
    – Doc Brown
    Jan 24, 2019 at 14:43
  • Thanks again for the suggestion. Of course I would not cross post ... although ... perhaps to another Meta, with a link to here?
    – Mawg
    Jan 24, 2019 at 15:25
  • 1
    @Mawg: that is something you have to decide for yourself. But since your question above here does not make clear you are after a algorithm review (at least not as it is written now), you should add some words about this when you ask.
    – Doc Brown
    Jan 24, 2019 at 16:08
  • Well, wehn I posted, I hadn't a clue, so it was "please give me an algorithm". Now that I have an inlkling, I will try to refine it myself, and ppost here for review if necessary
    – Mawg
    Jan 24, 2019 at 17:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .