以整数精度合并(布尔并集)矩形区域
给定任意数量的相交、不相交和接触的矩形,如何找到(多条)轮廓折线?矩形是在像素坐标中定义的,因此它们具有整数精度,但它们可能有数千个单位大。
我确实需要轮廓的数字坐标,合并 GDI 区域是行不通的。我知道我可以通过创建 GDI 区域并调用 GetRegionScans 来简化问题,但它仍然无法解决问题。
这是实时 UI 的一部分,因此算法需要相当快(我猜永远不会超过十几个盒子,也许一百个)。
我正在用 C# 执行此操作,但由于这是一个算法问题,所以我并不真正关心语言。任何想法都非常受欢迎。
Given any number of intersection, disjoint and touching rectangles, how to find the (multiple) outline polylines? Rectangles are defined in pixel coordinates so they have integer accuracy, but they may be thousands of units large.
I really need numeric coordinates for the outlines, merging GDI regions won't do. I know I can simplify the problem by creating a GDI region and calling GetRegionScans, but it still won't solve the problem.
This is part of real-time UI, so the algorithm needs to be reasonably fast (I'm guessing never more than a dozen or so boxes, maybe a hundred).
I'm doing this in C#, but since this is an algorithmic question I don't really care about language. Any ideas most welcome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道这是否满足您的性能要求,但它应该有效:
结果集包含构成轮廓的所有线条。
I have no idea if this satisfies your performance requirements, but it should work:
The resulting set contains all the lines that make up the outline.