在框中分配对象的算法(如 InDesign、Illustrator、Draw!)

发布于 2024-08-20 05:10:47 字数 315 浏览 3 评论 0原文

我有一组具有相应位置的矩形和一个大矩形,用作这些矩形的“边界框”。

我想知道一种可以在矩形之间均匀“分配可用空间”的算法。有些人可能熟悉 Adob​​e InDesign 和类似的面向布局的应用程序中的“分布间距”选项。这就是我正在寻找的。

我确实尝试查找它,但我不熟悉“图形”算法术语,并且仅尝试与“分布”相关的术语主要产生有关分布式计算的结果。因此,即使是算法的名称或更好的查找术语也会有很大帮助。

最后,该算法不需要与 InDesign 的算法严格相同:几乎任何在区域内“分布”对象的算法都可以正常工作。事实上,由于我主要追求视觉吸引力,因此建议越多越好。 =D

I have a set of rectangles with their corresponding positions and a big rectangle which serves as the 'bounding box' for these rectangles.

I would like to know of an algorithm that would 'distribute the free space' evenly among the rectangles. Some of you may be familiar with the Distribute Spacing option in Adobe InDesign and similar layout-oriented apps. That would be what I'm looking for.

I did try looking it up, but I'm not familiar with 'graphical' algorithms terminology and trying only terms relating to 'distribute' mainly yields results about Distributed Computing. So, even the names of the algorithms or better terms to look up would be a big help.

Finally, the algorithm doesn't need to be rigorously the same as InDesign's one: pretty much any algorithm that 'distributes' objects inside a region will work fine. In fact, since I'm striving for visual appeal mainly, the more suggestions the better. =D

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

江南烟雨〆相思醉 2024-08-27 05:10:47

您可以查看图形布局算法基于力的算法可能适合您。

You could look into graph layout algorithms. A force-based algorithm might work for you.

七月上 2024-08-27 05:10:47

我认为必须有一种方法可以将其表述为线性规划问题。最大化矩形的总面积,但要确保它们永远不会相交作为限制。我想不出任何非线性的东西,所以应该可以。我唯一不确定的是是否可以生成限制列表以防止矩形重叠。我无法向自己证明这可能或不可能……这是我唯一能想到的。
希望有帮助。

I'm thinking there must be a way to formulate this as a linear programming problem. maximize the total area of the rectangles, but make sure that they never intersect as being the restrictions. I can't think of anything non-linear here, so should work. The only thing I'm not sure about is if it's possible to generate a list of restrictions to prevent rectangles from overlapping. I can't prove to myself that it is either possible or not not possible...that's the only thing I can think of.
Hope it helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文