我想要將許多不重疊的矩形壓縮成更大的矩形時它們相鄰。我現在的算法將許多矩形組合成更少的矩形
僞代碼:
do
compress horizontally using sweep and prune
compress horizontal output vertically using sweep and prune
while (this output is small than previous output)
這裏有一個link to sweep and prune。
這是行之有效的,但我想知道是否有辦法導致更少的矩形輸出。我認爲這比我現在做的更復雜。
我根據新的標準,更新了我的答案。 – Ted
Downvoter,原因? –