给定两个重叠的任意多边形,找到最佳旋转以最大化重叠
我有两个任意的多边形,它们的形状可能相同,也可能不同,我正在寻找一种关于简单算法的建议,该算法将旋转其中一个多边形以最小化两者之间的差异。谢谢。
I have two arbitrary polygons that may or may not be the same shape, I'm looking for a advice on a simple algorithm that will rotate one of the polygons to minimize the difference between the two. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想让它们更加相似,您可以尝试最小化两个多边形之间的差异面积。也就是说,两者的并集面积减去它们之间的交集面积。
一种近似方法是找到每个多边形中距离最大的两个点(我们称它们为“直径”),并将这两个多边形对齐。
例如:
14.4
)[(14, 11); (8、17); (3,24); (9, 18)]
(另一个菱形)17.0
)多边形 B 移动并旋转,使直径对齐:
If you are trying to make them more similar, you could try to minimize the area of the difference between the two polygons. That is, the area of the union of the two, minus, the area of the intersection between them.
An approximation would be to find the two points with maximum distance in each polygon (lets call them 'diameters'), and align those for the two polygons.
For example:
[(13, 12); (9, 14); (1,4); (5, 2)]
(a rhombus)[(13, 12); (1,4)]
(length14.4
)[(14, 11); (8, 17); (3,24); (9, 18)]
(another rhombus)[(14, 11); (3,24)]
(length17.0
)Polygon B shifted and rotated so diameters align: