Find maximum area polygon inscribed in larger polygon

∥☆過路亽.° 提交于 2019-12-10 12:47:49

问题


I would like to find the rotation and location for a polygon that maximizes how large it can be scaled up within the constraints of fitting within a larger polygon.

Current idea is to use scipy optimization routines for optimizing position and rotation parameters to maximize the scaling parameter, and shapely to add a constraint that the polygon is contained. This seems like it'll be slow and not particularly elegant.

Other ideas?


回答1:


This problem sounds like it might be NP-Hard. Given a candidate solution you can't really be certain that it is the best solution. It seems like you'd need to try to use some sort of incremental randomized search.




回答2:


If the internal polygon is maximally scaled, then there are at least 4 pairs "internal vertice - external edge" or "external vertice - internal edge" where the vertice is on the edge.

Let's take all 4s of vertice-edge pairs. For every one we get the system of linear equations for two reference points' coordinates. If it has one solution, we verify that there are no intersections and if OK we remember the coordinates and size of the internal polygon.

This is an exact solution, but it's slow. On the other hand, scipy optimization routines are likely to find a local maximum which is not the global one.



来源:https://stackoverflow.com/questions/17359831/find-maximum-area-polygon-inscribed-in-larger-polygon

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!