1
$\begingroup$

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?

$\endgroup$
1
  • $\begingroup$ As linked from my question $\endgroup$
    – Mawg
    Commented Feb 26, 2019 at 7:20

1 Answer 1

3
$\begingroup$

I'm not sure what your precise problem is, but your problem does not appear to have a non-trivial algorithmic component. If I understand your problem, you wish to 'duplicate' some horizontal or vertical lines, where it is easy to find which lines to 'duplicate'.

If it is not so simple to find which lines to duplicate, and you can make a formal requirement for which lines should, then that question can be appropriate. However, note that an implementation of the algorithm is off-topic here.

I guess that your difficulty is performing operations an a svg file. This falls in the domain of programming, so I think this question is more appropriate for Stack Overflow.

$\endgroup$
3
  • $\begingroup$ 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? $\endgroup$
    – Mawg
    Commented Jan 24, 2019 at 15:29
  • 2
    $\begingroup$ @Mawg, it sounds like you already have the outline of an algorithm in mind, so I'm not sure what more there would be to say. Why don't you try to work out the details of your algorithm, then if there is some step that you don't know how to make efficient, perhaps you could ask about that specific step? $\endgroup$
    – D.W. Mod
    Commented Jan 24, 2019 at 19:43
  • $\begingroup$ Ok, that's what I will do. I will also Goolge around for some efficient algorithms. Thnaks $\endgroup$
    – Mawg
    Commented Jan 24, 2019 at 21:52

You must log in to answer this question.

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