简体   繁体   English

由矩形的并集构成矩形的算法的名称?

[英]Names of algorithms for making rectangles from a union of rectangles?

Problem 问题

I have a case where I generate axis aligned rectangles that may or may not overlap each other - they often will. 我遇到的情况是,我生成的轴对齐的矩形可能彼此重叠,也可能不彼此重叠,通常它们会重叠。 Ultimately, I need a set of rectangles that do not overlap, but cover (at least) the same regions. 最终,我需要一组不重叠但至少(至少)覆盖相同区域的矩形。 I'm looking for algorithms to accomplish this efficiently online (at run-time) in a real-time setting. 我正在寻找一种算法,以在实时设置中有效地在线(在运行时)完成此任务。 I have some ideas, but they may be naive or brutal and I'd like to avoid reinventing the wheel if this is a well studied and resolved problem. 我有一些想法,但它们可能是幼稚或残酷的,如果这是一个经过充分研究和解决的问题,我想避免重新发明轮子。

I'm having difficulty thinking of other applications or metaphors that might clue me in to a name. 我很难想到可能会提示我使用名称的其他应用程序或隐喻。 Is there a specific name for this kind of problem/algorithmic solution? 这种问题/算法解决方案是否有特定名称? Kind of like, say, the "four color theorem" in trying to color maps with no adjacent regions of the same color. 类似于“四色定理”,它试图对没有相同颜色的相邻区域的地图进行着色。 "Four Color Theorem" being, in a sense, the algorithm with "coloring regions of a map such that no adjacent region share a color" being the problem instance. 从某种意义上说,“四色定理”是一种算法,其中“对地图上的区域进行着色,使得没有相邻的区域共享一种颜色”是问题实例。

Context 语境

The specific application is to generate rectangular height fields for collision purposes around objects, but objects in close proximity will cause overlapping height fields, which will cause collision artifacts. 特定的应用是生成矩形高度场以用于对象周围的碰撞目的,但是紧密接近的对象将导致重叠的高度场,这将导致碰撞伪影。 Preserving existing rectangles and favoring those with a larger area is preferable to minimize the amount of memory that needs to be moved/copied into a new rectangle height field. 保留现有的矩形并偏爱具有较大面积的矩形是可取的,这样可以最大程度地减少需要移动/复制到新矩形高度字段中的内存量。

Example Images 范例图片

红色,绿色和蓝色矩形与矩形重叠红色,绿色和蓝色矩形与潜在的细分线重叠

one class of algorithms you may find useful is called 'plane sweep' or 'line sweep' algorithms. 您可能会发现有用的一类算法称为“平面扫描”或“线扫描”算法。 basically you sort your object by one of the axis and then you process them in that order to discover all significant points/events like start, end, intersection 基本上,您通过轴之一对对象进行排序,然后对其进行处理以发现所有重要的点/事件,例如开始,结束,交点

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM