# Merging rectangles into rectilinear polygon

Having a set of adjacent rectangles, what would be the algorithm that gets the rectilinear polygon wrapping around them?

• Your example still has unnecessary vertices in the output. – orlp Apr 21 at 0:31

• Form a list of the $$4n$$ edges making up the $$n$$ rectangles.