https://github.com/slimenull/skylinealgorithmtest
2D Packing problem... but not box size
https://github.com/slimenull/skylinealgorithmtest
Last synced: 9 months ago
JSON representation
2D Packing problem... but not box size
- Host: GitHub
- URL: https://github.com/slimenull/skylinealgorithmtest
- Owner: SlimeNull
- Created: 2025-03-14T15:30:06.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-14T15:38:48.000Z (over 1 year ago)
- Last Synced: 2025-06-11T14:43:59.355Z (about 1 year ago)
- Language: C#
- Size: 348 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# SkylineAlgorithmTest
基于天空线(可能?)的二维打包算法, 和正常的二维打包不同的是, 此打包过程并未指定 "包" 的大小, 而是无限的控件, 矩形尽可能的紧凑布局, 保持近似方形, 占用更小的空间.

## 如何使用
下载当前仓库中的 RectSpace.cs 文件, 它是布局算法的核心, 然后放到你的项目中. 初始化 RectSpace 对象实例, 并调用 Layout 方法:
```cs
bool Layout(int width, int height, out int x, out int y);
```
通过 RectSpace 的 Width 和 Height 属性可以获取当前已完成布局内容所占空间的外接矩形宽高. 通过 Rectangles 属性可以访问已经完成布局的所有矩形.