I searching algorithm to solve problem like this:
I have few windows, each window can be moved and re sized but with specified ratio between width and height, eg. 2:1 (height:width).
Each window can't be on other window and all windows must be fully visible. Free area (desktop wallpaper visibility) must be minimal.
Can anyone tell me what algorithm i need for this type of problem?
Greetings,
The idea behind the tiling window manager is to efficiently and automatically organize your desktop for you. Most tiling window managers do this quite well—you open one app and it places it, automatically maximized, on your screen. Open another app and it splits the screen with the first app.
A tile is a type of shortcut you can only find in a grid, on the right side of your Windows 10 Start Menu. Colorful, sometimes animated, and larger than the regular sized icons used for desktop shortcuts, Windows tiles come in four different sizes.
Most systems provide two-dimensional tiled windows, adjustable in both height and width. advantages: The system usually allocates and positions windows for the user, eliminating the necessity to make positioning decisions. Open windows are always visible, eliminating the possibility of them being lost and forgotten.
Another approach, which might be simpler to implement than packing, would be to subdivide your screen size into the required number of panes, then fit a window which satisfies your other requirements inside the pane. Since you'll probably have a small number of windows open at any time, and since your screen doesn't change its size dynamically, you can probably pre-compute all the arrangements you need for 1 up to O(100) open windows.
If you can relax the requirement that all windows have a given "aspect ratio" then the problem becomes very simple. Suppose you have N
"tiles" to arrange on a single screen, then these can be arranged in columns where the number of columns, NumCols
is the square root of N
rounded up when N
is not a perfect square. All columns of tiles are of equal width. The number of tiles in each column is then N/NumCols
rounded either up or down as necessary to make the total number of columns be N
. This is what Microsoft Excel does under View > Arrange All > Tiled. Excel chooses to put the columns with one fewer tiles on the left of the screen.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With